From b030a6af88a02b0237a00e6f3df4a5807f338823 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Sat, 3 Oct 2020 18:46:08 +1000 Subject: FetchContent: Raise error if manually given source dir does not exist Fixes: #21208 --- Modules/FetchContent.cmake | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Modules') diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index acf2a94ef0..40cc362142 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}) -- cgit v1.2.1