summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2022-09-11 07:54:57 (GMT)
committerCraig Scott <craig.scott@crascit.com>2022-09-11 08:36:31 (GMT)
commit48b380c9613318b888473aa6f178d06de3f21e7e (patch)
tree181a1a2b988db2152ab087fedb8c5d9fa0907207 /Tests
parenta2f9e674bb15d91af15cec815a5c40c0ecc2ee9f (diff)
downloadCMake-48b380c9613318b888473aa6f178d06de3f21e7e.zip
CMake-48b380c9613318b888473aa6f178d06de3f21e7e.tar.gz
CMake-48b380c9613318b888473aa6f178d06de3f21e7e.tar.bz2
FetchContent: Ignore EXACT for redirected find_package() calls
When FetchContent_MakeAvailable() populates a dependency for which find_package() integration is enabled, all future calls to find_package() MUST succeed using the contents of the redirection directory. The generated config version file was not handling calls where the EXACT keyword was given, resulting in such calls rejecting the redirection directory's contents and continuing its search. It is not allowed to do that. Fix the generated file to also set PACKAGE_VERSION_EXACT to true so that calls with EXACT now accept it, as was originally intended. Fixes: #23950
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake b/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake
index c1030fb..4943f9e 100644
--- a/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake
+++ b/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake
@@ -18,3 +18,7 @@ message(STATUS "Lowercase extra file was read")
# This is expected to be re-routed to a FetchContent_MakeAvailable() call
find_package(AddedProject REQUIRED)
+
+# Verify that find_package() version constraints are fully ignored by the
+# default-generated config version file
+find_package(AddedProject 1.2.3 EXACT REQUIRED)