Skip to content

Commit

Permalink
Add a deprecation warning when building with C++17 (#700)
Browse files Browse the repository at this point in the history
* Add a deprecation warning when building with C++17

* Specify a version when support for C++17 will be removed

* Set the default to C++20

---------

Co-authored-by: jmcarcell <[email protected]>
  • Loading branch information
jmcarcell and jmcarcell authored Nov 8, 2024
1 parent 706035f commit b5cddb7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ endif()

# Set up C++ Standard
# ``-DCMAKE_CXX_STANDARD=<standard>`` when invoking CMake
set(CMAKE_CXX_STANDARD 17 CACHE STRING "")
set(CMAKE_CXX_STANDARD 20 CACHE STRING "")

if(NOT CMAKE_CXX_STANDARD MATCHES "17|20")
message(FATAL_ERROR "Unsupported C++ standard: ${CMAKE_CXX_STANDARD}")
endif()

if(CMAKE_CXX_STANDARD EQUAL 17)
message(WARNING "C++17 is deprecated and support for it will be removed in v01-03. Please use at least C++20.")
endif()

# Prevent CMake falls back to the latest standard the compiler does support
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand Down

0 comments on commit b5cddb7

Please sign in to comment.