summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2021-02-17 22:40:39 (GMT)
committerCraig Scott <craig.scott@crascit.com>2021-02-17 22:40:39 (GMT)
commitbd876f3849663959f4b8b7c7f2052ecbb53b8500 (patch)
treea9d729e609683132c56ad02cdcffc71cfeb1368f /Tests
parent50fc9d5b45a7dcbb11152ea77b2d47c66e277265 (diff)
downloadCMake-bd876f3849663959f4b8b7c7f2052ecbb53b8500.zip
CMake-bd876f3849663959f4b8b7c7f2052ecbb53b8500.tar.gz
CMake-bd876f3849663959f4b8b7c7f2052ecbb53b8500.tar.bz2
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.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/FetchContent/MultiCommand-stdout.txt6
-rw-r--r--Tests/RunCMake/FetchContent/MultiCommand.cmake18
-rw-r--r--Tests/RunCMake/FetchContent/RunCMakeTest.cmake1
3 files changed, 25 insertions, 0 deletions
diff --git a/Tests/RunCMake/FetchContent/MultiCommand-stdout.txt b/Tests/RunCMake/FetchContent/MultiCommand-stdout.txt
new file mode 100644
index 0000000..7f2c0f8
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/MultiCommand-stdout.txt
@@ -0,0 +1,6 @@
+.* *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
new file mode 100644
index 0000000..92e08e4
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/MultiCommand.cmake
@@ -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)
diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
index b497382..13013fa 100644
--- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
@@ -2,6 +2,7 @@ include(RunCMake)
unset(RunCMake_TEST_NO_CLEAN)
+run_cmake(MultiCommand)
run_cmake(MissingDetails)
run_cmake(DirectIgnoresDetails)
run_cmake(FirstDetailsWin)