On Sun, 31 Dec 2023 09:38:19 -0800 john wrote:
j> > MB> Probably keep CMAKE_CXX_STANDARD_REQUIRED. If I understand correctly, it
j> > MB> ensures the compiler will use the version, if specified.
j> >
j> > I couldn't find what exactly this does, i.e. how does it "require" it and
j> > whether it happens immediately, when this is executed (I suspect not?) or
j> > later (but when?). I'll try to experiment more with this, but if anybody
j> > already knows the answer, please let me know.
j>
j> It does nothing if CMAKE_CXX_STANDARD isn't set. If it is set and
j> CMAKE_CXX_STANDARD_REQUIRED is true (in the cmake meaning of true) then
j> configuration will fail if the compiler doesn't support the standard
j> called for by CMAKE_CXX_STANDARD. See
j>
https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD_REQUIRED.html#prop_tgt:CXX_STANDARD_REQUIRED.
Thanks, I guess we should have our own small test checking for C++11
support then. It could be pretty simple, as we can just check for MSVS >=
2015 or any compiler defining __cplusplus as >= 201103L.
j> Cmake provides this via target_compile_features, see
j>
https://cmake.org/cmake/help/latest/manual/cmake-compile-features.7.html#id6.
j> AFAICT there's no way to set it globally, but you could set a variable
j> to the desired standard and pass that to target_compile_features for
j> every target.
This seems more complicated than a simple C++11 test, so I don't think we
should do this, but it's good to know, thanks.
j> A caution about all of this: There is exactly one backwards
j> compatibility issue in C++: auto_ptr.
wx doesn't use std::auto_ptr<>, it had its own wxScopedPtr<> before and
then switched to std::unique_ptr<>. There are other things
deprecated/removed in C++17/C++20 but I can/know how to deal with them,
it's just CMake that I'm uncomfortable with. But I'll try to get better
next year...
Regards,
VZ