diff options
author | Craig Scott <craig.scott@crascit.com> | 2024-05-28 12:56:25 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2024-05-29 10:39:17 (GMT) |
commit | f588421b58f23b192670ad686e2797a09489a096 (patch) | |
tree | cbf003f0f9ddcb6aa049081ba238e43607b67825 /Tests | |
parent | 4370fcf7505bf0dc651478ab581f19c474278c59 (diff) | |
download | CMake-f588421b58f23b192670ad686e2797a09489a096.zip CMake-f588421b58f23b192670ad686e2797a09489a096.tar.gz CMake-f588421b58f23b192670ad686e2797a09489a096.tar.bz2 |
FetchContent: Enforce FETCHCONTENT_FULLY_DISCONNECTED requirements
FETCHCONTENT_FULLY_DISCONNECTED should only be set to true if
each dependency's source directory has already been populated.
Previously, this wasn't being checked, but now it is (subject to a new
policy).
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CMP0170/CMP0170-NEW-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0170/CMP0170-NEW-stderr.txt | 14 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0170/CMP0170-NEW-stdout.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0170/CMP0170-NEW.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0170/CMP0170-OLD-stdout.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0170/CMP0170-OLD.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0170/CMP0170-WARN-stderr.txt | 28 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0170/CMP0170-WARN-stdout.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0170/CMP0170-WARN.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0170/CMP0170.cmake | 18 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0170/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0170/RunCMakeTest.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 1 |
13 files changed, 83 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0170/CMP0170-NEW-result.txt b/Tests/RunCMake/CMP0170/CMP0170-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0170/CMP0170-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0170/CMP0170-NEW-stderr.txt b/Tests/RunCMake/CMP0170/CMP0170-NEW-stderr.txt new file mode 100644 index 0000000..f786bd6 --- /dev/null +++ b/Tests/RunCMake/CMP0170/CMP0170-NEW-stderr.txt @@ -0,0 +1,14 @@ +CMake Error at .*/Modules/FetchContent\.cmake:[0-9]+ \(message\): + FETCHCONTENT_FULLY_DISCONNECTED is set to true, which requires the source + directory for dependency t1 to already be populated\. This generally means + it must not be set to true the first time CMake is run in a build + directory\. The following source directory should already be populated, but + it doesn't exist:[ +]+ .*/Tests/RunCMake/CMP0170/IdoNotExist[ +]+ Policy CMP0170 controls enforcement of this requirement\. +Call Stack \(most recent call first\): + .*/Modules/FetchContent\.cmake:[0-9]+:EVAL:1 \(__FetchContent_Populate\) + .*/Modules/FetchContent\.cmake:[0-9]+ \(cmake_language\) + CMP0170\.cmake:[0-9]+ \(FetchContent_Populate\) + CMP0170-NEW\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CMP0170/CMP0170-NEW-stdout.txt b/Tests/RunCMake/CMP0170/CMP0170-NEW-stdout.txt new file mode 100644 index 0000000..2dc34a6 --- /dev/null +++ b/Tests/RunCMake/CMP0170/CMP0170-NEW-stdout.txt @@ -0,0 +1,2 @@ +-- Starting population +-- Configuring incomplete, errors occurred! diff --git a/Tests/RunCMake/CMP0170/CMP0170-NEW.cmake b/Tests/RunCMake/CMP0170/CMP0170-NEW.cmake new file mode 100644 index 0000000..60b386a --- /dev/null +++ b/Tests/RunCMake/CMP0170/CMP0170-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0170 NEW) +include(CMP0170.cmake) diff --git a/Tests/RunCMake/CMP0170/CMP0170-OLD-stdout.txt b/Tests/RunCMake/CMP0170/CMP0170-OLD-stdout.txt new file mode 100644 index 0000000..82c260b --- /dev/null +++ b/Tests/RunCMake/CMP0170/CMP0170-OLD-stdout.txt @@ -0,0 +1,3 @@ +-- Starting population +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) diff --git a/Tests/RunCMake/CMP0170/CMP0170-OLD.cmake b/Tests/RunCMake/CMP0170/CMP0170-OLD.cmake new file mode 100644 index 0000000..812cca0 --- /dev/null +++ b/Tests/RunCMake/CMP0170/CMP0170-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0170 OLD) +include(CMP0170.cmake) diff --git a/Tests/RunCMake/CMP0170/CMP0170-WARN-stderr.txt b/Tests/RunCMake/CMP0170/CMP0170-WARN-stderr.txt new file mode 100644 index 0000000..1253abd --- /dev/null +++ b/Tests/RunCMake/CMP0170/CMP0170-WARN-stderr.txt @@ -0,0 +1,28 @@ +CMake Warning at .*/Modules/FetchContent\.cmake:[0-9]+ \(message\): + FETCHCONTENT_FULLY_DISCONNECTED is set to true, which requires the source + directory for dependency t1 to already be populated\. This generally means + it must not be set to true the first time CMake is run in a build + directory\. The following source directory should already be populated, but + it doesn't exist:[ +]+ .*/Tests/RunCMake/CMP0170/IdoNotExist[ +]+ Policy CMP0170 controls enforcement of this requirement\. +Call Stack \(most recent call first\): + .*/Modules/FetchContent\.cmake:[0-9]+:EVAL:1 \(__FetchContent_Populate\) + .*/Modules/FetchContent\.cmake:[0-9]+ \(cmake_language\) + CMP0170\.cmake:[0-9]+ \(FetchContent_Populate\) + CMP0170-WARN\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +[ +]+CMake Warning at .*/Modules/FetchContent\.cmake:[0-9]+ \(message\): + FETCHCONTENT_FULLY_DISCONNECTED is set to true, which requires the source + directory for dependency t2 to already be populated\. This generally means + it must not be set to true the first time CMake is run in a build + directory\. The following source directory should already be populated, but + it doesn't exist:[ +]+ .*/Tests/RunCMake/CMP0170/IdoNotExist[ +]+ Policy CMP0170 controls enforcement of this requirement\. +Call Stack \(most recent call first\): + .*/Modules/FetchContent\.cmake:[0-9]+ \(__FetchContent_Populate\) + CMP0170\.cmake:[0-9]+ \(FetchContent_MakeAvailable\) + CMP0170-WARN\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CMP0170/CMP0170-WARN-stdout.txt b/Tests/RunCMake/CMP0170/CMP0170-WARN-stdout.txt new file mode 100644 index 0000000..82c260b --- /dev/null +++ b/Tests/RunCMake/CMP0170/CMP0170-WARN-stdout.txt @@ -0,0 +1,3 @@ +-- Starting population +-- Configuring done \([0-9]+\.[0-9]s\) +-- Generating done \([0-9]+\.[0-9]s\) diff --git a/Tests/RunCMake/CMP0170/CMP0170-WARN.cmake b/Tests/RunCMake/CMP0170/CMP0170-WARN.cmake new file mode 100644 index 0000000..1754c24 --- /dev/null +++ b/Tests/RunCMake/CMP0170/CMP0170-WARN.cmake @@ -0,0 +1 @@ +include(CMP0170.cmake) diff --git a/Tests/RunCMake/CMP0170/CMP0170.cmake b/Tests/RunCMake/CMP0170/CMP0170.cmake new file mode 100644 index 0000000..4e63e25 --- /dev/null +++ b/Tests/RunCMake/CMP0170/CMP0170.cmake @@ -0,0 +1,18 @@ +cmake_policy(SET CMP0168 NEW) # Faster, don't need to test with sub-build +cmake_policy(SET CMP0169 OLD) # So we can test FetchContent_Populate() directly + +set(FETCHCONTENT_FULLY_DISCONNECTED TRUE) + +include(FetchContent) + +message(STATUS "Starting population") + +FetchContent_Declare(t1 + SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/IdoNotExist" +) +FetchContent_Populate(t1) + +FetchContent_Declare(t2 + SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/IdoNotExist" +) +FetchContent_MakeAvailable(t2) diff --git a/Tests/RunCMake/CMP0170/CMakeLists.txt b/Tests/RunCMake/CMP0170/CMakeLists.txt new file mode 100644 index 0000000..94e43ba --- /dev/null +++ b/Tests/RunCMake/CMP0170/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.29) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0170/RunCMakeTest.cmake b/Tests/RunCMake/CMP0170/RunCMakeTest.cmake new file mode 100644 index 0000000..0ba64e3 --- /dev/null +++ b/Tests/RunCMake/CMP0170/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0170-WARN) +run_cmake(CMP0170-OLD) +run_cmake(CMP0170-NEW) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 8c047d0..5c1e5f6 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -176,6 +176,7 @@ add_RunCMake_test(CMP0160) add_RunCMake_test(CMP0163) add_RunCMake_test(CMP0165) add_RunCMake_test(CMP0169) +add_RunCMake_test(CMP0170) # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode |