summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-05-18 13:24:54 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-18 13:24:54 (GMT)
commiteb076692459a8d4cc214156af3553c36309bdce3 (patch)
tree19162f9a7935519c5aed57af63eef4aba72ca579 /Tests/RunCMake
parent8a862a4d4b852c9f61ae4ed7fc46042b00a83123 (diff)
downloadCMake-eb076692459a8d4cc214156af3553c36309bdce3.zip
CMake-eb076692459a8d4cc214156af3553c36309bdce3.tar.gz
CMake-eb076692459a8d4cc214156af3553c36309bdce3.tar.bz2
Tests: Select RunCMake.Ninja test cases based on ninja version
Some test cases need features not available in Ninja < 1.6, so check the version before running them.
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 8160c2d..c73f852 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -1,5 +1,20 @@
include(RunCMake)
+# Detect ninja version so we know what tests can be supported.
+execute_process(
+ COMMAND "${RunCMake_MAKE_PROGRAM}" --version
+ OUTPUT_VARIABLE ninja_out
+ ERROR_VARIABLE ninja_out
+ RESULT_VARIABLE ninja_res
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+if(ninja_res EQUAL 0 AND "x${ninja_out}" MATCHES "^x[0-9]+\\.[0-9]+")
+ set(ninja_version "${ninja_out}")
+ message(STATUS "ninja version: ${ninja_version}")
+else()
+ message(FATAL_ERROR "'ninja --version' reported:\n${ninja_out}")
+endif()
+
function(run_CMP0058 case)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0058-${case}-build)
@@ -169,6 +184,11 @@ build build.ninja: RERUN ${escaped_build_ninja_dep} || ${escaped_ninja_output_pa
endfunction(run_sub_cmake)
+if("${ninja_version}" VERSION_LESS 1.6)
+ message(WARNING "Ninja is too old; skipping rest of test.")
+ return()
+endif()
+
foreach(ninja_output_path_prefix "sub space" "sub")
run_sub_cmake(Executable "${ninja_output_path_prefix}")
run_sub_cmake(StaticLib "${ninja_output_path_prefix}")