diff options
author | Craig Scott <craig.scott@crascit.com> | 2020-10-03 08:46:08 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2020-10-03 08:46:08 (GMT) |
commit | b030a6af88a02b0237a00e6f3df4a5807f338823 (patch) | |
tree | b2b905bd77e5193a44393c70bc274d68b5ac7118 /Tests/RunCMake/FetchContent | |
parent | 468bcc3291ac3f325b401046b2465d634d8e3947 (diff) | |
download | CMake-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 'Tests/RunCMake/FetchContent')
5 files changed, 26 insertions, 0 deletions
diff --git a/Tests/RunCMake/FetchContent/ManualSourceDirectory.cmake b/Tests/RunCMake/FetchContent/ManualSourceDirectory.cmake new file mode 100644 index 0000000..83fcc4b --- /dev/null +++ b/Tests/RunCMake/FetchContent/ManualSourceDirectory.cmake @@ -0,0 +1,8 @@ +include(FetchContent) + +FetchContent_Declare( + WithProject + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/ADirThatDoesNotExist +) + +FetchContent_MakeAvailable(WithProject) diff --git a/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing-result.txt b/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing-stderr.txt b/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing-stderr.txt new file mode 100644 index 0000000..7ecb06b --- /dev/null +++ b/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing-stderr.txt @@ -0,0 +1,2 @@ + *Manually specified source directory is missing: ++ *FETCHCONTENT_SOURCE_DIR_WITHPROJECT --> .*/ADirThatDoesNotExist diff --git a/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing.cmake b/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing.cmake new file mode 100644 index 0000000..0e24c1a --- /dev/null +++ b/Tests/RunCMake/FetchContent/ManualSourceDirectoryMissing.cmake @@ -0,0 +1,8 @@ +include(FetchContent) + +FetchContent_Declare( + WithProject + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithProject +) + +FetchContent_MakeAvailable(WithProject) diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake index ad9e48e..3eb331f 100644 --- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -15,6 +15,13 @@ run_cmake(MakeAvailable) run_cmake(MakeAvailableTwice) run_cmake(MakeAvailableUndeclared) +run_cmake_with_options(ManualSourceDirectory + -D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT=${CMAKE_CURRENT_LIST_DIR}/WithProject" +) +run_cmake_with_options(ManualSourceDirectoryMissing + -D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT=${CMAKE_CURRENT_LIST_DIR}/ADirThatDoesNotExist" +) + function(run_FetchContent_DirOverrides) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DirOverrides-build) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") |