[cmake-developers] Please review CXXFeatures.cmake

Stephen Kelly steveire at gmail.com
Thu Aug 15 08:37:42 EDT 2013


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.

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

Brad, do you have any response to any part of anything I wrote about that 
topic?

Thanks,

Steve.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.cpp
Type: text/x-c++src
Size: 273 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20130815/d5dc2321/attachment-0004.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.h
Type: text/x-chdr
Size: 1119 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20130815/d5dc2321/attachment-0002.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 118 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20130815/d5dc2321/attachment-0005.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CompilerFeatures.cmake
Type: text/x-cmake
Size: 7889 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20130815/d5dc2321/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMakeLists.txt
Type: text/x-cmake
Size: 3133 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20130815/d5dc2321/attachment-0005.bin>


More information about the cmake-developers mailing list