diff options
Diffstat (limited to 'Tests/RunCMake')
18 files changed, 95 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 7cbc9fe..dc63975 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -64,6 +64,9 @@ add_RunCMake_test(CMP0053) add_RunCMake_test(CMP0054) add_RunCMake_test(CMP0055) add_RunCMake_test(CMP0057) +if(CMAKE_GENERATOR STREQUAL "Ninja") + add_RunCMake_test(Ninja) +endif() add_RunCMake_test(CTest) if(NOT CMake_TEST_EXTERNAL_CMAKE) diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt new file mode 100644 index 0000000..8646a13 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake b/Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake new file mode 100644 index 0000000..0f77930 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0058 NEW) +set(byproducts BYPRODUCTS byproduct1a byproduct1b) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-result.txt b/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt new file mode 100644 index 0000000..fa10109 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt @@ -0,0 +1 @@ +ninja: error: 'byproduct1a', needed by 'output2', missing and no known rule to make it diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake b/Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake new file mode 100644 index 0000000..582e3d5 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0058 NEW) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt new file mode 100644 index 0000000..8646a13 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake b/Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake new file mode 100644 index 0000000..92a3a0f --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0058 OLD) +set(byproducts BYPRODUCTS byproduct1a byproduct1b) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt new file mode 100644 index 0000000..8646a13 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake b/Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake new file mode 100644 index 0000000..0326e07 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0058 OLD) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt new file mode 100644 index 0000000..8646a13 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake b/Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake new file mode 100644 index 0000000..6128167 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake @@ -0,0 +1,2 @@ +set(byproducts BYPRODUCTS byproduct1a byproduct1b) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt new file mode 100644 index 0000000..8646a13 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt new file mode 100644 index 0000000..439a2d9 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt @@ -0,0 +1,19 @@ +^CMake Warning \(dev\): + Policy CMP0058 is not set: Ninja requires custom command byproducts to be + explicit. Run "cmake --help-policy CMP0058" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + This project specifies custom command DEPENDS on files in the build tree + that are not specified as the OUTPUT or BYPRODUCTS of any + add_custom_command or add_custom_target: + + byproduct1a + byproduct1b + + For compatibility with versions of CMake that did not have the BYPRODUCTS + option, CMake is generating phony rules for such files to convince 'ninja' + to build. + + Project authors should add the missing BYPRODUCTS or OUTPUT options to the + custom commands that produce these files. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake b/Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake new file mode 100644 index 0000000..7bc66ef --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake @@ -0,0 +1 @@ +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-common.cmake b/Tests/RunCMake/Ninja/CMP0058-common.cmake new file mode 100644 index 0000000..9274d58 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-common.cmake @@ -0,0 +1,17 @@ +add_custom_command( + OUTPUT output1 + ${byproducts} + COMMAND ${CMAKE_COMMAND} -E touch output1 + COMMAND ${CMAKE_COMMAND} -E touch byproduct1a + COMMAND ${CMAKE_COMMAND} -E touch byproduct1b + ) +add_custom_target(Drive1 ALL DEPENDS output1) +add_custom_command( + OUTPUT output2 + COMMAND ${CMAKE_COMMAND} -E copy output1 output2 + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output1 + ${CMAKE_CURRENT_BINARY_DIR}/byproduct1a + ${CMAKE_CURRENT_BINARY_DIR}/byproduct1b + ) +add_custom_target(Drive2 ALL DEPENDS output2) +add_dependencies(Drive2 Drive1) diff --git a/Tests/RunCMake/Ninja/CMakeLists.txt b/Tests/RunCMake/Ninja/CMakeLists.txt new file mode 100644 index 0000000..2a0591e --- /dev/null +++ b/Tests/RunCMake/Ninja/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.2) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake new file mode 100644 index 0000000..64f97bc --- /dev/null +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -0,0 +1,18 @@ +include(RunCMake) + +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) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(CMP0058-${case}) + run_cmake_command(CMP0058-${case}-build ${CMAKE_COMMAND} --build .) +endfunction() + +run_CMP0058(OLD-no) +run_CMP0058(OLD-by) +run_CMP0058(WARN-no) +run_CMP0058(WARN-by) +run_CMP0058(NEW-no) +run_CMP0058(NEW-by) |