-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
74 lines (61 loc) · 2.22 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
# CMakelists for the root directory
#
# This cmake file is partially based on https://github.com/foonathan/type_safe,
# which is MIT licensed. I am uncertain what that means to the licensing
# of this file. To the largest extent possible in this situation, my changes are
# dual licensed under Boost 1.0 license or GPLv2 (or later, at your option).
#
# By Paul Dreik 20180923
cmake_minimum_required(VERSION 3.10)
project(libchronoconv VERSION 0.0.0 LANGUAGES CXX)
set(detail_header_files
${CMAKE_CURRENT_SOURCE_DIR}/include/safe_duration_cast/detail/chronoconv_detail.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/safe_duration_cast/detail/lossless_conversion.hpp
)
set(header_files
${CMAKE_CURRENT_SOURCE_DIR}/include/safe_duration_cast/chronoconv.hpp
)
set(target_name chronoconv)
add_library(${target_name} INTERFACE)
#target_compile_features(${target_name} INTERFACE cxx_std_11)
target_sources(${target_name} INTERFACE ${detail_header_files} ${header_files})
target_include_directories(${target_name} INTERFACE include/)
target_include_directories(${target_name} SYSTEM INTERFACE include/)
target_compile_definitions(${target_name} INTERFACE)
#for installation
install(FILES ${header_files} DESTINATION include/safe_duration_cast/)
install(FILES ${detail_header_files} DESTINATION include/safe_duration_cast/detail)
if (MSVC)
# warning level 4 and all warnings as errors
add_compile_options(/W4 /WX)
else()
# lots of warnings
add_compile_options(-Wall -Wextra -pedantic -Wno-unused-parameter -Wno-unused-variable)
endif()
#unit tests
option(BUILD_UNITTESTS "enables the unit tests" Off)
if(BUILD_UNITTESTS)
enable_testing()
add_subdirectory(tests/)
endif()
option(BUILD_EXHAUSTIVE_TESTS "enables the exhaustive tests" Off)
if(BUILD_EXHAUSTIVE_TESTS)
enable_testing()
add_subdirectory(exhaustivetests/)
endif()
#speed tests
option(BUILD_SPEED_TESTS "enables the speed tests" Off)
if(BUILD_SPEED_TESTS)
enable_testing()
add_subdirectory(speedtest/)
endif()
#examples
option(BUILD_EXAMPLES "enables building the examples" Off)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
#fuzzing
option(BUILD_FUZZERS "enables building the fuzzers" Off)
if(BUILD_FUZZERS)
add_subdirectory(fuzzing)
endif()