-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
71 lines (56 loc) · 1.85 KB
/
Copy pathCMakeLists.txt
File metadata and controls
71 lines (56 loc) · 1.85 KB
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
cmake_minimum_required(VERSION 3.8.2 FATAL_ERROR)
project(boost_matheval CXX)
include(GNUInstallDirs)
# Default build type is Debug
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the build type" FORCE)
endif()
# Add local package finders
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Build options
option(WITH_COVERAGE "Generate code coverage report" OFF)
if(WITH_COVERAGE)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
link_libraries(gcov)
else()
message(WARNING "Coverage information only supported on GCC")
endif()
endif()
option(WITH_CLANG_TIDY "Run Clang-Tidy during compilation" OFF)
# Find clang-tidy executable (no matter if building with gcc or clang)
string(REGEX REPLACE "^([1-9]+\\.[0-9]+).*$" "\\1" CLANG_MINOR_VERSION "${CMAKE_CXX_COMPILER_VERSION}")
find_program(
CLANG_TIDY_EXE
NAMES "clang-tidy-${CLANG_MINOR_VERSION}" "clang-tidy"
DOC "Path to clang-tidy executable"
)
if(WITH_CLANG_TIDY)
if(NOT CLANG_TIDY_EXE)
message(FATAL_ERROR "clang-tidy was enabled but no executable found.")
else()
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}"
"-checks=-*,bugprone-*,cert-*,clang-analyzer-*,cppcoreguidelines-*,hicpp-*,misc-*,modernize-*,performance-*,readability-*"
"-header-filter=.*"
"-warnings-as-errors=*"
)
endif()
endif()
# Subdirectories
add_subdirectory(src/qi)
add_subdirectory(src/x3)
add_subdirectory(doc/doxygen)
add_subdirectory(examples)
add_subdirectory(tests)
# Install
install(
DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.hpp"
)
install(
EXPORT ${PROJECT_NAME}
NAMESPACE matheval::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/
)