[cmake-developers] compute-default-dialect topic

Brad King brad.king at kitware.com
Wed Sep 16 15:14:12 EDT 2015


On 09/16/2015 03:00 PM, Stephen Kelly wrote:
> I ran cmake with -DCMAKE_CXX_FLAGS=-std=c++11.
> 
> The result is that a default of 11 is computed (with my branch) for the 
> CXX_STANDARD_DEFAULT because of the CMAKE_CXX_FLAGS=-std=c++11,

Right.  I forgot that we honor CMAKE_<LANG>_FLAGS for the compiler id:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeDetermineCompilerId.cmake;hb=v3.3.1#l24

That eliminates my concern.  The use of multiple flags is not a big
problem because the right one wins, and the user did ask for the "loser"
to be there even though the project knows how to add the latter.

>  -std=c++11   -std=gnu++11
> 
> appears instead, which is consistent with the design of CompileFeatures. 
> Arguably the -std=gnu++11 should not be added in that case, but changing 
> that existing behavior would be a different topic.

Yes, and it can be done later if found to be necessary.

Thanks,
-Brad



More information about the cmake-developers mailing list