-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
45 lines (36 loc) · 1.56 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
cmake_minimum_required(VERSION 3.5)
include("cmake/HunterGate.cmake")
HunterGate(URL "https://github.com/cpp-pm/hunter/archive/v0.23.220.tar.gz" SHA1 "c2296fdc5ad3b1085a2ea985600f36d5a1351b93")
project("p4ls")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(UNITTESTS_ENABLED "Build all unit tests." ON)
option(COVERAGE_ENABLED "Enable coverage reporting" OFF)
if (HUNTER_ENABLED)
hunter_add_package(Boost COMPONENTS date_time filesystem iostreams log regex system thread wave)
hunter_add_package(RapidJSON)
find_package(Boost CONFIG REQUIRED COMPONENTS date_time filesystem iostreams log regex system thread wave)
find_package(RapidJSON CONFIG REQUIRED)
else()
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED COMPONENTS date_time filesystem iostreams log regex system thread wave)
find_package(RapidJSON CONFIG REQUIRED)
add_library(RapidJSON::rapidjson INTERFACE IMPORTED)
set_target_properties(RapidJSON::rapidjson PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${RAPIDJSON_INCLUDE_DIRS}")
endif()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
add_library(coverage_config INTERFACE)
if (COVERAGE_ENABLED)
target_compile_options(coverage_config INTERFACE -O0 -g --coverage)
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(COVERAGE_ENABLED)
add_subdirectory(server)
if (UNITTESTS_ENABLED)
add_subdirectory(test)
include(CTest)
endif()