diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-10-21 14:59:40 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-05-09 12:39:30 (GMT) |
commit | f5bf9d431166250257d4ff2716f74668b1fce16b (patch) | |
tree | 37089da7f067ecaf777454cf9fc8c79a029c0bd7 /Tests/CompileFeatures | |
parent | 3547a00d77a5a894a2d9133ac61a6c9ed3dda5e2 (diff) | |
download | CMake-f5bf9d431166250257d4ff2716f74668b1fce16b.zip CMake-f5bf9d431166250257d4ff2716f74668b1fce16b.tar.gz CMake-f5bf9d431166250257d4ff2716f74668b1fce16b.tar.bz2 |
Tests: Make CompileFeature tests use highest standard known.
Remove the use of check_cxx_source_compiles which is now just getting in
the way.
Blacklist the cxx_alignof feature in the test with GNU 4.7. The test
file compiles, but it is documented as available first in GNU 4.8.
Diffstat (limited to 'Tests/CompileFeatures')
-rw-r--r-- | Tests/CompileFeatures/CMakeLists.txt | 22 | ||||
-rw-r--r-- | Tests/CompileFeatures/feature_test.cpp | 10 |
2 files changed, 29 insertions, 3 deletions
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 274c5ba..925f757 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -27,13 +27,29 @@ foreach(feature ${cxx_features}) run_test(${feature} CXX) endforeach() +if (CMAKE_CXX_COMPILER_ID STREQUAL GNU + AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) + list(REMOVE_ITEM CXX_non_features + cxx_alignof + ) +endif() + if (CMAKE_CXX_COMPILE_FEATURES) - include(CheckCXXSourceCompiles) foreach(feature ${CXX_non_features}) - check_cxx_source_compiles("#include \"${CMAKE_CURRENT_SOURCE_DIR}/${feature}.cpp\"\nint main() { return 0; }\n" ${feature}_works) + 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.") + "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() diff --git a/Tests/CompileFeatures/feature_test.cpp b/Tests/CompileFeatures/feature_test.cpp new file mode 100644 index 0000000..4406c16 --- /dev/null +++ b/Tests/CompileFeatures/feature_test.cpp @@ -0,0 +1,10 @@ + +#define STRINGIFY_IMPL(X) #X +#define STRINGIFY(X) STRINGIFY_IMPL(X) + +#include STRINGIFY(TEST) + +int main() +{ + return 0; +} |