summaryrefslogtreecommitdiff
path: root/Modules/FetchContent
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2022-09-11 17:54:57 +1000
committerCraig Scott <craig.scott@crascit.com>2022-09-11 18:36:31 +1000
commit48b380c9613318b888473aa6f178d06de3f21e7e (patch)
tree181a1a2b988db2152ab087fedb8c5d9fa0907207 /Modules/FetchContent
parenta2f9e674bb15d91af15cec815a5c40c0ecc2ee9f (diff)
downloadcmake-48b380c9613318b888473aa6f178d06de3f21e7e.tar.gz
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 'Modules/FetchContent')
-rw-r--r--Modules/FetchContent/package-config-version.cmake.in5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/FetchContent/package-config-version.cmake.in b/Modules/FetchContent/package-config-version.cmake.in
index 7f190944cf..9fcade71ca 100644
--- a/Modules/FetchContent/package-config-version.cmake.in
+++ b/Modules/FetchContent/package-config-version.cmake.in
@@ -1,5 +1,8 @@
# Automatically generated by CMake's FetchContent module.
# Do not edit this file, it will be regenerated every time CMake runs.
-# Version not available, assuming it is compatible
+# Version not available, assuming it is compatible. We must also say it is an
+# exact match to ensure find_package() calls with the EXACT keyword still get
+# redirected.
set(PACKAGE_VERSION_COMPATIBLE TRUE)
+set(PACKAGE_VERSION_EXACT TRUE)