forked from assaabloy-ppi/salt-channel-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
41 lines (30 loc) · 1.44 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 2.8)
project(salt-channel-c)
enable_language(C)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
find_package(Sanitizers)
option(USE_SODIUM "Use TweetNaCl as crypto native" OFF)
if(USE_SODIUM)
include_directories ("${PROJECT_SOURCE_DIR}/src/external/libsodium")
include_directories ("${PROJECT_SOURCE_DIR}/src/external/libsodium/include")
set(EXTRA_LIBS ${EXTRA_LIBS} sodium)
add_definitions(-DUSE_SODIUM=1)
else(USE_SODIUM)
set_source_files_properties(src/external/tweetnacl/tweetnacl.c PROPERTIES COMPILE_FLAGS -Wno-sign-compare)
add_library(tweetnacl src/external/tweetnacl/tweetnacl.c)
add_sanitizers(tweetnacl)
include_directories ("${PROJECT_SOURCE_DIR}/src/external/tweetnacl_modified")
set(EXTRA_LIBS ${EXTRA_LIBS} tweetnacl_modified)
set_source_files_properties(src/external/tweetnacl_modified/tweetnacl_modified.c PROPERTIES COMPILE_FLAGS -Wno-sign-compare)
add_library(tweetnacl_modified src/external/tweetnacl_modified/tweetnacl_modified.c)
add_sanitizers(tweetnacl_modified)
endif(USE_SODIUM)
set(CMAKE_C_FLAGS_DEBUG "-fprofile-arcs -ftest-coverage -std=c99 ${CMAKE_CXX_FLAGS_DEBUG}")
add_definitions(-O0 -g -ggdb -DSALT_DEBUG=1 -Wall -Werror -Wpedantic -Wshadow -std=c99)
add_subdirectory(src)
add_subdirectory(examples)
option(BUILD_TESTS "Build tests" ON)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif(BUILD_TESTS)