-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
39 lines (30 loc) · 1.05 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
cmake_minimum_required(VERSION 3.20)
project(CppCCQtemplate)
option(BUILD_UNIT_TESTS "Build unit tests (default OFF)" OFF)
option(CODE_COVERAGE "Enable coverage reporting (default OFF)" OFF)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(CMake/conan.cmake)
conan_cmake_run(REQUIRES
qt/6.2.1
libffi/3.4.2
BASIC_SETUP CMAKE_TARGETS
GENERATORS cmake_find_package cmake_paths
BUILD missing
OPTIONS qt:shared=True)
include(${CMAKE_BINARY_DIR}/conan_paths.cmake)
add_library(coverage_config INTERFACE)
if(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
# Add required flags (GCC & LLVM/Clang)
target_compile_options(coverage_config INTERFACE
-O0 # no optimization
-g # generate debug info
--coverage # sets all required flags
)
target_link_options(coverage_config INTERFACE --coverage)
endif(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
add_subdirectory(src)
if (BUILD_UNIT_TESTS)
enable_testing()
add_subdirectory(test)
endif()