-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
87 lines (67 loc) · 2.18 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(ProxyCapsicum VERSION 0.0.1 DESCRIPTION "Capsicum Proxy")
set(CMAKE_BUILD_TYPE DEBUG)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
include(InstallRequiredSystemLibraries)
include(GNUInstallDirs)
include(CTest)
find_package(Git)
find_package(Threads)
find_program(MAKE_EXE NAMES make)
find_program(GIT_EXE NAMES git)
option(UseCapsicum "Enable use of capability mode in FreeBSD" ON)
if(UseCapsicum)
add_definitions(-DProxy_CapabilityMode)
endif()
if(${PROJECT_NAME}_ENABLE_DEBUG)
message(WARNING "Debug messages are enabled.")
add_definitions(-DPROXY_DEBUG)
endif()
enable_testing()
add_compile_options(
-Wall -Wpedantic -fexceptions
"$<$<CONFIG:Debug>:-O0;-g3;-ggdb>"
"$<$<CONFIG:Release>:-O2>"
)
if(GIT_FOUND AND NOT EXISTS "${CMAKE_SOURCE_DIR}/.git")
message(WARNING "Configre Git!")
elseif(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-list --max-count=1 HEAD
OUTPUT_VARIABLE GIT_REVISION
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
ERROR_QUIET
)
if(NOT ${GIT_REVISION} STREQUAL "")
string(STRIP ${GIT_REVISION} GIT_REVISION)
endif()
endif()
add_compile_definitions(
FORTIFY_SOURCE=2
"$<$<CONFIG:Debug>:MALLOC_CHECK_=3;_GLIBCXX_DEBUG>"
)
set(GSL_SOURCE_DIR "${CMAKE_BINARY_DIR}/gsl-src")
include_directories(${GSL_SOURCE_DIR}/include)
include_directories(/usr/local/include include)
link_directories(/usr/local/lib)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/deps")
include(Opts)
include(Deps)
add_executable(${PROJECT_NAME}_test
${PROJECT_SOURCE_DIR}/tests/tests.cpp
${PROJECT_SOURCE_DIR}/include/proxy.hpp
)
target_link_libraries(${PROJECT_NAME}_test
gtest_main
dl
rt
)
add_library(dso_dep SHARED
${PROJECT_SOURCE_DIR}/tests/libdep.cpp)
add_library(dso_test SHARED
${PROJECT_SOURCE_DIR}/tests/libtest.cpp)
target_link_libraries(dso_test dso_dep)
add_test(ProxyTest ${PROJECT_NAME}_test)
include(CPack)