mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:31:41 +03:00
cmake: clear package version after pkg-config detection
`pkg_check_modules()` seems to leave `<PACKAGE>_VERSION` defined with an
empty value, if the package is not found.
When the package is also not found in the fallback branch,
`find_package_handle_standard_args()` logs and error message. In this
message it includes the bogus empty value as: `(found version "")`:
```
Could NOT find Libssh2 (missing: LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY) (found version "")
```
https://github.com/curl/curl/actions/runs/11509727553/job/32040378958?pr=15408#step:31:99
Clear the version number to avoid the confusion:
```
Could NOT find Libssh2 (missing: LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY)
```
https://github.com/curl/curl/actions/runs/11510022503/job/32041149129?pr=15408#step:31:99
Seen with CMake v3.30.5.
Follow-up to 7bab201abe #15193
Closes #15409
This commit is contained in:
parent
b8c12634fc
commit
aafc074f87
8 changed files with 8 additions and 0 deletions
|
|
@ -51,6 +51,7 @@ else()
|
|||
find_path(LIBIDN2_INCLUDE_DIR NAMES "idn2.h")
|
||||
find_library(LIBIDN2_LIBRARY NAMES "idn2" "libidn2")
|
||||
|
||||
unset(LIBIDN2_VERSION CACHE)
|
||||
if(LIBIDN2_INCLUDE_DIR AND EXISTS "${LIBIDN2_INCLUDE_DIR}/idn2.h")
|
||||
set(_version_regex "#[\t ]*define[\t ]+IDN2_VERSION[\t ]+\"([^\"]*)\"")
|
||||
file(STRINGS "${LIBIDN2_INCLUDE_DIR}/idn2.h" _version_str REGEX "${_version_regex}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue