Hi Claus, how does target_compile_features() test the c++11 conformance? >
It doesn't. The language features supported by different compilers and thier various versions is basically a manually constructed whitelist since testing for them at configure time is far too costly. You can see the details for msvc here in the internal compiler detection logic in the CMake distribution: Modules/Compiler/MSVC-CXX-FeatureTests.cmake target_compile_features(${targetname} PRIVATE cxx_std_11) # OK > > But wenn I use this most features are missing: > > target_compile_features(${targetname} PRIVATE > cxx_contextual_conversions # OK > ... #FIXME: missing features at MS VS12 2013: > ... > cxx_aggregate_default_initializers ... > ) > The cxx_std_11 compile feature is a meta-feature. Basically it tells CMake to Use the compiler in C++11 mode if possible, and then the cmpiler will do what it can. This is effectively adding the -std=c++11 flag to gcc or -std=c++1y for cxx_std_14. The compiler may not support all the features but CMake knows that it can at least support *some* so it will try to use what it can. MSVC is a bit of an oddball with compilers since you cant actually control the language level (maybe with 2017 you can), i.e. you can't explicitly instruct msvc to build in C++98 mode only. The individual language features wre initially put in place due to the half-broken C++11 implementations that thend to be available in many compilers (as you're finding out). However, over time as it's used more that level of granularity is less and less useful. Hence the addition of the meta-features for language levels. Several compilers that have reecently added language standard support in CMake (IBM XL, Cray, PGI) are now just using the meta-feature as the maintenace burdon for maintaining the feature tables is too great with respect to the reward. Hope that helps clarify the state of things. ---------- Chuck Atkins Staff R&D Engineer, Scientific Computing Kitware, Inc.
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers