diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2017-01-30 18:17:19 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2017-01-30 18:19:44 (GMT) |
commit | 1679fecb74ee4eb4500d591796f93fe4271b688e (patch) | |
tree | 3e8712e10a487b62f2d84ada46c1238d3390bc44 /Tests/CompileFeatures | |
parent | 98e6d1e5e426c491e04faa746c11746002e6a69d (diff) | |
download | CMake-1679fecb74ee4eb4500d591796f93fe4271b688e.zip CMake-1679fecb74ee4eb4500d591796f93fe4271b688e.tar.gz CMake-1679fecb74ee4eb4500d591796f93fe4271b688e.tar.bz2 |
CompileFeatures Test: make sure the target "CompileFeatures" is always defined
Everything in there guards against unsupported compilers already, so no need to
skip the whole file if no features are defined. This in turn allows to have a
simpler fallback in case there is no C++ auto_type feature available.
Diffstat (limited to 'Tests/CompileFeatures')
-rw-r--r-- | Tests/CompileFeatures/CMakeLists.txt | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 13aa86e..2a307d0 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -3,14 +3,6 @@ cmake_minimum_required(VERSION 3.1) project(CompileFeatures) -if (NOT CMAKE_C_COMPILE_FEATURES AND NOT CMAKE_CXX_COMPILE_FEATURES) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp" - "int main(int,char**) { return 0; }\n" - ) - add_executable(CompileFeatures "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp") - return() -endif() - macro(run_test feature lang) if (";${CMAKE_${lang}_COMPILE_FEATURES};" MATCHES ${feature}) add_library(test_${feature} OBJECT ${feature}) @@ -277,8 +269,14 @@ if (CMAKE_CXX_COMPILE_FEATURES) endif() endif () -# these tests only work if at least cxx_auto_type is available -if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_auto_type;") +# always add a target "CompileFeatures" +if (NOT ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_auto_type;") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp" + "int main(int,char**) { return 0; }\n" + ) + add_executable(CompileFeatures "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp") +else() + # these tests only work if at least cxx_auto_type is available add_executable(CompileFeatures main.cpp) set_property(TARGET CompileFeatures PROPERTY COMPILE_FEATURES "cxx_auto_type" |