-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
60 lines (51 loc) · 1.85 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
cmake_minimum_required (VERSION 3.12)
project (remi C CXX)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
enable_testing ()
option (ENABLE_TESTS "Build tests. May require CppUnit_ROOT" OFF)
option (ENABLE_EXAMPLES "Build examples" OFF)
option (ENABLE_BEDROCK "Build Bedrock module" ON)
option (ENABLE_COVERAGE "Enable coverage reporting" OFF)
add_library (coverage_config INTERFACE)
set (BUILD_SHARED_LIBS ON)
# add our cmake module directory to the path
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# link shared lib with full rpath
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# setup cache variables for ccmake
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release
CACHE STRING "Choose the type of build." FORCE)
set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "RelWithDebInfo" "MinSizeRel")
endif ()
# packages we depend on
find_package (thallium REQUIRED)
find_package (PkgConfig REQUIRED)
pkg_check_modules (abt-io REQUIRED IMPORTED_TARGET abt-io)
pkg_check_modules (uuid REQUIRED IMPORTED_TARGET uuid)
if (${ENABLE_BEDROCK})
find_package (bedrock-module-api REQUIRED)
endif ()
if (ENABLE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options (coverage_config INTERFACE
-O0 # no optimization
-g # generate debug info
--coverage # sets all required flags
)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
target_link_options (coverage_config INTERFACE --coverage)
else ()
target_link_libraries (coverage_config INTERFACE --coverage)
endif ()
endif ()
add_subdirectory (src)
if (${ENABLE_TESTS})
add_subdirectory (test)
endif (${ENABLE_TESTS})
if (${ENABLE_EXAMPLES})
add_subdirectory (examples)
endif (${ENABLE_EXAMPLES})