Skip to content

Configuration not failing when compiler only supports language standards _later_ than user asked for - fail

Motivation: I maintain a C++11 library with some example programs, most of which are compiled with C++11; and I tell CMake that with CMAKE_CXX_STANDARD 11 and CMAKE_CXX_STANDARD_REQUIRED ON and CMAKE_CXX_EXTENSIONS OFF. I usually build on Linux and that's fine.

Unfortunately, it seems that when MSVC, a popular compiler on Windows, does not support C++11 - even in its newer versions. It only supports C++14 (mostly) and later. That's not CMake's fault of course - but what is CMake's fault is that it's not failing to configure my project, where I have clearly said I want strict C++11 conformance. Instead, I have to scratch my head trying to figure out what's wrong, reading the compiler documentation etc. - because, supposedly, CMake told me I can build my C++11 code with that compiler, which is not true.

I assume this behavior is more general than for just MSVC, hence the scope of the title.

(Using v3.26.3)

Edited by Eyal Rozenberg
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information