diff options
Diffstat (limited to 'Tests/RunCMake/FetchContent/DisableSourceChanges.cmake')
-rw-r--r-- | Tests/RunCMake/FetchContent/DisableSourceChanges.cmake | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Tests/RunCMake/FetchContent/DisableSourceChanges.cmake b/Tests/RunCMake/FetchContent/DisableSourceChanges.cmake new file mode 100644 index 0000000..a144005 --- /dev/null +++ b/Tests/RunCMake/FetchContent/DisableSourceChanges.cmake @@ -0,0 +1,18 @@ +cmake_policy(SET CMP0168 NEW) + +# Undocumented variable used to catch attempts to write to anywhere under the +# source directory that isn't under the build directory. In order for this +# code path to be checked for direct population mode, we need a non-empty +# download, update, or patch command so that the population code path is used. +# Custom commands might not write to the source directory and instead just +# print messages or other non-modifying tasks, like is done here. +set(CMAKE_DISABLE_SOURCE_CHANGES TRUE) + +include(FetchContent) + +FetchContent_Declare( + WithProject + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithProject # This exists + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Download command executed" +) +FetchContent_MakeAvailable(WithProject) |