blob: f56cd67aecc215f73aaade4a400813819b9529d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
cmake_minimum_required(VERSION 2.6.0)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
option(SHARED_TOXCORE "Build Core as a shared library")
if(WIN32)
option(SHARED_LIBSODIUM "Links libsodium as a shared library")
else()
option(USE_NACL "Use NaCl library instead of libsodium")
endif()
if(UNIX)
find_package(Curses REQUIRED)
endif()
if(USE_NACL)
find_package(NaCl REQUIRED)
include_directories(${NACL_INCLUDE_DIR})
add_definitions(-DVANILLA_NACL)
set(LINK_CRYPTO_LIBRARY ${NACL_LIBRARIES})
else()
find_package(SODIUM REQUIRED)
include_directories(${SODIUM_INCLUDE_DIR})
set(LINK_CRYPTO_LIBRARY ${SODIUM_LIBRARY})
endif()
#MinGW prints more warnings for -Wall than gcc does, thus causing build to fail
if(NOT WIN32)
if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
endif()
endif()
macro(linkCoreLibraries exe_name)
add_dependencies(${exe_name} toxcore)
target_link_libraries(${exe_name} toxcore
${LINK_CRYPTO_LIBRARY})
if(WIN32)
target_link_libraries(${exe_name} ws2_32)
endif()
endmacro()
cmake_policy(SET CMP0011 NEW)
add_subdirectory(core)
add_subdirectory(testing)
add_subdirectory(other)
add_subdirectory(docs)
|