[cmake-developers] C|CXX Standards Handling

Stephen Kelly steveire at gmail.com
Wed Sep 16 15:17:01 EDT 2015


Brad King wrote:

> 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.

I think <LANG>_STANDARD_REQUIRED is not related to what Daniel described. 
Daniel is talking about using a compiler for which no features are recorded 
at all afaik.

>> - 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?

A brief search didn't reveal the relevant mailing list thread. I think it 
was to avoid everyone having to wrap target_compile_features() calls in 
conditions to avoid errors with unsupported compilers, and with unsupported 
versions of supported compilers. When the feature was initially added, it 
did not cover as large a matrix as today.

There is information about adding support for compile features at 

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

Thanks,

Steve.




More information about the cmake-developers mailing list