|
1 | 1 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
2 | 2 |
|
3 | | -if(CMAKE_CXX_STANDARD STREQUAL 26) |
| 3 | +if(CMAKE_CXX_STANDARD GREATER_EQUAL 23) |
4 | 4 | if(CMAKE_CXX_MODULE_STD) |
5 | 5 | set(CMAKE_CXX_SCAN_FOR_MODULES 1) |
| 6 | + # for cmake version 4.0.2 |
6 | 7 | set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD |
7 | | - "d0edc3af-4c50-42ea-a356-e2862fe7a444" |
| 8 | + "a9e1cf81-9932-4810-974b-6eccaf14e457" |
8 | 9 | ) |
9 | 10 | add_definitions(-DHAS_STDLIB_MODULES) |
10 | 11 | endif() |
11 | 12 | set(CMAKE_CXX_STANDARD_REQUIRED OFF) |
12 | 13 | endif() |
13 | 14 |
|
14 | | -cmake_minimum_required(VERSION 3.28...4.0) |
| 15 | +cmake_minimum_required(VERSION 4.0) |
15 | 16 |
|
16 | 17 | project( |
17 | 18 | beman.scope |
@@ -43,6 +44,7 @@ endif() |
43 | 44 |
|
44 | 45 | include(CMakePrintHelpers) |
45 | 46 | cmake_print_variables( |
| 47 | + CMAKE_CXX_STANDARD |
46 | 48 | CMAKE_CXX_SCAN_FOR_MODULES |
47 | 49 | CMAKE_CXX_MODULE_STD |
48 | 50 | CMAKE_CXX_COMPILER_IMPORT_STD |
@@ -84,6 +86,7 @@ if(CMAKE_CXX_SCAN_FOR_MODULES) |
84 | 86 | BASE_DIRS include |
85 | 87 | FILES include/beman/scope/beman.scope.cppm |
86 | 88 | ) |
| 89 | + target_compile_features(beman.scope PUBLIC cxx_std_23) |
87 | 90 | else() |
88 | 91 | add_library(beman.scope INTERFACE) |
89 | 92 | target_sources( |
|
93 | 96 | BASE_DIRS include |
94 | 97 | FILES include/beman/scope/scope.hpp |
95 | 98 | ) |
| 99 | + # prevent "not include "cxx_std_20" (or newer) among its `target_compile_features`; no C++ standard found" |
| 100 | + target_compile_features(beman.scope PUBLIC cxx_std_20) |
96 | 101 | endif() |
97 | 102 |
|
98 | 103 | add_library(beman::scope ALIAS beman.scope) |
|
0 commit comments