[cmake-developers] C|CXX Standards Handling

Brad King brad.king at kitware.com
Wed Sep 16 13:38:46 EDT 2015


On 09/16/2015 03:56 AM, Daniel Wirtz wrote:
> Basically, CMake silently continues to configure past any 
> set(CMAKE_C_STANDARD <value>) command even if CMake does
> not have any information on the necessary flags for the current compiler.

For reference, this was discussed during the original design in
this thread:

 target_compile_features remaining issues, 2014-04-21 13:16:16 GMT
 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/9812/focus=9996

IIRC it led to the creation of <LANG>_STANDARD_REQUIRED.  Read through
that thread for more details.

> there's standard flags information right now only for gnu and clang

The list of supported compilers is available in the manual:

 http://www.cmake.org/cmake/help/v3.3/manual/cmake-compile-features.7.html#supported-compilers

It includes GNU, Clang, AppleClang, MSVC, and SunPro right now.

> - if there is no standards information for the given compiler, issue a 
> warning to tell the developer just that.

See above thread for why it silently decays.

> - if additionally XX_REQUIRED is set on cmake or target level, throw a 
> fatal error on configure time as cmake cannot ensure
>    to set the correct flags required for the requested C standard.

Steve, do you remember if/why/where we decided to ignore these properties
on compilers for which know language standard levels or features are
known?

-Brad



More information about the cmake-developers mailing list