CMake: Build with -std:c++latest for MSVC

Making CMake match MSBuild in this aspect will hopefully
reduce how often we accidentally break the MSVC CMake build.
This commit is contained in:
JosJuice 2021-03-03 23:44:35 +01:00
parent 858f00b641
commit 1c3f594087

View File

@ -16,7 +16,13 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions(-D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
endif()
set(CMAKE_CXX_STANDARD 17)
if (MSVC)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest")
else()
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)