Stephen Kelly wrote: > I'll try to get a reviewable and first-feature-complete infrastructure > branch together soon.
I've pushed a first iteration of the target_compiler_features branch to my clone. For the language specification, I added a prefix to each feature. This matches the feature tests of clang for standard features, and it is extensible to extensions with gnuxx_typeof, msvc_sealed etc. http://clang.llvm.org/docs/LanguageExtensions.html So far, it only supports the REQUIRED signature of the command. It will need to get a <PUBLIC|PRIVATE> specifier, so that the INTERFACE_COMPILER_FEATURES property can be populated in PUBLIC mode. It also needs to learn to process generator expressions and how to consume that property. Optional features with defines are not yet implemented. I was considering renaming target_compiler_features to target_required_features and not using the same command for optional features. Instead I think it might be a good idea to have a separate command for optional features. Something like: write_compiler_feature_file( FILENAME "${CMAKE_CURRENT_BINARY_DIR}/grantlee_compiler_features.h" FEATURES cxx_static_assert gnuxx_typeof cxx_variadic_templates ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/grantlee_compiler_features.h" DESTINATION include ) which writes the file with appropriate content. I don't see any need to use preprocessor macros for that instead of a file. I also prototyped a simple way to test clang features as reportedly supported by clang itself. This won't get us all of the way there with clang, as some features (such as the gnu typeof extension) do not have support via __has_extension. Additionally, I changed my mind on the issue of whether to bump the dialect to c++11 if the compiler supports the requested feature in c++98 mode. For example, cxx_variadic_templates would be in CMAKE_CXX98_COMPILER_FEATURES for GCC and clang, because both support variadic templates even when using the -std=c++98 dialect. This will still warn, but that's ok, I think. Note that adding -std=c++11 is almost, but not quite, entirely source compatible. For example, this will work with c++98, but errors with c++11: #define add_prefix(suf) "pre_"suf add_prefix("_end"); The feature can be extended for the C standard (89, 99, 11) features too as well as extensions. Any comments so far? Thanks, Steve. -- 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