-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
91 lines (72 loc) · 2.03 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
86
87
88
89
90
91
cmake_minimum_required(VERSION 3.14)
include(cmake/in-source-guard.cmake)
set(CPP_ENUM_SET_VERSION 0.1.0 )
project(
enum_set
VERSION ${CPP_ENUM_SET_VERSION}
DESCRIPTION "A library of type safe sets over fixed size collections of types or values, including methods for accessing, modifying, visiting and iterating over those."
HOMEPAGE_URL "https://github.com/cdeln/cpp_enum_set"
LANGUAGES CXX
)
include(cmake/project-is-top-level.cmake)
include(cmake/variables.cmake)
# ---- Declare library ----
add_library(enum_set_enum_set INTERFACE)
add_library(enum_set::enum_set ALIAS enum_set_enum_set)
set_property(
TARGET enum_set_enum_set PROPERTY
EXPORT_NAME enum_set
)
target_include_directories(
enum_set_enum_set
${enum_set_warning_guard}
INTERFACE
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>"
)
# The following properties are only applied during build time
# For details, check the config file
set(std cxx_std_14)
if(enum_set_USE_MAGIC_ENUM)
set(std cxx_std_17)
find_package(magic_enum REQUIRED)
target_link_libraries(
enum_set_enum_set
INTERFACE
"$<BUILD_INTERFACE:magic_enum::magic_enum>"
)
endif()
target_compile_features(
enum_set_enum_set
INTERFACE
"$<BUILD_INTERFACE:${std}>"
)
# ---- Install rules ----
include(cmake/install-rules.cmake)
# ---- Examples ----
if(PROJECT_IS_TOP_LEVEL)
option(BUILD_EXAMPLES "Build examples tree." "${enum_set_DEVELOPER_MODE}")
if(BUILD_EXAMPLES)
add_subdirectory(example)
endif()
endif()
# ---- Developer mode ----
if(NOT enum_set_DEVELOPER_MODE)
return()
elseif(NOT PROJECT_IS_TOP_LEVEL)
message(
AUTHOR_WARNING
"Developer mode is intended for developers of enum_set"
)
endif()
include(CTest)
if(BUILD_TESTING)
add_subdirectory(test)
endif()
option(ENABLE_COVERAGE "Enable coverage support separate from CTest's" OFF)
if(ENABLE_COVERAGE)
include(cmake/coverage.cmake)
endif()
option(BUILD_DOCUMENTATION "Build documentation using Doxygen and m.css" OFF)
if(BUILD_DOCUMENTATION)
include(cmake/docs.cmake)
endif()