diff options
author | Brad King <brad.king@kitware.com> | 2017-09-05 13:30:58 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-09-05 13:31:06 (GMT) |
commit | 20e5f7a9c97b5311bda969062c659858c9c896c8 (patch) | |
tree | 823e374a4c3edd2e7c8957732aa33e895b021f3b /Tests/RunCMake | |
parent | 4defa6c21c0a483db229eb1ddbcbe17002722b21 (diff) | |
parent | 1561748496b10bc74adc731fd1d5e7c733034cba (diff) | |
download | CMake-20e5f7a9c97b5311bda969062c659858c9c896c8.zip CMake-20e5f7a9c97b5311bda969062c659858c9c896c8.tar.gz CMake-20e5f7a9c97b5311bda969062c659858c9c896c8.tar.bz2 |
Merge topic 'ExternalProject-command'
15617484 ExternalProject: Prevent COMMAND from being treated as a true keyword
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1178
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/ExternalProject/MultiCommand-build-stdout.txt | 15 | ||||
-rw-r--r-- | Tests/RunCMake/ExternalProject/MultiCommand.cmake | 30 | ||||
-rw-r--r-- | Tests/RunCMake/ExternalProject/RunCMakeTest.cmake | 10 |
3 files changed, 55 insertions, 0 deletions
diff --git a/Tests/RunCMake/ExternalProject/MultiCommand-build-stdout.txt b/Tests/RunCMake/ExternalProject/MultiCommand-build-stdout.txt new file mode 100644 index 0000000..30ebc7d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/MultiCommand-build-stdout.txt @@ -0,0 +1,15 @@ +.* *download 1 +.* *download 2 +.* *update 1 +.* *update 2 +.* *patch 1 +.* *patch 2 +.* *configure 1 +.* *configure 2 +.* *build 1 +.* *build 2 +.* *install 1 +.* *install 2 +.* *test 1 +.* *test 2 +.* diff --git a/Tests/RunCMake/ExternalProject/MultiCommand.cmake b/Tests/RunCMake/ExternalProject/MultiCommand.cmake new file mode 100644 index 0000000..a8dbfea --- /dev/null +++ b/Tests/RunCMake/ExternalProject/MultiCommand.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.9) + +include(ExternalProject) + +# Verify COMMAND keyword is recognised after various *_COMMAND options +ExternalProject_Add(multiCommand + DOWNLOAD_COMMAND "${CMAKE_COMMAND}" -E echo "download 1" + COMMAND "${CMAKE_COMMAND}" -E echo "download 2" + UPDATE_COMMAND "${CMAKE_COMMAND}" -E echo "update 1" + COMMAND "${CMAKE_COMMAND}" -E echo "update 2" + PATCH_COMMAND "${CMAKE_COMMAND}" -E echo "patch 1" + COMMAND "${CMAKE_COMMAND}" -E echo "patch 2" + CONFIGURE_COMMAND "${CMAKE_COMMAND}" -E echo "configure 1" + COMMAND "${CMAKE_COMMAND}" -E echo "configure 2" + BUILD_COMMAND "${CMAKE_COMMAND}" -E echo "build 1" + COMMAND "${CMAKE_COMMAND}" -E echo "build 2" + TEST_COMMAND "${CMAKE_COMMAND}" -E echo "test 1" + COMMAND "${CMAKE_COMMAND}" -E echo "test 2" + INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "install 1" + COMMAND "${CMAKE_COMMAND}" -E echo "install 2" +) + +# Workaround for issue 17229 (missing dependency between update and patch steps) +ExternalProject_Add_StepTargets(multiCommand NO_DEPENDS update) +ExternalProject_Add_StepDependencies(multiCommand patch multiCommand-update) + +# Force all steps to be re-run by removing timestamps from any previous run +ExternalProject_Get_Property(multiCommand STAMP_DIR) +file(REMOVE_RECURSE "${STAMP_DIR}") +file(MAKE_DIRECTORY "${STAMP_DIR}") diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 47d6129..994e2aa 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -12,3 +12,13 @@ run_cmake(Add_StepDependencies_iface) run_cmake(Add_StepDependencies_iface_step) run_cmake(Add_StepDependencies_no_target) run_cmake(UsesTerminal) + +# Run both cmake and build steps. We always do a clean before the +# build to ensure that the download step re-runs each time. +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MultiCommand-build) +set(RunCMake_TEST_NO_CLEAN 1) +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") +file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") +run_cmake(MultiCommand) +run_cmake_command(MultiCommand-clean ${CMAKE_COMMAND} --build . --target clean) +run_cmake_command(MultiCommand-build ${CMAKE_COMMAND} --build .) |