-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
90 lines (75 loc) · 2.4 KB
/
CMakeLists.txt
File metadata and controls
90 lines (75 loc) · 2.4 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
cmake_minimum_required(VERSION 3.30...4.3)
include(infra/cmake/enable-experimental-import-std.cmake)
project(
beman.exemplar
DESCRIPTION "A Beman Library Exemplar"
LANGUAGES CXX
VERSION 2.4.0
)
# [CMAKE.SKIP_TESTS]
option(
BEMAN_EXEMPLAR_BUILD_TESTS
"Enable building tests and test infrastructure. Default: ${PROJECT_IS_TOP_LEVEL}. Values: { ON, OFF }."
${PROJECT_IS_TOP_LEVEL}
)
# [CMAKE.SKIP_EXAMPLES]
option(
BEMAN_EXEMPLAR_BUILD_EXAMPLES
"Enable building examples. Default: ${PROJECT_IS_TOP_LEVEL}. Values: { ON, OFF }."
${PROJECT_IS_TOP_LEVEL}
)
option(BEMAN_EXEMPLAR_USE_MODULES "Provide beman.exemplar as a C++ module" OFF)
if(BEMAN_EXEMPLAR_USE_MODULES)
set(CMAKE_CXX_SCAN_FOR_MODULES ON)
endif()
configure_file(
"${PROJECT_SOURCE_DIR}/include/beman/exemplar/config_generated.hpp.in"
"${PROJECT_BINARY_DIR}/include/beman/exemplar/config_generated.hpp"
@ONLY
)
# for find of beman_install_library and configure_build_telemetry
include(infra/cmake/beman-install-library.cmake)
include(infra/cmake/BuildTelemetryConfig.cmake)
if(BEMAN_EXEMPLAR_USE_MODULES)
add_library(beman.exemplar STATIC)
else()
add_library(beman.exemplar INTERFACE)
endif()
add_library(beman::exemplar ALIAS beman.exemplar)
if(BEMAN_EXEMPLAR_USE_MODULES)
target_sources(
beman.exemplar
PUBLIC
FILE_SET CXX_MODULES
FILE_SET HEADERS
BASE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_BINARY_DIR}/include"
)
set_target_properties(beman.exemplar PROPERTIES CXX_MODULE_STD ON)
target_compile_features(beman.exemplar PUBLIC cxx_std_23)
else()
target_sources(
beman.exemplar
PUBLIC
FILE_SET HEADERS
BASE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_BINARY_DIR}/include"
)
set_target_properties(
beman.exemplar
PROPERTIES VERIFY_INTERFACE_HEADER_SETS ${PROJECT_IS_TOP_LEVEL}
)
endif()
add_subdirectory(include/beman/exemplar)
beman_install_library(beman.exemplar TARGETS beman.exemplar)
configure_build_telemetry()
if(BEMAN_EXEMPLAR_BUILD_TESTS)
enable_testing()
add_subdirectory(tests/beman/exemplar)
endif()
if(BEMAN_EXEMPLAR_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()