CMake: Add c++20 option, enable setting c++ version for MSVC

MSVC supports setting the CMAKE_CXX_STANDARD since VS2015 update 2.
This commit is contained in:
Maarten Bent
2020-04-07 18:24:37 +02:00
parent 3c4c4ee273
commit 4122511e76

View File

@@ -36,15 +36,17 @@ endif()
if(MSVC) if(MSVC)
wx_option(wxBUILD_MSVC_MULTIPROC "Enable multi-processor compilation for MSVC") wx_option(wxBUILD_MSVC_MULTIPROC "Enable multi-processor compilation for MSVC")
else() endif()
# Other compilers support setting the C++ standard, present it an option to the user
if(NOT MSVC OR MSVC_VERSION GREATER 1800)
# support setting the C++ standard, present it an option to the user
if(DEFINED CMAKE_CXX_STANDARD) if(DEFINED CMAKE_CXX_STANDARD)
set(wxCXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD}) set(wxCXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD})
else() else()
set(wxCXX_STANDARD_DEFAULT COMPILER_DEFAULT) set(wxCXX_STANDARD_DEFAULT COMPILER_DEFAULT)
endif() endif()
wx_option(wxBUILD_CXX_STANDARD "C++ standard used to build wxWidgets targets" wx_option(wxBUILD_CXX_STANDARD "C++ standard used to build wxWidgets targets"
${wxCXX_STANDARD_DEFAULT} STRINGS COMPILER_DEFAULT 98 11 14 17) ${wxCXX_STANDARD_DEFAULT} STRINGS COMPILER_DEFAULT 98 11 14 17 20)
endif() endif()
if(WIN32) if(WIN32)