`CXX_EXTENSIONS OFF` does not turn off extensions in GCC 11
Using CMake 3.20.2; this has been described here: https://stackoverflow.com/questions/67641124/gcc-11-how-to-tell-cmake-i-dont-want-the-default-c-gnu-extensions
GCC 11's default ISO C++ standard is C++17, so that when I declare target_compile_features(mytarget cxx_std_17)
CMake (correctly) does not generate any -std
flag. However, GCC's default is actually -std=gnu++17
, and if I want -std=c++17
I should be able to declare set_target_properties(mytarget PROPERTIES CXX_EXTENSIONS OFF)
. Unfortunately, this has no effect, and CMake still omits the -std
flag.