-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
72 lines (56 loc) · 1.9 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.28)
include(cmake/prelude.cmake)
file(READ "${CMAKE_CURRENT_LIST_DIR}/version.py" version_line)
string(
REGEX MATCH
"__version__ = \"(.*)\""
_
${version_line}
)
set(version ${CMAKE_MATCH_1})
project(
stronk
VERSION ${version}
DESCRIPTION "An easy to customize strong type library with built in support for unit-like behavior"
HOMEPAGE_URL "https://github.com/twig-energy/stronk"
LANGUAGES CXX
)
include(cmake/project-is-top-level.cmake)
include(cmake/variables.cmake)
include(cmake/dev-mode.cmake)
find_package(boost_type_index CONFIG REQUIRED)
# ---- Declare library ----
add_library(twig_stronk INTERFACE)
add_library(twig::stronk ALIAS twig_stronk)
set_property(TARGET twig_stronk PROPERTY EXPORT_NAME stronk)
target_include_directories(twig_stronk ${warning_guard} INTERFACE "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>")
target_compile_features(twig_stronk INTERFACE cxx_std_20)
target_link_libraries(twig_stronk INTERFACE Boost::type_index)
# ---- Install rules ----
if (NOT CMAKE_SKIP_INSTALL_RULES)
include(cmake/install-rules.cmake)
endif ()
if (PROJECT_IS_TOP_LEVEL)
option(BUILD_TESTING "Build tests tree." "${stronk_DEVELOPER_MODE}")
if (BUILD_TESTING)
add_subdirectory(tests)
endif ()
option(BUILD_EXAMPLES "Build examples tree." "${stronk_DEVELOPER_MODE}")
if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif ()
option(BUILD_BENCHMARKS "Build benchmarks tree." "${stronk_DEVELOPER_MODE}")
if (BUILD_BENCHMARKS)
add_subdirectory(benchmarks)
endif ()
endif ()
# ---- Developer mode ----
if (NOT stronk_DEVELOPER_MODE)
return()
elseif (NOT PROJECT_IS_TOP_LEVEL)
message(AUTHOR_WARNING "Developer mode is intended for developers of stronk")
endif ()
# ---- Code coverage ----
if (ENABLE_COVERAGE)
target_code_coverage(twig_stronk INTERFACE ALL)
endif ()