diff options
author | Brad King <brad.king@kitware.com> | 2020-01-27 18:24:56 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-01-27 18:26:40 (GMT) |
commit | 0944caaebbd9bbb3e5f0de44ec975571e3833a1a (patch) | |
tree | fe2c04b153dcf56935a0c3426a8ae5a87a5c7662 /Tests | |
parent | 9d4883cce569ac4b8b334a797c7f31073a0b0f7e (diff) | |
download | CMake-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.cmake | 25 |
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) |