summaryrefslogtreecommitdiffstats
path: root/Modules/FetchContent.cmake
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2020-10-03 08:46:08 (GMT)
committerCraig Scott <craig.scott@crascit.com>2020-10-03 08:46:08 (GMT)
commitb030a6af88a02b0237a00e6f3df4a5807f338823 (patch)
treeb2b905bd77e5193a44393c70bc274d68b5ac7118 /Modules/FetchContent.cmake
parent468bcc3291ac3f325b401046b2465d634d8e3947 (diff)
downloadCMake-b030a6af88a02b0237a00e6f3df4a5807f338823.zip
CMake-b030a6af88a02b0237a00e6f3df4a5807f338823.tar.gz
CMake-b030a6af88a02b0237a00e6f3df4a5807f338823.tar.bz2
FetchContent: Raise error if manually given source dir does not exist
Fixes: #21208
Diffstat (limited to 'Modules/FetchContent.cmake')
-rw-r--r--Modules/FetchContent.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake
index acf2a94..40cc362 100644
--- a/Modules/FetchContent.cmake
+++ b/Modules/FetchContent.cmake
@@ -1052,6 +1052,12 @@ function(FetchContent_Populate contentName)
# The source directory has been explicitly provided in the cache,
# so no population is required. The build directory may still be specified
# by the declared details though.
+
+ if(NOT EXISTS "${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}")
+ message(FATAL_ERROR "Manually specified source directory is missing:\n"
+ " FETCHCONTENT_SOURCE_DIR_${contentNameUpper} --> ${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}")
+ endif()
+
set(${contentNameLower}_SOURCE_DIR "${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}")
cmake_parse_arguments(savedDetails "" "BINARY_DIR" "" ${contentDetails})