[cmake-developers] c++ feature detection and usage requirements

Brad King brad.king at kitware.com
Fri Aug 30 08:07:05 EDT 2013


On 08/30/2013 08:02 AM, Stephen Kelly wrote:
> It turns out that in order to do this, the compiler features would 
> have to be listed independently of Modules/Compiler/${ID}.cmake. Otherwise I 
> wouldn't be able to check the MSVC features while using GNU. 
> 
> Maybe they should be listed in Modules/CompilerFeatures/${ID}-${LANG}.cmake 
> instead?

Why do you need to check features of a compiler not currently enabled?
Without being enabled we don't even know what version of the other
compiler to check.

I thought the idea was to specify in target_compiler_features the
features needed so they would be published in the target interface.
Then whatever compiler is used can have its feature set tested against
the requirements.  This would work both in-project and in consumers, no?

>> We also need a plan to phase out support for ancient versions in the
>> future.
> 
> Any ideas on how to do that? 

Perhaps we can document for each value of CMAKE_MINIMUM_VERSION_REQUIRED
the oldest VERSION value supported.  That way it is up to the project
author to update VERSION and port code when bumping the minimum required
version of CMake.  It will allow us to move forward but give projects
a long grace period.

-Brad



More information about the cmake-developers mailing list