1
1
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2
- if (NOT DEFINED CMAKE_CXX_STANDARD )
3
- set (CMAKE_CXX_STANDARD 20 )
4
- endif ()
5
2
6
- # TODO(CK): set(CMAKE_CXX_MODULE_STD 1)
7
- if (CMAKE_CXX_MODULE_STD )
8
- set (CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
9
- "d0edc3af-4c50-42ea-a356-e2862fe7a444"
10
- )
11
- set (CMAKE_CXX_STANDARD 26 )
3
+ if (CMAKE_CXX_STANDARD STREQUAL 26 )
4
+ set (CMAKE_CXX_SCAN_FOR_MODULES 1 )
5
+ set (CMAKE_CXX_MODULE_STD 1 )
6
+ if (CMAKE_CXX_MODULE_STD )
7
+ set (CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
8
+ "d0edc3af-4c50-42ea-a356-e2862fe7a444"
9
+ )
10
+ endif ()
11
+ set (CMAKE_CXX_STANDARD_REQUIRED OFF )
12
12
endif ()
13
- set (CMAKE_CXX_STANDARD_REQUIRED OFF )
14
- set (CMAKE_CXX_SCAN_FOR_MODULES 1 )
15
13
16
14
cmake_minimum_required (VERSION 3.28...4.0 )
17
15
@@ -44,9 +42,8 @@ option(
44
42
${PROJECT_IS_TOP_LEVEL}
45
43
)
46
44
47
- add_library (beman.scope )
45
+ add_library (beman.scope INTERFACE )
48
46
add_library (beman::scope ALIAS beman.scope )
49
- target_compile_features (beman.scope PRIVATE cxx_std_20 )
50
47
51
48
# gersemi: off
52
49
@@ -57,17 +54,29 @@ set_target_properties(
57
54
EXPORT_NAME scope
58
55
)
59
56
60
- target_sources (
61
- beman.scope
62
- PUBLIC
63
- FILE_SET HEADERS
64
- BASE_DIRS include
65
- FILES include /beman/scope/scope.hpp
66
- PUBLIC
67
- FILE_SET CXX_MODULES
68
- BASE_DIRS include
69
- FILES include /beman/scope/beman.scope.cppm
70
- )
57
+ if (CMAKE_CXX_SCAN_FOR_MODULES )
58
+ target_compile_features (beman.scope PRIVATE cxx_std_23 )
59
+ target_sources (
60
+ beman.scope
61
+ PUBLIC
62
+ FILE_SET HEADERS
63
+ BASE_DIRS include
64
+ FILES include /beman/scope/scope.hpp
65
+ PUBLIC
66
+ FILE_SET CXX_MODULES
67
+ BASE_DIRS include
68
+ FILES include /beman/scope/beman.scope.cppm
69
+ )
70
+ else ()
71
+ target_compile_features (beman.scope INTERFACE cxx_std_20 )
72
+ target_sources (
73
+ beman.scope
74
+ INTERFACE
75
+ FILE_SET HEADERS
76
+ BASE_DIRS include
77
+ FILES include /beman/scope/scope.hpp
78
+ )
79
+ endif ()
71
80
72
81
include (GNUInstallDirs )
73
82
@@ -77,7 +86,6 @@ install(
77
86
EXPORT beman.scope-targets
78
87
79
88
FILE_SET CXX_MODULES
80
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
81
89
FILE_SET HEADERS
82
90
)
83
91
0 commit comments