diff options
author | Brad King <brad.king@kitware.com> | 2020-09-10 14:56:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-09-14 14:48:16 (GMT) |
commit | b4fc4da903ad5c69cfbf693839ee5020c3f2ede6 (patch) | |
tree | d473e70256a9f5ec5dd34149bf3c1463f6c51de3 /Tests/RunCMake/ExternalProject | |
parent | f5791e24c63617901ae033c14d99c0e02d402b05 (diff) | |
download | CMake-b4fc4da903ad5c69cfbf693839ee5020c3f2ede6.zip CMake-b4fc4da903ad5c69cfbf693839ee5020c3f2ede6.tar.gz CMake-b4fc4da903ad5c69cfbf693839ee5020c3f2ede6.tar.bz2 |
ExternalProject: Add policy CMP0114 to refine step target dependencies
`ExternalProject_Add_StepTargets` and `INDEPENDENT_STEP_TARGETS` have
some limitations and lack some sanity checks. They can cause confusing
build systems to be generated. The basic problems are:
* The notion of step independence is attached to the step target
rather than the step itself.
* The custom commands implementing the steps are duplicated in the
step targets and the primary targets. This can cause races.
It is also incompatible with the Xcode "new build system".
Fix this by introducing policy CMP0114 to change the way step target
dependencies are handled. Define independence from external
dependencies as a property of each individual step regardless of whether
there is a target for it. Add dependencies among the primary target and
the step targets such that each custom command only appears in one
target. When some steps are disconnected from the primary target, add
step targets for the steps commonly depended upon so that there is a
place to hold their custom commands uniquely.
Fixes: #18663
Diffstat (limited to 'Tests/RunCMake/ExternalProject')
31 files changed, 325 insertions, 6 deletions
diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies-stderr.txt b/Tests/RunCMake/ExternalProject/Add_StepDependencies-stderr.txt new file mode 100644 index 0000000..d0ff15f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies-stderr.txt @@ -0,0 +1,12 @@ +^CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set: ExternalProject step targets fully adopt their + steps. Run "cmake --help-policy CMP0114" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + ExternalProject target 'FOO' would depend on the targets for step\(s\) + 'do_something' under policy CMP0114, but this is being left out for + compatibility since the policy is not set. +Call Stack \(most recent call first\): + Add_StepDependencies.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target-stderr.txt b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target-stderr.txt new file mode 100644 index 0000000..2ae2b53 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target-stderr.txt @@ -0,0 +1,12 @@ +^CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set: ExternalProject step targets fully adopt their + steps. Run "cmake --help-policy CMP0114" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + ExternalProject target 'FOO' would depend on the targets for step\(s\) + 'do_something' under policy CMP0114, but this is being left out for + compatibility since the policy is not set. +Call Stack \(most recent call first\): + Add_StepDependencies_no_target.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep1-result.txt b/Tests/RunCMake/ExternalProject/BadIndependentStep1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep1-stderr.txt b/Tests/RunCMake/ExternalProject/BadIndependentStep1-stderr.txt new file mode 100644 index 0000000..3188910 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep1-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + ExternalProject 'proj' step 'custom' is marked INDEPENDENT but depends on + step 'configure' that is not marked INDEPENDENT. +Call Stack \(most recent call first\): + BadIndependentStep1.cmake:[0-9]+ \(ExternalProject_Add_Step\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep1.cmake b/Tests/RunCMake/ExternalProject/BadIndependentStep1.cmake new file mode 100644 index 0000000..c81eb07 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep1.cmake @@ -0,0 +1,14 @@ +include(ExternalProject) +cmake_policy(SET CMP0114 NEW) + +ExternalProject_Add(proj + SOURCE_DIR "." + DOWNLOAD_COMMAND "" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + ) +ExternalProject_Add_Step(proj custom + DEPENDEES configure + INDEPENDENT 1 + ) diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep2-result.txt b/Tests/RunCMake/ExternalProject/BadIndependentStep2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep2-stderr.txt b/Tests/RunCMake/ExternalProject/BadIndependentStep2-stderr.txt new file mode 100644 index 0000000..0b87e5e --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep2-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + ExternalProject 'proj' step 'update' is marked INDEPENDENT but depends on + step 'custom' that is not marked INDEPENDENT. +Call Stack \(most recent call first\): + BadIndependentStep2.cmake:[0-9]+ \(ExternalProject_Add_Step\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/BadIndependentStep2.cmake b/Tests/RunCMake/ExternalProject/BadIndependentStep2.cmake new file mode 100644 index 0000000..4a530ea --- /dev/null +++ b/Tests/RunCMake/ExternalProject/BadIndependentStep2.cmake @@ -0,0 +1,13 @@ +include(ExternalProject) +cmake_policy(SET CMP0114 NEW) + +ExternalProject_Add(proj + SOURCE_DIR "." + DOWNLOAD_COMMAND "" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + ) +ExternalProject_Add_Step(proj custom + DEPENDERS update + ) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-Common.cmake index 57626d6..176e28b 100644 --- a/Tests/RunCMake/ExternalProject/NO_DEPENDS.cmake +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-Common.cmake @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.8.12) include(ExternalProject RESULT_VARIABLE GOO) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-result.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-stderr.txt new file mode 100644 index 0000000..c6bf767 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + The 'NO_DEPENDS' option is no longer allowed. It has been superseded by + the per-step 'INDEPENDENT' option. See policy CMP0114. +Call Stack \(most recent call first\): + NO_DEPENDS-CMP0114-NEW-Direct.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct.cmake new file mode 100644 index 0000000..7ec1a00 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-Direct.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0114 NEW) +include(ExternalProject) +ExternalProject_Add(BAR SOURCE_DIR . TEST_COMMAND echo test) +ExternalProject_Add_StepTargets(BAR NO_DEPENDS test) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-result.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-stderr.txt new file mode 100644 index 0000000..5a5ba89 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-stderr.txt @@ -0,0 +1,16 @@ +^CMake Error at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + ExternalProject 'FOO' option 'INDEPENDENT_STEP_TARGETS' is set to + + download;patch;update;configure;build + + but the option is no longer allowed. It has been superseded by the + per-step 'INDEPENDENT' option. See policy CMP0114. +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_mkdir_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-NEW.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW.cmake new file mode 100644 index 0000000..9622a60 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0114 NEW) +include(NO_DEPENDS-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD-stderr.txt index 42400d4..2b0feb6 100644 --- a/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD-stderr.txt @@ -10,7 +10,8 @@ Call Stack \(most recent call first\): ]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) [^ ]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_configure_command\) - NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-OLD.cmake:[0-9]+ \(include\) CMakeLists.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. + @@ -26,7 +27,8 @@ Call Stack \(most recent call first\): ]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) [^ ]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_build_command\) - NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-OLD.cmake:[0-9]+ \(include\) CMakeLists.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. + @@ -42,7 +44,8 @@ Call Stack \(most recent call first\): ]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) [^ ]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_install_command\) - NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-OLD.cmake:[0-9]+ \(include\) CMakeLists.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. + @@ -52,6 +55,7 @@ CMake Warning \(dev\) at [^ Call Stack \(most recent call first\): [^ ]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) - NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + NO_DEPENDS-CMP0114-OLD.cmake:[0-9]+ \(include\) CMakeLists.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD.cmake new file mode 100644 index 0000000..c20d443 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0114 OLD) +include(NO_DEPENDS-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt new file mode 100644 index 0000000..bbf7178 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt @@ -0,0 +1,119 @@ +^CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set: ExternalProject step targets fully adopt their + steps. Run "cmake --help-policy CMP0114" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + ExternalProject 'FOO' option INDEPENDENT_STEP_TARGETS is set to + + download;patch;update;configure;build + + but the option is deprecated in favor of policy CMP0114. +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_mkdir_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "configure" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_configure_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "build" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_build_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set: ExternalProject step targets fully adopt their + steps. Run "cmake --help-policy CMP0114" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + ExternalProject 'BAR' option INDEPENDENT_STEP_TARGETS is set to + + install + + but the option is deprecated in favor of policy CMP0114. +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_mkdir_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "install" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(cmake_language\) + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_install_command\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set: ExternalProject step targets fully adopt their + steps. Run "cmake --help-policy CMP0114" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + ExternalProject target 'BAR' would depend on the targets for step\(s\) + 'test;bar' under policy CMP0114, but this is being left out for + compatibility since the policy is not set. Also, the NO_DEPENDS option is + deprecated in favor of policy CMP0114. +Call Stack \(most recent call first\): + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Using NO_DEPENDS for "test" step might break parallel builds +Call Stack \(most recent call first\): + [^ +]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) + NO_DEPENDS-CMP0114-Common.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + NO_DEPENDS-CMP0114-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN.cmake new file mode 100644 index 0000000..3d9642d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN.cmake @@ -0,0 +1,2 @@ +# Policy CMP0114 not set. +include(NO_DEPENDS-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index c2c77e0..1e88e0b 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -6,6 +6,8 @@ include(RunCMake) unset(ENV{http_proxy}) unset(ENV{https_proxy}) +run_cmake(BadIndependentStep1) +run_cmake(BadIndependentStep2) run_cmake(IncludeScope-Add) run_cmake(IncludeScope-Add_Step) run_cmake(NoOptions) @@ -14,13 +16,46 @@ run_cmake(SourceMissing) run_cmake(CMAKE_CACHE_ARGS) run_cmake(CMAKE_CACHE_DEFAULT_ARGS) run_cmake(CMAKE_CACHE_mix) -run_cmake(NO_DEPENDS) +run_cmake(NO_DEPENDS-CMP0114-WARN) +run_cmake(NO_DEPENDS-CMP0114-OLD) +run_cmake(NO_DEPENDS-CMP0114-NEW) +run_cmake(NO_DEPENDS-CMP0114-NEW-Direct) run_cmake(Add_StepDependencies) run_cmake(Add_StepDependencies_iface) run_cmake(Add_StepDependencies_iface_step) run_cmake(Add_StepDependencies_no_target) run_cmake(UsesTerminal) +macro(check_steps_missing proj) + set(steps "${ARGN}") + foreach(step ${steps}) + if(EXISTS ${RunCMake_TEST_BINARY_DIR}/${proj}-${step}-mark) + string(APPEND RunCMake_TEST_FAILED "${proj} '${step}' step ran but should not have\n") + endif() + endforeach() +endmacro() + +macro(check_steps_present proj) + set(steps "${ARGN}") + foreach(step ${steps}) + if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/${proj}-${step}-mark) + string(APPEND RunCMake_TEST_FAILED "${proj} '${step}' step did not run but should have\n") + endif() + endforeach() +endmacro() + +function(run_steps_CMP0114 val) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Steps-CMP0114-${val}-build) + run_cmake(Steps-CMP0114-${val}) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(Steps-CMP0114-${val}-build-download ${CMAKE_COMMAND} --build . --target proj1-download) + run_cmake_command(Steps-CMP0114-${val}-build-update ${CMAKE_COMMAND} --build . --target proj1-update) + run_cmake_command(Steps-CMP0114-${val}-build-install ${CMAKE_COMMAND} --build . --target proj1-install) + run_cmake_command(Steps-CMP0114-${val}-build-test ${CMAKE_COMMAND} --build . --target proj1-test) +endfunction() +run_steps_CMP0114(OLD) +run_steps_CMP0114(NEW) + # Run both cmake and build steps. We always do a clean before the # build to ensure that the download step re-runs each time. function(__ep_test_with_build testName) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-Common.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-Common.cmake new file mode 100644 index 0000000..210edb1 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-Common.cmake @@ -0,0 +1,34 @@ +include(ExternalProject) + +ExternalProject_Add(proj0 + SOURCE_DIR "." + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj0-download-mark + CONFIGURE_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj0-configure-mark + BUILD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj0-build-mark + INSTALL_COMMAND "" + ) + +cmake_policy(GET CMP0114 cmp0114) +if(cmp0114 STREQUAL "NEW") + set(step_targets "update;test") + set(independent_step_targets "") +else() + set(step_targets "install;test") + set(independent_step_targets "download;update") +endif() + +ExternalProject_Add(proj1 + DEPENDS proj0 + SOURCE_DIR "." + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-download-mark + UPDATE_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-update-mark + PATCH_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-patch-mark + CONFIGURE_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-configure-mark + BUILD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-build-mark + INSTALL_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-install-mark + TEST_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proj1-test-mark + TEST_EXCLUDE_FROM_MAIN 1 # Along with 'STEP_TARGETS test', implies 'STEP_TARGETS install' + UPDATE_DISCONNECTED 1 # Along with 'STEP_TARGETS update', implies 'STEP_TARGETS download' + STEP_TARGETS ${step_targets} + INDEPENDENT_STEP_TARGETS ${independent_step_targets} + ) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-download-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-download-check.cmake new file mode 100644 index 0000000..1439f02 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-download-check.cmake @@ -0,0 +1,3 @@ +check_steps_missing(proj0 download configure build) +check_steps_present(proj1 download) +check_steps_missing(proj1 update patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-install-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-install-check.cmake new file mode 100644 index 0000000..c1c9c8f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-install-check.cmake @@ -0,0 +1,3 @@ +check_steps_present(proj0 download configure build) +check_steps_present(proj1 download patch configure build install) +check_steps_missing(proj1 test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-test-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-test-check.cmake new file mode 100644 index 0000000..fe256f2 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-test-check.cmake @@ -0,0 +1,2 @@ +check_steps_present(proj0 download configure build) +check_steps_present(proj1 download patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-update-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-update-check.cmake new file mode 100644 index 0000000..63e2e1d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW-build-update-check.cmake @@ -0,0 +1,3 @@ +check_steps_missing(proj0 download configure build) +check_steps_present(proj1 download update) +check_steps_missing(proj1 patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW.cmake new file mode 100644 index 0000000..9d8e99e --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0114 NEW) +include(Steps-CMP0114-Common.cmake) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-download-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-download-check.cmake new file mode 100644 index 0000000..1439f02 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-download-check.cmake @@ -0,0 +1,3 @@ +check_steps_missing(proj0 download configure build) +check_steps_present(proj1 download) +check_steps_missing(proj1 update patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-install-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-install-check.cmake new file mode 100644 index 0000000..c1c9c8f --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-install-check.cmake @@ -0,0 +1,3 @@ +check_steps_present(proj0 download configure build) +check_steps_present(proj1 download patch configure build install) +check_steps_missing(proj1 test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-test-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-test-check.cmake new file mode 100644 index 0000000..fe256f2 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-test-check.cmake @@ -0,0 +1,2 @@ +check_steps_present(proj0 download configure build) +check_steps_present(proj1 download patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-update-check.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-update-check.cmake new file mode 100644 index 0000000..63e2e1d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD-build-update-check.cmake @@ -0,0 +1,3 @@ +check_steps_missing(proj0 download configure build) +check_steps_present(proj1 download update) +check_steps_missing(proj1 patch configure build install test) diff --git a/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD.cmake b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD.cmake new file mode 100644 index 0000000..0b51ad8 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Steps-CMP0114-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0114 OLD) +include(Steps-CMP0114-Common.cmake) |