summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ExternalProject/SourceDirChange.cmake
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2022-01-31 04:51:13 (GMT)
committerCraig Scott <craig.scott@crascit.com>2022-02-01 11:31:29 (GMT)
commitd3477eba067c22f7b2986caa573754fd2b84c8ef (patch)
tree6814377ab0fad90e069dd997753878baca9d5208 /Tests/RunCMake/ExternalProject/SourceDirChange.cmake
parent4b033ca0eb486fa23f58e4df2f2a7d3539ca0a3f (diff)
downloadCMake-d3477eba067c22f7b2986caa573754fd2b84c8ef.zip
CMake-d3477eba067c22f7b2986caa573754fd2b84c8ef.tar.gz
CMake-d3477eba067c22f7b2986caa573754fd2b84c8ef.tar.bz2
ExternalProject: Rerun download on SOURCE_DIR change
Fixes: #21748
Diffstat (limited to 'Tests/RunCMake/ExternalProject/SourceDirChange.cmake')
-rw-r--r--Tests/RunCMake/ExternalProject/SourceDirChange.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/Tests/RunCMake/ExternalProject/SourceDirChange.cmake b/Tests/RunCMake/ExternalProject/SourceDirChange.cmake
new file mode 100644
index 0000000..62213cd
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/SourceDirChange.cmake
@@ -0,0 +1,20 @@
+include(ExternalProject)
+
+file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/first")
+file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/second")
+
+if("${SOURCE_DIR_CHANGE}" STREQUAL "")
+ set(source_dir first)
+else()
+ set(source_dir second)
+endif()
+
+ExternalProject_Add(source_dir_change
+ SOURCE_DIR "${CMAKE_BINARY_DIR}/${source_dir}"
+ DOWNLOAD_COMMAND "${CMAKE_COMMAND}" -E echo "Download command executed"
+ UPDATE_COMMAND ""
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ TEST_COMMAND ""
+ INSTALL_COMMAND ""
+)