diff options
author | Craig Scott <craig.scott@crascit.com> | 2020-12-22 20:49:28 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-12-22 20:49:37 (GMT) |
commit | 88eefaac04a43510d2929ff611c51beed37f20e9 (patch) | |
tree | 9deda9838670c57defc50cb4bc72c18e470ac9c9 /Modules | |
parent | 7340fd823f8b3d978ebba1ecb606ddc25deb3e9b (diff) | |
parent | 51595e5f014be2a948e2e3c3ab5a5ce165deabdf (diff) | |
download | CMake-88eefaac04a43510d2929ff611c51beed37f20e9.zip CMake-88eefaac04a43510d2929ff611c51beed37f20e9.tar.gz CMake-88eefaac04a43510d2929ff611c51beed37f20e9.tar.bz2 |
Merge topic 'fc-relative-SOURCE_DIR'
51595e5f01 FetchContent: Relative SOURCE_DIR override cannot be a hard error
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5641
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FetchContent.cmake | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index 8fabcdc..ba2acfc 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -1060,7 +1060,14 @@ function(FetchContent_Populate contentName) # so no population is required. The build directory may still be specified # by the declared details though. - if(NOT EXISTS "${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}") + if(NOT IS_ABSOLUTE "${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}") + # Don't check this directory because we don't know what location it is + # expected to be relative to. We can't make this a hard error for backward + # compatibility reasons. + message(WARNING "Relative source directory specified. This is not safe, " + "as it depends on the calling directory scope.\n" + " FETCHCONTENT_SOURCE_DIR_${contentNameUpper} --> ${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}") + elseif(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() |