forked from luispedro/diskhash
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
55 lines (41 loc) · 1.78 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
cmake_minimum_required(VERSION 3.4)
set(PROJECT_NAME diskhash-wrappers)
set(DEPLOY_NAME ${PROJECT_NAME})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 11)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules/)
message("CMake Module Path: " ${CMAKE_MODULE_PATH})
project(${PROJECT_NAME})
option(WITH_ASAN ON)
option(DISKHASH_TESTS ON)
include(setup)
include_directories(${CMAKE_SOURCE_DIR}/src)
add_library(diskhash STATIC src/os_wrappers.c src/diskhash.c)
if(DISKHASH_TESTS)
include_directories(${CMAKE_SOURCE_DIR}/unittests)
add_executable(cpp_wrapper_tests unittests/helper_functions.cpp
unittests/cpp_wrapper_tests.cpp)
target_link_libraries(cpp_wrapper_tests diskhash)
add_executable(cpp_slow_tests unittests/helper_functions.cpp
unittests/cpp_slow_tests.cpp)
target_link_libraries(cpp_slow_tests diskhash)
add_executable(diskhash_tests unittests/helper_functions.cpp
unittests/diskhash_tests.cpp)
target_link_libraries(diskhash_tests diskhash)
add_executable(os_wrappers_tests unittests/helper_functions.cpp
unittests/os_wrappers_tests.cpp)
target_link_libraries(os_wrappers_tests diskhash)
add_executable(disktest src/disktest.c)
target_link_libraries(disktest diskhash)
endif()
if(NOT MSVC)
option(WITH_ASAN "build with ASAN" OFF)
if(WITH_ASAN)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -g")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -g")
endif()