summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-05-09 15:27:55 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-05-09 15:29:05 (GMT)
commit6a9fdbeb48eb16a0f7082329f0d0840bf0c0a98c (patch)
tree17344b719d857cff01af9e04f964fb91ad5c89a3 /Tests
parentf5bf9d431166250257d4ff2716f74668b1fce16b (diff)
downloadCMake-6a9fdbeb48eb16a0f7082329f0d0840bf0c0a98c.zip
CMake-6a9fdbeb48eb16a0f7082329f0d0840bf0c0a98c.tar.gz
CMake-6a9fdbeb48eb16a0f7082329f0d0840bf0c0a98c.tar.bz2
Test: Parameterize the language in the CompileFeature test.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt42
1 files changed, 23 insertions, 19 deletions
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index 925f757..adf50d5 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -34,25 +34,29 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL GNU
)
endif()
-if (CMAKE_CXX_COMPILE_FEATURES)
- foreach(feature ${CXX_non_features})
- message("Testing feature : ${feature}")
- try_compile(${feature}_works
- "${CMAKE_CURRENT_BINARY_DIR}/${feature}_test"
- "${CMAKE_CURRENT_SOURCE_DIR}/feature_test.cpp"
- COMPILE_DEFINITIONS "-DTEST=${CMAKE_CURRENT_SOURCE_DIR}/${feature}.cpp"
- CMAKE_FLAGS "-DCMAKE_CXX_STANDARD=11"
- OUTPUT_VARIABLE OUTPUT
- )
- if (${feature}_works)
- message(SEND_ERROR
- "Feature ${feature} expected not to work for ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}.
-Update the supported features or blacklist it.\n${OUTPUT}")
- else()
- message("Testing feature : ${feature} -- Fails, as expected.")
- endif()
- endforeach()
-endif()
+set(CXX_ext cpp)
+set(CXX_standard_flag 11)
+foreach(lang CXX)
+ if (CMAKE_${lang}_COMPILE_FEATURES)
+ foreach(feature ${${lang}_non_features})
+ message("Testing feature : ${feature}")
+ try_compile(${feature}_works
+ "${CMAKE_CURRENT_BINARY_DIR}/${feature}_test"
+ "${CMAKE_CURRENT_SOURCE_DIR}/feature_test.${${lang}_ext}"
+ COMPILE_DEFINITIONS "-DTEST=${CMAKE_CURRENT_SOURCE_DIR}/${feature}.${${lang}_ext}"
+ CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD=${${lang}_standard_flag}"
+ OUTPUT_VARIABLE OUTPUT
+ )
+ if (${feature}_works)
+ message(SEND_ERROR
+ "Feature ${feature} expected not to work for ${lang} ${CMAKE_${lang}_COMPILER_ID}-${CMAKE_${lang}_COMPILER_VERSION}.
+ Update the supported features or blacklist it.\n${OUTPUT}")
+ else()
+ message("Testing feature : ${feature} -- Fails, as expected.")
+ endif()
+ endforeach()
+ endif()
+endforeach()
add_executable(CompileFeatures main.cpp)
set_property(TARGET CompileFeatures