Don't set CMAKE_CXX_STANDARD to 11 by default

Use the compiler default C++ dialect if it is C++11 or higher and only
explicitly request C++11 if the compiler can't compile a small test
using C++11 features by default.

This prevents from unnecessarily adding -std=c++11 to the compiler flags
under Unix, even with compilers using e.g. C++17 by default.
This commit is contained in:
Vadim Zeitlin 2024-01-04 03:30:00 +01:00
parent 5faa70503a
commit 3b06ab65ff
3 changed files with 19 additions and 5 deletions

View file

@ -46,8 +46,6 @@ endif()
# support setting the C++ standard, present it an option to the user
if(DEFINED CMAKE_CXX_STANDARD)
set(wxCXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD})
elseif(APPLE)
set(wxCXX_STANDARD_DEFAULT 11)
else()
set(wxCXX_STANDARD_DEFAULT COMPILER_DEFAULT)
endif()