diff options
author | Craig Scott <craig.scott@crascit.com> | 2022-05-18 13:28:10 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2022-05-18 13:28:10 (GMT) |
commit | 8a28368feb938f301604c24c0294e2a25749cc77 (patch) | |
tree | 228338448210780cf1a26c0e841a4c1b5e3e56b8 | |
parent | 8ce9bb8a0c6e98ff58b7b497c4b8376c2759abfc (diff) | |
download | CMake-8a28368feb938f301604c24c0294e2a25749cc77.zip CMake-8a28368feb938f301604c24c0294e2a25749cc77.tar.gz CMake-8a28368feb938f301604c24c0294e2a25749cc77.tar.bz2 |
FetchContent: Don't discard non-empty SOURCE_DIR and BINARY_DIR
-rw-r--r-- | Modules/FetchContent.cmake | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index f142a5c..f74454c 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -1165,10 +1165,18 @@ function(__FetchContent_setPopulated contentName) set(propertyName "${prefix}_sourceDir") define_property(GLOBAL PROPERTY ${propertyName}) + if("${arg_SOURCE_DIR}" STREQUAL "") + # Don't discard a previously provided SOURCE_DIR + get_property(arg_SOURCE_DIR GLOBAL PROPERTY ${propertyName}) + endif() set_property(GLOBAL PROPERTY ${propertyName} "${arg_SOURCE_DIR}") set(propertyName "${prefix}_binaryDir") define_property(GLOBAL PROPERTY ${propertyName}) + if("${arg_BINARY_DIR}" STREQUAL "") + # Don't discard a previously provided BINARY_DIR + get_property(arg_BINARY_DIR GLOBAL PROPERTY ${propertyName}) + endif() set_property(GLOBAL PROPERTY ${propertyName} "${arg_BINARY_DIR}") set(propertyName "${prefix}_populated") @@ -1690,10 +1698,8 @@ macro(FetchContent_MakeAvailable) unset(__cmake_fpArgs) if(${__cmake_contentName}_FOUND) - set(${__cmake_contentNameLower}_SOURCE_DIR "") - set(${__cmake_contentNameLower}_BINARY_DIR "") - set(${__cmake_contentNameLower}_POPULATED TRUE) __FetchContent_setPopulated(${__cmake_contentName}) + FetchContent_GetProperties(${__cmake_contentName}) continue() endif() endif() |