File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44# cmake-format: on
55
6- set(CMAKE_SKIP_TEST_ALL_DEPENDENCY FALSE)
7-
86cmake_minimum_required(VERSION 3.25...3.31)
97
108project(
@@ -19,6 +17,23 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
1917 message(FATAL_ERROR "In-source builds are not allowed!")
2018endif()
2119
20+ # Require C++20, but let a parent project ask for something higher
21+ if(DEFINED CMAKE_CXX_STANDARD)
22+ if(CMAKE_CXX_STANDARD EQUAL 98 OR CMAKE_CXX_STANDARD LESS 20)
23+ message(FATAL_ERROR "This project requires at least C++23")
24+ endif()
25+ else()
26+ set(CMAKE_CXX_STANDARD 23)
27+ endif()
28+
29+ # Always enforce the language constraint
30+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
31+
32+ # We don't need compiler extensions, but let a parent ask for them
33+ if(NOT DEFINED CMAKE_CXX_EXTENSIONS)
34+ set(CMAKE_CXX_EXTENSIONS OFF)
35+ endif()
36+
2237# [CMAKE.SKIP_EXAMPLES]
2338option(
2439 BEMAN_EXEMPLAR_BUILD_EXAMPLES
@@ -55,7 +70,6 @@ set_target_properties(
5570 beman.inplace_vector
5671 PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON
5772)
58- target_compile_features(beman.inplace_vector INTERFACE cxx_std_23)
5973
6074set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config)
6175set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets)
You can’t perform that action at this time.
0 commit comments