-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
57 lines (42 loc) · 1.7 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
cmake_minimum_required(VERSION 3.4)
project(exeptor)
#set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-truncation")
endif()
option(EXEPTOR_TESTS "Build exeptor tests" OFF)
option(EXEPTOR_COVERAGE "Build exeptor with coverage collection" OFF)
option(EXEPTOR_ASAN "Build exeptor with AddressSanitizer" OFF)
option(EXEPTOR_UBSAN "Build exeptor with UndefinedBehaviorSanitizer" OFF)
if (EXEPTOR_COVERAGE)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
message(NOTICE "Using LLVM-profdata coverage collecting mode")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
message(NOTICE "Using GCOV coverage collecting mode")
else()
message(FATAL_ERROR "Sorry, but exeptor's author doesn't know about other compilers than gcc and clang")
endif()
endif()
if (EXEPTOR_ASAN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()
if (EXEPTOR_UBSAN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
endif()
add_subdirectory(external/yaml-cpp yaml-cpp)
set_property(TARGET yaml-cpp PROPERTY POSITION_INDEPENDENT_CODE ON)
set(SRC_DIR "${PROJECT_SOURCE_DIR}/src")
add_executable(app-proxy ${SRC_DIR}/app-proxy.cpp)
add_library(exeptor SHARED
${SRC_DIR}/config.hpp
${SRC_DIR}/exeptor.cpp
)
target_link_libraries(exeptor PRIVATE dl PRIVATE yaml-cpp)
set_property(TARGET exeptor PROPERTY POSITION_INDEPENDENT_CODE ON)
if(EXEPTOR_TESTS)
add_subdirectory(test)
endif()