8000 cmake/Find*: clear package version after `pkg-config` detection · ParallelSSH/libssh2@d4e43c7 · GitHub
[go: up one dir, main page]

Skip to content

Commit d4e43c7

Browse files
committed
cmake/Find*: 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 Libgcrypt (missing: LIBGCRYPT_INCLUDE_DIR LIBGCRYPT_LIBRARY) (found version "") ``` Clear the version number to avoid the confusion: ``` Could NOT find Libgcrypt (missing: LIBGCRYPT_INCLUDE_DIR LIBGCRYPT_LIBRARY) ``` Seen with CMake v3.30.3 and 3.30.5. Closes libssh2#1479
1 parent ac00f6c commit d4e43c7

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

cmake/FindLibgcrypt.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ else()
3232
find_path(LIBGCRYPT_INCLUDE_DIR NAMES "gcrypt.h")
3333
find_library(LIBGCRYPT_LIBRARY NAMES "gcrypt" "libgcrypt")
3434

35+
unset(LIBGCRYPT_VERSION CACHE)
3536
if(LIBGCRYPT_INCLUDE_DIR AND EXISTS "${LIBGCRYPT_INCLUDE_DIR}/gcrypt.h")
3637
set(_version_regex "#[\t ]*define[\t ]+GCRYPT_VERSION[\t ]+\"([^\"]*)\"")
3738
file(STRINGS "${LIBGCRYPT_INCLUDE_DIR}/gcrypt.h" _version_str REGEX "${_version_regex}")

cmake/FindMbedTLS.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ else()
3232
find_path(MBEDTLS_INCLUDE_DIR NAMES "mbedtls/version.h")
3333
find_library(MBEDCRYPTO_LIBRARY NAMES "mbedcrypto" "libmbedcrypto")
3434

35+
unset(MBEDTLS_VERSION CACHE)
3536
if(MBEDTLS_INCLUDE_DIR)
3637
if(EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h") # 3.x
3738
set(_version_header "${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h")

cmake/FindWolfSSL.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ else()
3232
find_path(WOLFSSL_INCLUDE_DIR NAMES "wolfssl/options.h")
3333
find_library(WOLFSSL_LIBRARY NAMES "wolfssl")
3434

35+
unset(WOLFSSL_VERSION CACHE)
3536
if(WOLFSSL_INCLUDE_DIR AND EXISTS "${WOLFSSL_INCLUDE_DIR}/wolfssl/version.h")
3637
set(_version_regex "#[\t ]*define[\t ]+LIBWOLFSSL_VERSION_STRING[\t ]+\"([^\"]*)\"")
3738
file(STRINGS "${WOLFSSL_INCLUDE_DIR}/wolfssl/version.h" _version_str REGEX "${_version_regex}")

0 commit comments

Comments
 (0)
0