Skip to content

Commit 5c90334

Browse files
authored
Merge pull request #25 from bemanproject/24-restore-header-check-for-minimum-cxx-version
Make c++ version check be in the header instead of cmake.
2 parents e03170e + d9f3b46 commit 5c90334

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

CMakeLists.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,6 @@ cmake_minimum_required(VERSION 3.25)
44

55
project(beman.scope DESCRIPTION "Generic Scope Guard" LANGUAGES CXX)
66

7-
# Define an option for the C++ standard with a default of 20
8-
# tbd remove: option(CXX_STANDARD "C++ standard to use (minimum C++20)" 20)
9-
10-
# Ensure the specified standard is at least C++20
11-
if(CMAKE_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-
# tbd remove:set(CMAKE_CXX_STANDARD ${CXX_STANDARD})
17-
187
enable_testing()
198

209
# [CMAKE.SKIP_TESTS]

include/beman/scope/scope.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
#include <type_traits>
77
#include <utility>
88

9+
// clang-format off
10+
#if __cplusplus < 202002L
11+
#error "C++20 or later is required"
12+
#endif
13+
// clang-format on
14+
915
#include <experimental/scope>
1016

1117
namespace beman::scope {

0 commit comments

Comments
 (0)