summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-01-27 18:24:56 (GMT)
committerBrad King <brad.king@kitware.com>2020-01-27 18:26:40 (GMT)
commit0944caaebbd9bbb3e5f0de44ec975571e3833a1a (patch)
treefe2c04b153dcf56935a0c3426a8ae5a87a5c7662 /Tests
parent9d4883cce569ac4b8b334a797c7f31073a0b0f7e (diff)
downloadCMake-0944caaebbd9bbb3e5f0de44ec975571e3833a1a.zip
CMake-0944caaebbd9bbb3e5f0de44ec975571e3833a1a.tar.gz
CMake-0944caaebbd9bbb3e5f0de44ec975571e3833a1a.tar.bz2
Tests: Fix RunCMake.CMP0037 test with Ninja 1.10
The CMP0037 OLD and WARN cases that actually use reserved target names like `all` produce `build.ninja` files with duplicate build statements producing the same output. With Ninja 1.10 and above we run ninja tools at the end of generation that require `build.ninja` to be loadable. It is not loadable for these test cases, so skip them.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMP0037/RunCMakeTest.cmake25
1 files changed, 23 insertions, 2 deletions
diff --git a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake
index 98274f0..5952279 100644
--- a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake
@@ -1,5 +1,24 @@
include(RunCMake)
+if(RunCMake_GENERATOR MATCHES "^Ninja")
+ # 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()
+else()
+ set(ninja_version "")
+endif()
+
run_cmake(CMP0037-OLD-space)
run_cmake(CMP0037-NEW-space)
run_cmake(CMP0037-WARN-space)
@@ -9,8 +28,10 @@ if(NOT (WIN32 AND "${RunCMake_GENERATOR}" MATCHES "Make"))
run_cmake(CMP0037-WARN-colon)
endif()
-run_cmake(CMP0037-WARN-reserved)
-run_cmake(CMP0037-OLD-reserved)
+if(NOT ninja_version VERSION_GREATER_EQUAL 1.10)
+ run_cmake(CMP0037-WARN-reserved)
+ run_cmake(CMP0037-OLD-reserved)
+endif()
run_cmake(CMP0037-NEW-reserved)
run_cmake(NEW-cond)