[cmake-developers] Please review CXXFeatures.cmake

Rolf Eike Beer eike at sf-mail.de
Fri Sep 20 16:32:12 EDT 2013


Am Donnerstag, 15. August 2013, 14:37:42 schrieb Stephen Kelly:
> Stephen Kelly wrote:
> > Stephen Kelly wrote:
> >> I still think you should revisit my review mail on point 2 too.
> > 
> > Something that becomes possible when thinking about the above and target
> > properties is interface requirements.
> 
> I've implemented a prototype which has better API than your module.
> 
> In my concept:
> 
> * Applying the -std=c++11 flag is the responsibility of CMake, not the user.
> 
> * CMake determines the -std= flag to use (GCC 4.9 has -std=c++1y by now). It
> won't add '-std=c++11 -std=c++14', but just '-std=c++14'
> 
> * Required compiler features are scoped to targets.

Can I get this globally? So I define once that all targets in my project get 
this? [Reading further] I assume I can set a global or directory property that 
will then propagate to all targets below.

> * Target properties are set, exported and transitively evaluated track the
> compiler features required.
> 
> * Compiler requirements can be optional, in which case -D defines are
> generated in the (PUBLIC) COMPILE_DEFINITIONS
> 
> * The -D defines are for scoping or replacement, depending on what the
> feature calls for.
> 
> * Required compiler features are listed in the INTERFACE of exported
> targets. CMake evaluates whether the compiler is capable of using the
> IMPORTED targets it is supposed to use transitively, in a similar way to the
> POSITION_INDEPENDENT_CODE feature.
> 
> * A new command target_compiler_feature is introduced with two signatures:
> 
>  target_compiler_feature(<target> <PUBLIC|PRIVATE>
>    REQUIRED <feature1> [<feature2> ...])
>  target_compiler_feature(<target> <PUBLIC|PRIVATE>
>    OPTIONAL <feature> DEFINE <define_name>)
> 
> * Another non-target-scoped command could be introduced, similar to
> target_compile_options -> add_compile_options.
> 
> This is better in many noteworthy ways to the cxx11 topic in the stage.

It solves an entirely different problem. My topic makes CMake detect which C++ 
features the compiler supports. Your topic is about how to get this to the 
targets and propagate it to the targets that use them.

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20130920/28d2a077/attachment.sig>


More information about the cmake-developers mailing list