forked from EVerest/libtimer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
85 lines (71 loc) · 2.26 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
73
74
75
76
77
78
79
80
81
82
83
84
85
cmake_minimum_required(VERSION 3.11)
project(everest-timer
VERSION 0.1
DESCRIPTION "EVerest timer library"
LANGUAGES CXX C
)
find_package(everest-cmake 0.1 REQUIRED
PATHS ../everest-cmake
)
# options
option(BUILD_EXAMPLES "Build examples" OFF)
option(TIMER_INSTALL "Install the library (shared data might be installed anyway)" ${EVC_MAIN_PROJECT})
option(CMAKE_RUN_CLANG_TIDY "Run clang-tidy" OFF)
# dependencies
find_package(Boost COMPONENTS system REQUIRED)
if (NOT DISABLE_EDM)
evc_setup_edm()
# In EDM mode, we can't install exports (because the dependencies usually do not install their exports)
set(TIMER_INSTALL OFF)
else()
find_package(date REQUIRED)
endif()
# logging library
add_subdirectory(lib)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
# packaging
if (TIMER_INSTALL)
install(
TARGETS timer
EXPORT timer-targets
)
install(
DIRECTORY include/
TYPE INCLUDE
)
evc_setup_package(
NAME everest-timer
EXPORT timer-targets
NAMESPACE everest
ADDITIONAL_CONTENT
"find_dependency(Boost COMPONENTS system)"
)
endif()
# build doxygen documentation if doxygen is available
find_package(Doxygen)
if(DOXYGEN_FOUND)
set( DOXYGEN_OUTPUT_DIRECTORY dist/docs )
doxygen_add_docs(doxygen-${PROJECT_NAME} include lib src)
else()
message("Doxygen is needed to generate documentation")
endif()
# configure clang-tidy if requested
if(CMAKE_RUN_CLANG_TIDY)
message("Running clang-tidy")
string(CONCAT CLANG_TIDY_CHECKS "*,"
"-llvmlibc*,"
"-fuchsia-default-arguments-calls,"
"-fuchsia-overloaded-operator,"
"-fuchsia-statically-constructed-objects,"
"-readability-function-cognitive-complexity,"
"-modernize-use-trailing-return-type,"
"-abseil-string-find-startswith,"
"-abseil-string-find-str-contains,"
";")
set(CMAKE_CXX_CLANG_TIDY
clang-tidy;
-header-filter='.*'
-checks=${CLANG_TIDY_CHECKS})
endif()