diff options
Diffstat (limited to 'CMakeLists.txt')
-rwxr-xr-x[-rw-r--r--] | CMakeLists.txt | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c16ce6fe..9b7db143 100644..100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -1,11 +1,31 @@ | |||
1 | cmake_minimum_required(VERSION 2.6.0) | 1 | cmake_minimum_required(VERSION 2.6.0) |
2 | 2 | ||
3 | set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) | ||
4 | |||
5 | if(NOT WIN32) | ||
6 | option(USE_NACL "Use NaCl library instead of libsodium") | ||
7 | endif() | ||
8 | |||
9 | if(USE_NACL) | ||
10 | find_package(NaCl REQUIRED) | ||
11 | |||
12 | include_directories(${NACL_INCLUDE_DIR}) | ||
13 | add_definitions(-DVANILLA_NACL) | ||
14 | |||
15 | set(LINK_CRYPTO_LIBRARY ${NACL_LIBRARIES}) | ||
16 | endif() | ||
17 | |||
3 | #MinGW prints more warnings for -Wall than gcc does, thus causing build to fail | 18 | #MinGW prints more warnings for -Wall than gcc does, thus causing build to fail |
4 | if(NOT WIN32) | 19 | if(NOT WIN32) |
5 | if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")) | 20 | if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")) |
6 | message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====") | 21 | message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====") |
7 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") | 22 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") |
8 | endif() | 23 | endif() |
24 | find_package(SODIUM REQUIRED) | ||
25 | endif() | ||
26 | |||
27 | if(NOT USE_NACL) | ||
28 | set(LINK_CRYPTO_LIBRARY ${SODIUM_LIBRARY}) | ||
9 | endif() | 29 | endif() |
10 | 30 | ||
11 | macro(linkCoreLibraries exe_name) | 31 | macro(linkCoreLibraries exe_name) |
@@ -16,8 +36,10 @@ macro(linkCoreLibraries exe_name) | |||
16 | ${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a | 36 | ${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a |
17 | ws2_32) | 37 | ws2_32) |
18 | else() | 38 | else() |
39 | include_directories(${SODIUM_INCLUDE_DIR}) | ||
19 | target_link_libraries(${exe_name} core | 40 | target_link_libraries(${exe_name} core |
20 | sodium) | 41 | ${LINK_CRYPTO_LIBRARY}) |
42 | |||
21 | endif() | 43 | endif() |
22 | endmacro() | 44 | endmacro() |
23 | 45 | ||
@@ -25,4 +47,4 @@ cmake_policy(SET CMP0011 NEW) | |||
25 | 47 | ||
26 | add_subdirectory(core) | 48 | add_subdirectory(core) |
27 | add_subdirectory(testing) | 49 | add_subdirectory(testing) |
28 | add_subdirectory(other) \ No newline at end of file | 50 | add_subdirectory(other) |