summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rwxr-xr-x[-rw-r--r--]CMakeLists.txt26
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 @@
1cmake_minimum_required(VERSION 2.6.0) 1cmake_minimum_required(VERSION 2.6.0)
2 2
3set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
4
5if(NOT WIN32)
6 option(USE_NACL "Use NaCl library instead of libsodium")
7endif()
8
9if(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})
16endif()
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
4if(NOT WIN32) 19if(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)
25endif()
26
27if(NOT USE_NACL)
28 set(LINK_CRYPTO_LIBRARY ${SODIUM_LIBRARY})
9endif() 29endif()
10 30
11macro(linkCoreLibraries exe_name) 31macro(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()
22endmacro() 44endmacro()
23 45
@@ -25,4 +47,4 @@ cmake_policy(SET CMP0011 NEW)
25 47
26add_subdirectory(core) 48add_subdirectory(core)
27add_subdirectory(testing) 49add_subdirectory(testing)
28add_subdirectory(other) \ No newline at end of file 50add_subdirectory(other)