-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
72 lines (59 loc) · 2.07 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
68
69
70
71
72
cmake_minimum_required(VERSION 3.15)
# set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/extern/CMake-codecov/cmake" ${CMAKE_MODULE_PATH})
# set(CMAKE_CXX_COMPILER /usr/bin/x86_64-linux-gnu-g++-9)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fPIC" ) # -fpic --coverage
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
project( SomeProject
VERSION 1.0.0
DESCRIPTION "Code Coverage Sample Project!"
LANGUAGES CXX
)
# CLANG Tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Release MinSizeRel
set(CMAKE_BUILD_TYPE Debug)
# Disable in-source builds to prevent source tree corruption.
if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "
FATAL: In-source builds are not allowed.
You should create a separate directory for build files.
")
endif()
set(EXE_NAME
${PROJECT_NAME}
)
set(LIB_NAME
${PROJECT_NAME}_lib
)
set(TEST_EXE_NAME
${PROJECT_NAME}_test
)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(include_directories)
include(local)
include(test)
if(CMAKE_COMPILER_IS_GNUCXX)
include(CodeCoverage)
append_coverage_compiler_flags()
#set(COVERAGE_EXCLUDES
# 'test/*'
# 'extern/*'
# )
#set(COVERAGE_LCOV_EXCLUDES
#"/usr/include/*"
#"/usr/include/c++/*"
#"/usr/include/x86_64-linux-gnu/c++/7/bits/*"
#)
# SETUP_TARGET_FOR_COVERAGE_LCOV(NAME coverage
# EXECUTABLE ${TEST_EXE_NAME}
# )
setup_target_for_coverage_gcovr_xml(NAME coverage
EXECUTABLE ${TEST_EXE_NAME}
)
endif()
# clang tidy task
add_custom_target(clangtidy
# COMMAND clang-tidy -checks='*' -p ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/src/*.cpp ${PROJECT_SOURCE_DIR}/include/**/*.hpp > clang-tidy-report.txt
COMMAND clang-tidy -checks='*' -header-filter="^include" -p . ${PROJECT_SOURCE_DIR}/src/*.cpp ${PROJECT_SOURCE_DIR}/include/application/*.hpp > clang-tidy-report.txt
)
# 66e4e6072b0763410f7aaa09550dc174a03fd45f