diff options
Diffstat (limited to 'CMakeLists.txt')
-rwxr-xr-x | CMakeLists.txt | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 07098391..f56cd67a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -2,14 +2,18 @@ cmake_minimum_required(VERSION 2.6.0) | |||
2 | 2 | ||
3 | set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) | 3 | set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) |
4 | 4 | ||
5 | if(UNIX) | 5 | option(SHARED_TOXCORE "Build Core as a shared library") |
6 | find_package(Curses REQUIRED) | ||
7 | endif() | ||
8 | 6 | ||
9 | if(NOT WIN32) | 7 | if(WIN32) |
8 | option(SHARED_LIBSODIUM "Links libsodium as a shared library") | ||
9 | else() | ||
10 | option(USE_NACL "Use NaCl library instead of libsodium") | 10 | option(USE_NACL "Use NaCl library instead of libsodium") |
11 | endif() | 11 | endif() |
12 | 12 | ||
13 | if(UNIX) | ||
14 | find_package(Curses REQUIRED) | ||
15 | endif() | ||
16 | |||
13 | if(USE_NACL) | 17 | if(USE_NACL) |
14 | find_package(NaCl REQUIRED) | 18 | find_package(NaCl REQUIRED) |
15 | 19 | ||
@@ -17,6 +21,12 @@ if(USE_NACL) | |||
17 | add_definitions(-DVANILLA_NACL) | 21 | add_definitions(-DVANILLA_NACL) |
18 | 22 | ||
19 | set(LINK_CRYPTO_LIBRARY ${NACL_LIBRARIES}) | 23 | set(LINK_CRYPTO_LIBRARY ${NACL_LIBRARIES}) |
24 | else() | ||
25 | find_package(SODIUM REQUIRED) | ||
26 | |||
27 | include_directories(${SODIUM_INCLUDE_DIR}) | ||
28 | |||
29 | set(LINK_CRYPTO_LIBRARY ${SODIUM_LIBRARY}) | ||
20 | endif() | 30 | endif() |
21 | 31 | ||
22 | #MinGW prints more warnings for -Wall than gcc does, thus causing build to fail | 32 | #MinGW prints more warnings for -Wall than gcc does, thus causing build to fail |
@@ -25,25 +35,15 @@ if(NOT WIN32) | |||
25 | message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====") | 35 | message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====") |
26 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") | 36 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") |
27 | endif() | 37 | endif() |
28 | find_package(SODIUM REQUIRED) | ||
29 | endif() | ||
30 | |||
31 | if(NOT USE_NACL) | ||
32 | set(LINK_CRYPTO_LIBRARY ${SODIUM_LIBRARY}) | ||
33 | endif() | 38 | endif() |
34 | 39 | ||
35 | macro(linkCoreLibraries exe_name) | 40 | macro(linkCoreLibraries exe_name) |
36 | add_dependencies(${exe_name} toxcore) | 41 | add_dependencies(${exe_name} toxcore) |
37 | if(WIN32) | 42 | target_link_libraries(${exe_name} toxcore |
38 | include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/) | 43 | ${LINK_CRYPTO_LIBRARY}) |
39 | target_link_libraries(${exe_name} toxcore | ||
40 | ${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a | ||
41 | ws2_32) | ||
42 | else() | ||
43 | include_directories(${SODIUM_INCLUDE_DIR}) | ||
44 | target_link_libraries(${exe_name} toxcore | ||
45 | ${LINK_CRYPTO_LIBRARY}) | ||
46 | 44 | ||
45 | if(WIN32) | ||
46 | target_link_libraries(${exe_name} ws2_32) | ||
47 | endif() | 47 | endif() |
48 | endmacro() | 48 | endmacro() |
49 | 49 | ||