[cmake-developers] Please review CXXFeatures.cmake

Alexander Neundorf neundorf at kde.org
Mon Apr 29 14:17:40 EDT 2013


On Sunday 28 April 2013, Rolf Eike Beer wrote:
> One question I see increasingly often is "how do I test for C++11 support"
> or for specific parts of that. For 2.8.12 I plan to include the check
> module I wrote for that a while back, and that I have reworked in the last
> weeks. You can find the current state in the "rework" branch of this
> repository:
> 
> git://anongit.kde.org/scratch/dakon/cmake-cxx11

Line 75: if (CROSS_COMPILING)

Do you mean if(CMAKE_CROSSCOMPILING) ?

Is the try_run() in all cases necessary ?
It would be better if a try_compile() would suffice, that's faster and then it 
works the same way when cross-compiling and when not.


Line 139:
if (NOT CXXFEATURES_FIND_COMPONENTS)
    set(CXXFEATURES_FIND_COMPONENTS ${_CXX_ALL_FEATURES})
endif ()

foreach (_cxx_feature IN LISTS _CXX_ALL_FEATURES)
    cxx_check_feature(${_cxx_feature} ${FEATURE_NAME})
endforeach (_cxx_feature)


Is this how it is supposed to be or should the foreach() loop run over 
CXXFEATURES_FIND_COMPONENTS ?


I didn't try, but it seems it can fail if I give an unknown component. Is 
there a check that only known components (CXX features) are requested ?


Alex



More information about the cmake-developers mailing list