forked from cpp-best-practices/cmake_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
66 lines (58 loc) · 2.08 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
cmake_minimum_required(VERSION 3.16)
# uncomment to set a default CXX standard for the external tools like clang-tidy and cppcheck
# and the targets that do not specify a standard.
# If not set, the latest supported standard for your compiler is used
# You can later set fine-grained standards for each target using `target_compile_features`
# set(CMAKE_CXX_STANDARD 17)
# Add project_options v0.13.1
# https://github.com/cpp-best-practices/project_options
include(FetchContent)
FetchContent_Declare(_project_options URL https://github.com/cpp-best-practices/project_options/archive/refs/tags/v0.13.1.zip)
FetchContent_MakeAvailable(_project_options)
include(${_project_options_SOURCE_DIR}/Index.cmake)
# uncomment to enable vcpkg:
# # Setup vcpkg - should be called before defining project()
# run_vcpkg()
# Set the project name and language
project(myproject LANGUAGES CXX)
# Initialize project_options variable related to this project
# This overwrites `project_options` and sets `project_warnings`
# uncomment the options to enable them:
project_options(
ENABLE_CACHE
# WARNINGS_AS_ERRORS
ENABLE_CPPCHECK
ENABLE_CLANG_TIDY
ENABLE_CONAN
ENABLE_COVERAGE
# ENABLE_IPO
# ENABLE_INCLUDE_WHAT_YOU_USE
# ENABLE_PCH
# PCH_HEADERS
# ENABLE_DOXYGEN
# ENABLE_USER_LINKER
# ENABLE_BUILD_WITH_TIME_TRACE
# ENABLE_UNITY
# ENABLE_SANITIZER_ADDRESS
# ENABLE_SANITIZER_LEAK
# ENABLE_SANITIZER_UNDEFINED_BEHAVIOR
# ENABLE_SANITIZER_THREAD
# ENABLE_SANITIZER_MEMORY
# CONAN_OPTIONS
)
target_compile_features(project_options INTERFACE cxx_std_17)
# Adding the src:
add_subdirectory(src)
# Adding the tests:
option(ENABLE_TESTING "Enable the tests" ON)
if(ENABLE_TESTING)
enable_testing()
message("Building Tests. Be sure to check out test/constexpr_tests for constexpr
testing")
add_subdirectory(test)
endif()
option(ENABLE_FUZZING "Enable the fuzz tests" OFF)
if(ENABLE_FUZZING)
message("Building Fuzz Tests, using fuzzing sanitizer https://www.llvm.org/docs/LibFuzzer.html")
add_subdirectory(fuzz_test)
endif()