FetchContent: Restore patch command support

The refactoring in 17e5516e60 (FetchContent: Invoke steps directly and
avoid a separate sub-build, 2021-01-29) contained a typo which resulted
in any PATCH_COMMAND being ignored. Fix the typo and add a test case
that would have caught the regression.
This commit is contained in:
Craig Scott 2021-02-18 09:40:39 +11:00
parent 50fc9d5b45
commit bd876f3849
4 changed files with 26 additions and 1 deletions

View File

@ -3897,7 +3897,7 @@ function(_ep_do_preconfigure_steps_now name)
# Once any step has to run, all later steps have to be run too
set(need_to_run FALSE)
foreach(step IN ITEMS download update parse)
foreach(step IN ITEMS download update patch)
if(update_disconnected AND "${step}" STREQUAL "update")
continue()
endif()

View File

@ -0,0 +1,6 @@
.* *download 1
.* *download 2
.* *update 1
.* *update 2
.* *patch 1
.* *patch 2

View File

@ -0,0 +1,18 @@
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)

View File

@ -2,6 +2,7 @@ include(RunCMake)
unset(RunCMake_TEST_NO_CLEAN)
run_cmake(MultiCommand)
run_cmake(MissingDetails)
run_cmake(DirectIgnoresDetails)
run_cmake(FirstDetailsWin)