mirror of
https://github.com/curl/curl.git
synced 2025-04-12 16:20:35 +08: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 7bab201abe3915a0167c002f9308950cb8a06e4b #15193 Closes #15409
This commit is contained in:
parent
b8c12634fc
commit
aafc074f87
@ -51,6 +51,7 @@ else()
|
||||
find_path(LIBGSASL_INCLUDE_DIR NAMES "gsasl.h")
|
||||
find_library(LIBGSASL_LIBRARY NAMES "gsasl" "libgsasl")
|
||||
|
||||
unset(LIBGSASL_VERSION CACHE)
|
||||
if(LIBGSASL_INCLUDE_DIR AND EXISTS "${LIBGSASL_INCLUDE_DIR}/gsasl-version.h")
|
||||
set(_version_regex "#[\t ]*define[\t ]+GSASL_VERSION[\t ]+\"([^\"]*)\"")
|
||||
file(STRINGS "${LIBGSASL_INCLUDE_DIR}/gsasl-version.h" _version_str REGEX "${_version_regex}")
|
||||
|
@ -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}")
|
||||
|
@ -51,6 +51,7 @@ else()
|
||||
find_path(LIBSSH_INCLUDE_DIR NAMES "libssh/libssh.h")
|
||||
find_library(LIBSSH_LIBRARY NAMES "ssh" "libssh")
|
||||
|
||||
unset(LIBSSH_VERSION CACHE)
|
||||
if(LIBSSH_INCLUDE_DIR AND EXISTS "${LIBSSH_INCLUDE_DIR}/libssh/libssh_version.h")
|
||||
set(_version_regex1 "#[\t ]*define[\t ]+LIBSSH_VERSION_MAJOR[\t ]+([0-9]+).*")
|
||||
set(_version_regex2 "#[\t ]*define[\t ]+LIBSSH_VERSION_MINOR[\t ]+([0-9]+).*")
|
||||
|
@ -51,6 +51,7 @@ else()
|
||||
find_path(LIBUV_INCLUDE_DIR NAMES "uv.h")
|
||||
find_library(LIBUV_LIBRARY NAMES "uv" "libuv")
|
||||
|
||||
unset(LIBUV_VERSION CACHE)
|
||||
if(LIBUV_INCLUDE_DIR AND EXISTS "${LIBUV_INCLUDE_DIR}/uv/version.h")
|
||||
set(_version_regex1 "#[\t ]*define[\t ]+UV_VERSION_MAJOR[\t ]+([0-9]+).*")
|
||||
set(_version_regex2 "#[\t ]*define[\t ]+UV_VERSION_MINOR[\t ]+([0-9]+).*")
|
||||
|
@ -67,6 +67,7 @@ else()
|
||||
find_library(MBEDX509_LIBRARY NAMES "mbedx509" "libmbedx509")
|
||||
find_library(MBEDCRYPTO_LIBRARY NAMES "mbedcrypto" "libmbedcrypto")
|
||||
|
||||
unset(MBEDTLS_VERSION CACHE)
|
||||
if(MBEDTLS_INCLUDE_DIR)
|
||||
if(EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h") # 3.x
|
||||
set(_version_header "${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h")
|
||||
|
@ -51,6 +51,7 @@ else()
|
||||
find_path(NETTLE_INCLUDE_DIR NAMES "nettle/sha2.h")
|
||||
find_library(NETTLE_LIBRARY NAMES "nettle")
|
||||
|
||||
unset(NETTLE_VERSION CACHE)
|
||||
if(NETTLE_INCLUDE_DIR AND EXISTS "${NETTLE_INCLUDE_DIR}/nettle/version.h")
|
||||
set(_version_regex1 "#[\t ]*define[ \t]+NETTLE_VERSION_MAJOR[ \t]+([0-9]+).*")
|
||||
set(_version_regex2 "#[\t ]*define[ \t]+NETTLE_VERSION_MINOR[ \t]+([0-9]+).*")
|
||||
|
@ -38,6 +38,7 @@
|
||||
find_path(WOLFSSH_INCLUDE_DIR NAMES "wolfssh/ssh.h")
|
||||
find_library(WOLFSSH_LIBRARY NAMES "wolfssh" "libwolfssh")
|
||||
|
||||
unset(WOLFSSH_VERSION CACHE)
|
||||
if(WOLFSSH_INCLUDE_DIR AND EXISTS "${WOLFSSH_INCLUDE_DIR}/wolfssh/version.h")
|
||||
set(_version_regex "#[\t ]*define[\t ]+LIBWOLFSSH_VERSION_STRING[\t ]+\"([^\"]*)\"")
|
||||
file(STRINGS "${WOLFSSH_INCLUDE_DIR}/wolfssh/version.h" _version_str REGEX "${_version_regex}")
|
||||
|
@ -60,6 +60,7 @@ else()
|
||||
find_path(WOLFSSL_INCLUDE_DIR NAMES "wolfssl/ssl.h")
|
||||
find_library(WOLFSSL_LIBRARY NAMES "wolfssl")
|
||||
|
||||
unset(WOLFSSL_VERSION CACHE)
|
||||
if(WOLFSSL_INCLUDE_DIR AND EXISTS "${WOLFSSL_INCLUDE_DIR}/wolfssl/version.h")
|
||||
set(_version_regex "#[\t ]*define[\t ]+LIBWOLFSSL_VERSION_STRING[\t ]+\"([^\"]*)\"")
|
||||
file(STRINGS "${WOLFSSL_INCLUDE_DIR}/wolfssl/version.h" _version_str REGEX "${_version_regex}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user