forked from linuxdeploy/linuxdeploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
61 lines (44 loc) · 1.79 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
include(FetchContent)
cmake_minimum_required(VERSION 3.2)
project(linuxdeploy C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules/")
find_program(PATCHELF patchelf REQUIRED)
# support for ccache
# call CMake with -DUSE_CCACHE=ON to make use of it
set(USE_CCACHE ON CACHE BOOL "")
if(USE_CCACHE)
find_program(CCACHE ccache)
if(CCACHE)
message(STATUS "Using ccache")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
else()
message(WARNING "USE_CCACHE set, but could not find ccache")
endif()
endif()
set(ENABLE_COVERAGE OFF CACHE BOOL "Enable coverage measurements")
if(ENABLE_COVERAGE)
include(CodeCoverage)
message(WARNING "Enabling code coverage measurements -> disables optimizations and embeds debug information!")
append_coverage_compiler_flags()
set(COVERAGE_GCOVR_EXCLUDES ${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR})
include(ProcessorCount)
ProcessorCount(processor_count)
set(command cmake --build . --target all -- -j ${processor_count} && ctest -V)
setup_target_for_coverage_gcovr_html(NAME coverage EXECUTABLE "${command}")
setup_target_for_coverage_gcovr_xml(NAME coverage_xml EXECUTABLE "${command}")
setup_target_for_coverage_gcovr_text(NAME coverage_text EXECUTABLE "${command}")
endif()
include(CTest)
if(BUILD_TESTING)
# including this before including lib/ makes sure that the top level project's gtest is used everywhere
include(${PROJECT_SOURCE_DIR}/lib/cmake-scripts/include-or-build-gtest.cmake)
endif()
add_subdirectory(lib)
add_subdirectory(src)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()