Skip to content

Commit 5eb317d

Browse files
committed
Make c++ version check be in the header instead of cmake.
1 parent e03170e commit 5eb317d

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
#include <type_traits>
77
#include <utility>
88

9+
#if __cplusplus < 202002L
10+
#error "C++20 or later is required"
11+
#endif
12+
913
#include <experimental/scope>
1014

1115
namespace beman::scope {

0 commit comments

Comments
 (0)