summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/FetchContent
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2020-12-21 23:43:17 (GMT)
committerCraig Scott <craig.scott@crascit.com>2020-12-22 00:09:18 (GMT)
commit51595e5f014be2a948e2e3c3ab5a5ce165deabdf (patch)
tree30739f88395889bbe7cfd858d336bef1f8465402 /Tests/RunCMake/FetchContent
parent81809d1485a0b05c85f7f5b57adfc20c169c5a44 (diff)
downloadCMake-51595e5f014be2a948e2e3c3ab5a5ce165deabdf.zip
CMake-51595e5f014be2a948e2e3c3ab5a5ce165deabdf.tar.gz
CMake-51595e5f014be2a948e2e3c3ab5a5ce165deabdf.tar.bz2
FetchContent: Relative SOURCE_DIR override cannot be a hard error
Fixes: #21624
Diffstat (limited to 'Tests/RunCMake/FetchContent')
-rw-r--r--Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative-stderr.txt3
-rw-r--r--Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative.cmake1
-rw-r--r--Tests/RunCMake/FetchContent/RunCMakeTest.cmake5
3 files changed, 9 insertions, 0 deletions
diff --git a/Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative-stderr.txt b/Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative-stderr.txt
new file mode 100644
index 0000000..3defcb4
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative-stderr.txt
@@ -0,0 +1,3 @@
+ *Relative source directory specified. This is not safe, as it depends on
+ *the calling directory scope.
++ *FETCHCONTENT_SOURCE_DIR_WITHPROJECT --> WithProject
diff --git a/Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative.cmake b/Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative.cmake
new file mode 100644
index 0000000..d8b42ba
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative.cmake
@@ -0,0 +1 @@
+include(ManualSourceDirectory.cmake)
diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
index 3eb331f..9baeab7 100644
--- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
@@ -21,6 +21,11 @@ run_cmake_with_options(ManualSourceDirectory
run_cmake_with_options(ManualSourceDirectoryMissing
-D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT=${CMAKE_CURRENT_LIST_DIR}/ADirThatDoesNotExist"
)
+# Need to use :STRING to prevent CMake from automatically converting it to an
+# absolute path
+run_cmake_with_options(ManualSourceDirectoryRelative
+ -D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT:STRING=WithProject"
+)
function(run_FetchContent_DirOverrides)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DirOverrides-build)