-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
67 lines (51 loc) · 1.82 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
61
62
63
64
65
66
67
cmake_minimum_required(VERSION 3.4)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(BUILD_COVERAGE "Build coverage" OFF)
set(
HUNTER_CACHE_SERVERS
"https://github.com/bmstu-iu8-cpp-sem-3/hunter-cache"
CACHE STRING "Default cache server"
)
include("tools/gate/cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.23.34.tar.gz"
SHA1 "70287b1ffa810ee4e952052a9adff9b4856d0d54"
)
project(lab-04-boost-filesystem)
string(APPEND CMAKE_CXX_FLAGS " -pedantic -Werror -Wall -Wextra")
string(APPEND CMAKE_CXX_FLAGS " -Wno-unused-command-line-argument")
string(APPEND CMAKE_CXX_FLAGS " -Wshadow -Wnon-virtual-dtor")
hunter_add_package(GTest)
find_package(GTest CONFIG REQUIRED)
hunter_add_package(Boost COMPONENTS system filesystem)
# Boost
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME ON)
FIND_PACKAGE(Boost REQUIRED COMPONENTS system filesystem)
include_directories(${Boost_INCLUDE_DIRS})
add_library(lab-04-boost-filesystem STATIC ${CMAKE_CURRENT_SOURCE_DIR}/sources/source.cpp)
set(SOURCES
sources/source.cpp
)
set(HEADERS
include/header.hpp
)
add_executable(tests tests/test.cpp ${SOURCES} ${HEADERS})
target_include_directories(lab-04-boost-filesystem
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(tests
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(tests GTest::main Boost::system Boost::filesystem ${Boost_LIBRARIES})
enable_testing()
add_test(NAME unit_tests COMMAND tests)
if(BUILD_COVERAGE)
set(ENABLE_COVERAGE ON CACHE BOOL "Enable coverage build." FORCE)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(codecov)
add_coverage(lab-04-boost-filesystem)
add_coverage(tests)
list(APPEND LCOV_REMOVE_PATTERNS "'${PROJECT_SOURCE_DIR}/tests/*'")
coverage_evaluate()
endif()