cmake/Find: set <Modulename>_FOUND for compatibility when found via pkg-config

For Find modules where `<Modulename>` is not fully uppercase.

`<Modulename>` is case-exact name used in the Find modules filename:
`CMake/Find<Moduleame>.cmake`.

`find_package_handle_standard_args()` sets both `<MODULENAME>_FOUND` and
`<Modulename>_FOUND` when detecting the dependency. Some CMake code
relies on this and 3rd-party code may rely on it too. Make sure to set
the latter variant when detecting the dependency via `pkg-config`, where
we don't call `find_package_handle_standard_args()`.

CMake sets these variable to `TRUE` (not `ON` or `1`). Replicate this
for compatibility.

Closes #16153
This commit is contained in:
Viktor Szakats 2025-02-02 14:45:21 +01:00
parent ffd6132da6
commit 2b9b3ec579
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
15 changed files with 15 additions and 0 deletions

View file

@ -48,6 +48,7 @@ if(CURL_USE_PKGCONFIG AND
endif()
if(LIBPSL_FOUND AND LIBPSL_INCLUDE_DIRS)
set(Libpsl_FOUND TRUE)
string(REPLACE ";" " " LIBPSL_CFLAGS "${LIBPSL_CFLAGS}")
message(STATUS "Found Libpsl (via pkg-config): ${LIBPSL_INCLUDE_DIRS} (found version \"${LIBPSL_VERSION}\")")
else()