-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
58 lines (47 loc) · 1.63 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.5)
project(Gross)
set(CMAKE_CXX_STANDARD 11)
include_directories(include)
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND
GROSS_ENABLE_INSTRUMENTS)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(STATUS "Add clang sanitizers...")
set(_GROSS_CLANG_SANITIZERS
-fsanitize=address -fsanitize=undefined)
add_compile_options(${_GROSS_CLANG_SANITIZERS})
link_libraries(${_GROSS_CLANG_SANITIZERS})
endif()
endif()
if(GROSS_ENABLE_UNIT_TESTS)
enable_testing()
add_subdirectory(third_party/googletest)
include_directories(third_party/googletest/googletest/include)
include(GoogleTest)
# Though there is add_compile_definitions in newer
# cmake, we use the legacy add_definitions for compatibility
add_definitions(-DGROSS_ENABLE_UNIT_TESTS)
endif()
# Boost
include_directories(third_party/boost/1.68.0/include)
# CLI option library
set(CXXOPTS_BUILD_EXAMPLES OFF CACHE BOOL "Build CXXOpts examples")
if(GROSS_ENABLE_UNIT_TESTS)
message(STATUS "Adding cxxopts tests...")
set(CXXOPTS_BUILD_TESTS ON CACHE BOOL "Build CXXOpts tests")
endif()
add_subdirectory(third_party/cxxopts)
add_subdirectory(src)
if(GROSS_ENABLE_UNIT_TESTS)
add_custom_target(check-units
COMMAND ${CMAKE_CTEST_COMMAND} -R ".*UnitTest\..*")
add_dependencies(check-units unittests)
add_custom_target(check-integrations
COMMAND ${CMAKE_CTEST_COMMAND} -R ".*IntegrateTest\..*")
add_dependencies(check-integrations integration_tests)
endif()
# Execute all the tests
add_custom_target(check-gross)
if(GROSS_ENABLE_UNIT_TESTS)
add_dependencies(check-gross
check-units check-integrations)
endif()