diff options
author | Craig Scott <craig.scott@crascit.com> | 2021-03-09 21:59:59 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2021-03-09 22:07:44 (GMT) |
commit | 57d442e182bcb9a4426912ed7ba68b58c4dcc940 (patch) | |
tree | 7f3509df9143f39bc8cb40a1627625aee6632100 /Tests/RunCMake | |
parent | 791338359f7a78032209a255d16a613360f5430a (diff) | |
download | CMake-57d442e182bcb9a4426912ed7ba68b58c4dcc940.zip CMake-57d442e182bcb9a4426912ed7ba68b58c4dcc940.tar.gz CMake-57d442e182bcb9a4426912ed7ba68b58c4dcc940.tar.bz2 |
Revert ExternalProject and FetchContent refactoring
Refactoring of the ExternalProject and FetchContent modules moved
the commands into CMake scripts. This broke custom commands that
used shell redirection or special build tool variables of the form
$(MakeVar). Undo the sequence of commits that performed this
refactoring and follow-up fixes associated with it.
The following commits are reverted by this change:
4f3d1abbb4 (ExternalProject: Refactor pre-configure steps to support
no-target uses, 2021-02-05)
17e5516e60 (FetchContent: Invoke steps directly and avoid a separate
sub-build, 2021-01-29)
bd876f3849 (FetchContent: Restore patch command support,
2021-02-18)
404cddb7bb (ExternalProject: Fix misuse of IS_NEWER_THAN in
timestamp checks, 2021-02-21)
b0da671243 (FetchContent: Don't update timestamps if files don't
change, 2021-02-18)
Fixes: #21892
Diffstat (limited to 'Tests/RunCMake')
14 files changed, 25 insertions, 117 deletions
diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-stderr.txt index 22d7ac0..5a5ba89 100644 --- a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-stderr.txt +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-NEW-stderr.txt @@ -10,7 +10,7 @@ Call Stack \(most recent call first\): [^ ]*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) [^ -]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_preconfigure_command\) +]*/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-WARN-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt index 0172e3f..bbf7178 100644 --- a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt @@ -13,7 +13,7 @@ Call Stack \(most recent call first\): [^ ]*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) [^ -]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_preconfigure_command\) +]*/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\) @@ -68,7 +68,7 @@ Call Stack \(most recent call first\): [^ ]*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) [^ -]*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_preconfigure_command\) +]*/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\) diff --git a/Tests/RunCMake/ExternalProject/NoOptions-stderr.txt b/Tests/RunCMake/ExternalProject/NoOptions-stderr.txt index 9576ae1..2fc7d29 100644 --- a/Tests/RunCMake/ExternalProject/NoOptions-stderr.txt +++ b/Tests/RunCMake/ExternalProject/NoOptions-stderr.txt @@ -13,6 +13,6 @@ \* HG_REPOSITORY \* CVS_REPOSITORY and CVS_MODULE Call Stack \(most recent call first\): - .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_prepare_download\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_download_command\) NoOptions.cmake:[0-9]+ \(ExternalProject_Add\) CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/SourceEmpty-stderr.txt b/Tests/RunCMake/ExternalProject/SourceEmpty-stderr.txt index 648f28b..07c6e87 100644 --- a/Tests/RunCMake/ExternalProject/SourceEmpty-stderr.txt +++ b/Tests/RunCMake/ExternalProject/SourceEmpty-stderr.txt @@ -13,6 +13,6 @@ \* HG_REPOSITORY \* CVS_REPOSITORY and CVS_MODULE Call Stack \(most recent call first\): - .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_prepare_download\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_download_command\) SourceEmpty.cmake:[0-9]+ \(ExternalProject_Add\) CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/SourceMissing-stderr.txt b/Tests/RunCMake/ExternalProject/SourceMissing-stderr.txt index e061cf6..373f6e3 100644 --- a/Tests/RunCMake/ExternalProject/SourceMissing-stderr.txt +++ b/Tests/RunCMake/ExternalProject/SourceMissing-stderr.txt @@ -13,6 +13,6 @@ \* HG_REPOSITORY \* CVS_REPOSITORY and CVS_MODULE Call Stack \(most recent call first\): - .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_prepare_download\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_download_command\) SourceMissing.cmake:[0-9]+ \(ExternalProject_Add\) CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake b/Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake index 2850bed..201d822 100644 --- a/Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake +++ b/Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake @@ -19,7 +19,7 @@ cmake_minimum_required(VERSION 3.3) # console pool. macro(CheckNinjaStep _target _step _require) if("${_build}" MATCHES -" DESC = Performing ${_step} step (\\([a-zA-Z0-9 ]*\\) )?for '${_target}' +" DESC = Performing ${_step} step for '${_target}' pool = console" ) if(NOT ${_require}) diff --git a/Tests/RunCMake/FetchContent/MultiCommand-stdout.txt b/Tests/RunCMake/FetchContent/MultiCommand-stdout.txt deleted file mode 100644 index 7f2c0f8..0000000 --- a/Tests/RunCMake/FetchContent/MultiCommand-stdout.txt +++ /dev/null @@ -1,6 +0,0 @@ -.* *download 1 -.* *download 2 -.* *update 1 -.* *update 2 -.* *patch 1 -.* *patch 2 diff --git a/Tests/RunCMake/FetchContent/MultiCommand.cmake b/Tests/RunCMake/FetchContent/MultiCommand.cmake deleted file mode 100644 index 92e08e4..0000000 --- a/Tests/RunCMake/FetchContent/MultiCommand.cmake +++ /dev/null @@ -1,18 +0,0 @@ -include(FetchContent) - -# Verify COMMAND keyword is recognised after various *_COMMAND options -FetchContent_Declare(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" -) - -# Force all steps to be re-run by removing timestamps, scripts, etc. from any -# previous run -file(REMOVE_RECURSE "${FETCHCONTENT_BASE_DIR}/multiCommand-subbuild") - -set(FETCHCONTENT_QUIET FALSE) -FetchContent_MakeAvailable(multiCommand) diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake index d7fd009..9baeab7 100644 --- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -2,12 +2,12 @@ include(RunCMake) unset(RunCMake_TEST_NO_CLEAN) -run_cmake(MultiCommand) run_cmake(MissingDetails) run_cmake(DirectIgnoresDetails) run_cmake(FirstDetailsWin) run_cmake(DownloadTwice) run_cmake(DownloadFile) +run_cmake(SameGenerator) run_cmake(VarDefinitions) run_cmake(GetProperties) run_cmake(UsesTerminalOverride) @@ -27,36 +27,6 @@ run_cmake_with_options(ManualSourceDirectoryRelative -D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT:STRING=WithProject" ) -function(run_FetchContent_TimeStamps) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TimeStamps) - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - # First run should execute the commands - run_cmake(TimeStamps) - - # Ensure that the file checks we use in the TimeStampsRerun-check.cmake script - # will not be defeated by file systems with only one second resolution. - # The IS_NEWER_THAN check returns TRUE if the timestamps of the two files are - # the same, which has been observed where filesystems only have one second - # resolution. - set(cmpTimeStamp ${RunCMake_TEST_BINARY_DIR}/cmpTimeStamp.txt) - set(checkTimeStamp ${RunCMake_TEST_BINARY_DIR}/cmpTimeStampCheck.txt) - file(TOUCH ${cmpTimeStamp}) - file(TOUCH ${checkTimeStamp}) - if("${cmpTimeStamp}" IS_NEWER_THAN "${checkTimeStamp}") - execute_process( - COMMAND ${CMAKE_COMMAND} -E sleep 1.125 - COMMAND_ERROR_IS_FATAL LAST - ) - endif() - - # Run again with no changes, no commands should re-execute - set(RunCMake_TEST_NO_CLEAN 1) - run_cmake(TimeStampsRerun) -endfunction() -run_FetchContent_TimeStamps() - function(run_FetchContent_DirOverrides) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DirOverrides-build) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") diff --git a/Tests/RunCMake/FetchContent/SameGenerator.cmake b/Tests/RunCMake/FetchContent/SameGenerator.cmake new file mode 100644 index 0000000..58204ef --- /dev/null +++ b/Tests/RunCMake/FetchContent/SameGenerator.cmake @@ -0,0 +1,17 @@ +include(FetchContent) + +FetchContent_Declare( + t1 + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Download command executed" +) + +FetchContent_Populate(t1) + +file(STRINGS "${FETCHCONTENT_BASE_DIR}/t1-subbuild/CMakeCache.txt" + matchLine REGEX "^CMAKE_GENERATOR:.*=" + LIMIT_COUNT 1 +) +if(NOT matchLine MATCHES "${CMAKE_GENERATOR}") + message(FATAL_ERROR "Generator line mismatch: ${matchLine}\n" + " Expected type: ${CMAKE_GENERATOR}") +endif() diff --git a/Tests/RunCMake/FetchContent/TimeStamps-stdout.txt b/Tests/RunCMake/FetchContent/TimeStamps-stdout.txt deleted file mode 100644 index 2ba1ff4..0000000 --- a/Tests/RunCMake/FetchContent/TimeStamps-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ -.* *download executed -.* *patch executed diff --git a/Tests/RunCMake/FetchContent/TimeStamps.cmake b/Tests/RunCMake/FetchContent/TimeStamps.cmake deleted file mode 100644 index 33874f9..0000000 --- a/Tests/RunCMake/FetchContent/TimeStamps.cmake +++ /dev/null @@ -1,14 +0,0 @@ -include(FetchContent) - -# Do nothing for an update because it would result in always re-running the -# patch step. We want to test that a patch step that only depends on the -# download step is not re-run unnecessarily. -FetchContent_Declare(customCommands - PREFIX ${CMAKE_CURRENT_BINARY_DIR} - DOWNLOAD_COMMAND "${CMAKE_COMMAND}" -E echo "download executed" - UPDATE_COMMAND "" - PATCH_COMMAND "${CMAKE_COMMAND}" -E echo "patch executed" -) - -set(FETCHCONTENT_QUIET FALSE) -FetchContent_MakeAvailable(customCommands) diff --git a/Tests/RunCMake/FetchContent/TimeStampsRerun-check.cmake b/Tests/RunCMake/FetchContent/TimeStampsRerun-check.cmake deleted file mode 100644 index c12a5f4..0000000 --- a/Tests/RunCMake/FetchContent/TimeStampsRerun-check.cmake +++ /dev/null @@ -1,38 +0,0 @@ -set(cmpFile ${RunCMake_TEST_BINARY_DIR}/cmpTimeStamp.txt) -set(scriptDir ${RunCMake_TEST_BINARY_DIR}/tmp) -set(stampDir ${RunCMake_TEST_BINARY_DIR}/src/customcommands-stamp) - -set(errorMessages) -if(NOT EXISTS "${cmpFile}") - list(APPEND errorMessages " ${cmpFile} is missing") -else() - foreach(script IN ITEMS mkdirs download patch) - set(scriptFile "${scriptDir}/customcommands-${script}.cmake") - if(NOT EXISTS "${scriptFile}") - list(APPEND errorMessages " ${scriptFile} is missing") - elseif(NOT "${cmpFile}" IS_NEWER_THAN "${scriptFile}") - list(APPEND errorMessages " ${scriptFile} was unexectedly updated") - endif() - endforeach() - - # special case, not a script, has different extension - set(repoInfoFile "${scriptDir}/customcommands-download-repoinfo.txt") - if(NOT EXISTS "${repoInfoFile}") - list(APPEND errorMessages " ${repoInfoFile} is missing") - elseif(NOT "${cmpFile}" IS_NEWER_THAN "${repoInfoFile}") - list(APPEND errorMessages " ${repoInfoFile} was unexectedly updated") - endif() - - foreach(step IN ITEMS download patch) - set(stampFile "${stampDir}/customcommands-${step}") - if(NOT EXISTS "${stampFile}") - list(APPEND errorMessages " ${stampFile} is missing") - elseif(NOT "${cmpFile}" IS_NEWER_THAN "${stampFile}") - list(APPEND errorMessages " ${stampFile} was unexectedly updated") - endif() - endforeach() -endif() - -if(errorMessages) - list(JOIN errorMessages "\n" RunCMake_TEST_FAILED) -endif() diff --git a/Tests/RunCMake/FetchContent/TimeStampsRerun.cmake b/Tests/RunCMake/FetchContent/TimeStampsRerun.cmake deleted file mode 100644 index e13667a..0000000 --- a/Tests/RunCMake/FetchContent/TimeStampsRerun.cmake +++ /dev/null @@ -1 +0,0 @@ -include(${CMAKE_CURRENT_LIST_DIR}/TimeStamps.cmake) |