File tree Expand file tree Collapse file tree 4 files changed +17
-9
lines changed
Expand file tree Collapse file tree 4 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 22
33cmake_minimum_required (VERSION 3.25)
44
5- project (beman.scope DESCRIPTION "Generic Scope Guard" LANGUAGES CXX
5+ project (beman.scope DESCRIPTION "Generic Scope Guard" LANGUAGES CXX)
6+
7+ # Define an option for the C++ standard with a default of 20
8+ option (CXX_STANDARD "C++ standard to use (minimum C++20)" 20)
9+
10+ # Ensure the specified standard is at least C++20
11+ if (CXX_STANDARD LESS 20)
12+ message (FATAL_ERROR "The minimum required C++ standard is C++20" )
13+ endif ()
14+
15+ # Set the C++ standard based on the user input
16+ set (CMAKE_CXX_STANDARD ${CXX_STANDARD} )
17+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
18+ set (CMAKE_CXX_EXTENSIONS OFF )
619
720enable_testing ()
821
Original file line number Diff line number Diff line change 77 "generator" : " Ninja" ,
88 "binaryDir" : " ${sourceDir}/build/${presetName}" ,
99 "cacheVariables" : {
10- "CMAKE_CXX_STANDARD " : " 20"
10+ "CXX_STANDARD " : " 20"
1111 }
1212 },
1313 {
Original file line number Diff line number Diff line change 11# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
22
3- set (CMAKE_CXX_STANDARD 20) # Set the C++ standard to C++20
4- set (CMAKE_CXX_STANDARD_REQUIRED ON ) # Ensure the standard is required
5- set (CMAKE_CXX_EXTENSIONS OFF ) # Disable compiler-specific extensions
6-
73set (ALL_EXAMPLES scope_example)
84
95message ("Examples to be built: ${ALL_EXAMPLES} " )
@@ -13,3 +9,4 @@ foreach(example ${ALL_EXAMPLES})
139 target_sources (beman.scope.examples.${example} PRIVATE ${example} .cpp)
1410 target_link_libraries (beman.scope.examples.${example} beman::scope)
1511endforeach ()
12+
Original file line number Diff line number Diff line change 11# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
22
3- set (CMAKE_CXX_STANDARD 20) # Set the C++ standard to C++20
4- set (CMAKE_CXX_STANDARD_REQUIRED ON ) # Ensure the standard is required
5- set (CMAKE_CXX_EXTENSIONS OFF ) # Disable compiler-specific extensions
63
74add_executable (beman.scope.tests.scope)
85target_sources (beman.scope.tests.scope PRIVATE scope.test .cpp)
96
107target_link_libraries (beman.scope.tests.scope PRIVATE beman::scope)
118
129add_test (NAME beman.scope.tests.scope COMMAND beman.scope.tests.scope)
10+
You can’t perform that action at this time.
0 commit comments