diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-11-18 20:33:08 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-11-18 23:42:35 (GMT) |
commit | 7565ab2cd1e52356410b655a32241a422d5c93b2 (patch) | |
tree | abf53c7a3d1746ceb8b3613be332dd963b0b4b99 /Tests | |
parent | 598a316154922f27f987d0f7a78b28ab78a85be6 (diff) | |
download | CMake-7565ab2cd1e52356410b655a32241a422d5c93b2.zip CMake-7565ab2cd1e52356410b655a32241a422d5c93b2.tar.gz CMake-7565ab2cd1e52356410b655a32241a422d5c93b2.tar.bz2 |
Features: Test the CXX compiler only if it has features.
If using different C and CXX compilers, we might not have a
feature-full CXX compiler at this point.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CompileFeatures/CMakeLists.txt | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index d02ddaf..5ce188a 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -77,36 +77,38 @@ foreach(lang CXX C) endif() endforeach() -add_executable(CompileFeatures main.cpp) -set_property(TARGET CompileFeatures - PROPERTY COMPILE_FEATURES "cxx_auto_type" -) -set_property(TARGET CompileFeatures - PROPERTY CXX_STANDARD_REQUIRED TRUE -) +if (CMAKE_CXX_COMPILE_FEATURES) + add_executable(CompileFeatures main.cpp) + set_property(TARGET CompileFeatures + PROPERTY COMPILE_FEATURES "cxx_auto_type" + ) + set_property(TARGET CompileFeatures + PROPERTY CXX_STANDARD_REQUIRED TRUE + ) -add_executable(GenexCompileFeatures main.cpp) -set_property(TARGET GenexCompileFeatures - PROPERTY COMPILE_FEATURES "$<1:cxx_auto_type>;$<0:not_a_feature>" -) + add_executable(GenexCompileFeatures main.cpp) + set_property(TARGET GenexCompileFeatures + PROPERTY COMPILE_FEATURES "$<1:cxx_auto_type>;$<0:not_a_feature>" + ) -add_library(iface INTERFACE) -set_property(TARGET iface - PROPERTY INTERFACE_COMPILE_FEATURES "cxx_auto_type" -) -add_executable(IfaceCompileFeatures main.cpp) -target_link_libraries(IfaceCompileFeatures iface) + add_library(iface INTERFACE) + set_property(TARGET iface + PROPERTY INTERFACE_COMPILE_FEATURES "cxx_auto_type" + ) + add_executable(IfaceCompileFeatures main.cpp) + target_link_libraries(IfaceCompileFeatures iface) -add_executable(CompileFeaturesGenex genex_test.cpp) -set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11) -target_compile_definitions(CompileFeaturesGenex PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) + add_executable(CompileFeaturesGenex genex_test.cpp) + set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11) + target_compile_definitions(CompileFeaturesGenex PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) -add_executable(CompileFeaturesGenex2 genex_test.cpp) -target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_constexpr) -target_compile_definitions(CompileFeaturesGenex2 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) + add_executable(CompileFeaturesGenex2 genex_test.cpp) + target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_constexpr) + target_compile_definitions(CompileFeaturesGenex2 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) -add_library(noexcept_iface INTERFACE) -target_compile_features(noexcept_iface INTERFACE cxx_noexcept) -add_executable(CompileFeaturesGenex3 genex_test.cpp) -target_link_libraries(CompileFeaturesGenex3 PRIVATE noexcept_iface) -target_compile_definitions(CompileFeaturesGenex3 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) + add_library(noexcept_iface INTERFACE) + target_compile_features(noexcept_iface INTERFACE cxx_noexcept) + add_executable(CompileFeaturesGenex3 genex_test.cpp) + target_link_libraries(CompileFeaturesGenex3 PRIVATE noexcept_iface) + target_compile_definitions(CompileFeaturesGenex3 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) +endif() |