summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rwxr-xr-xCMakeLists.txt36
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
3set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) 3set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
4 4
5if(UNIX) 5option(SHARED_TOXCORE "Build Core as a shared library")
6 find_package(Curses REQUIRED)
7endif()
8 6
9if(NOT WIN32) 7if(WIN32)
8 option(SHARED_LIBSODIUM "Links libsodium as a shared library")
9else()
10 option(USE_NACL "Use NaCl library instead of libsodium") 10 option(USE_NACL "Use NaCl library instead of libsodium")
11endif() 11endif()
12 12
13if(UNIX)
14 find_package(Curses REQUIRED)
15endif()
16
13if(USE_NACL) 17if(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})
24else()
25 find_package(SODIUM REQUIRED)
26
27 include_directories(${SODIUM_INCLUDE_DIR})
28
29 set(LINK_CRYPTO_LIBRARY ${SODIUM_LIBRARY})
20endif() 30endif()
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)
29endif()
30
31if(NOT USE_NACL)
32 set(LINK_CRYPTO_LIBRARY ${SODIUM_LIBRARY})
33endif() 38endif()
34 39
35macro(linkCoreLibraries exe_name) 40macro(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()
48endmacro() 48endmacro()
49 49