-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
31 lines (22 loc) · 1.15 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
cmake_minimum_required(VERSION 3.1)
project(sini LANGUAGES CXX)
option(${PROJECT_NAME}_ENABLE_TESTING "Enable Testing for ${PROJECT_NAME}" OFF)
add_subdirectory(ext)
find_package(Boost 1.67 REQUIRED)
file(GLOB_RECURSE ${PROJECT_NAME}_HEADERS "include/*.hpp")
add_library(${PROJECT_NAME} INTERFACE)
target_sources(${PROJECT_NAME} INTERFACE ${${PROJECT_NAME}_HEADERS})
target_include_directories(${PROJECT_NAME} INTERFACE include)
target_link_libraries(${PROJECT_NAME} INTERFACE Boost::boost)
if (${PROJECT_NAME}_ENABLE_TESTING)
file(GLOB_RECURSE ${PROJECT_NAME}_TEST_SOURCES "test/*.[ch]pp")
add_executable(${PROJECT_NAME}Test ${${PROJECT_NAME}_TEST_SOURCES})
set_target_properties(${PROJECT_NAME}Test PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED YES)
target_link_libraries(${PROJECT_NAME}Test ${PROJECT_NAME} gtest gtest_main)
target_compile_options(${PROJECT_NAME}Test PRIVATE -g -O0 --coverage)
set_target_properties(${PROJECT_NAME}Test PROPERTIES LINK_FLAGS "--coverage")
cmake_policy(SET CMP0057 NEW)
include(GoogleTest)
enable_testing()
gtest_add_tests(${PROJECT_NAME}Test "" ${${PROJECT_NAME}_TEST_SOURCES})
endif()