Steve, Eike, Now that 2.8.12 is tagged I'd like to revive the work to support C++11 features. Eike's work started here:
http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/6726 and ended up as the cxx11 topic on the stage: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=63fba610 However, Steve raised several valid concerns which resulted in a target_compiler_feature command proposal forked off the other topic here: http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/7795 To summarize, the cxx11 topic (commit 63fba610) adds a FindCXXFeatures module that allows find_package(CXXFeatures) to detect compiler features available for the current C++ toolchain and set a CXX11_COMPILER_FLAGS variable with the flags needed to enable them. Steve raised at least the following concerns: * Using try_compile to detect feature support may be unreliable in the case of partially implemented features. It is better to test the current compiler version against that documented by the vendor to support given features. The test case added in the cxx11 topic already does this to determine expected results. * Returning flags in CXX11_COMPILER_FLAGS puts the burden on the project author to add the flags to CMAKE_CXX_FLAGS or some other place to make sure they are used. This is not convenient, does not propagate to dependent projects, and cannot take advantage of the modern COMPILE_OPTIONS and usage requirements infrastructure which use ;-lists. Steve instead proposed to: * Encode the compiler version->feature map in the platform information modules. (I've added policy CMP0025 to use the AppleClang compiler id for Apple's Clang so we can perform reliable version tests.) * Create a target_compiler_feature command to declare the features requested: target_compiler_feature(somelib PUBLIC OPTIONAL final DEFINE Foo_FINAL) CMake would then handle adding all the right flags and propagate the requirements to consuming CMake projects through target exports. Importantly, this approach would allow consuming projects to be built with a different compiler than the original and still get the right flags to support needed features to include the package's header files. * Create a write_compiler_detection_header macro to generate a C++ header file that helps projects abstract away some of the language feature differences. (I'd like to shelve this one until the main compiler feature propagation approach is handled.) Steve, please explain your proposal in more detail. How does the list of requested features get mapped to the proper -std=cxx11 or equivalent flag? Thanks, -Brad -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
