diff --git a/CMake/FindBrotli.cmake b/CMake/FindBrotli.cmake index 7e7a6e7322f6..8a692bda105f 100644 --- a/CMake/FindBrotli.cmake +++ b/CMake/FindBrotli.cmake @@ -35,16 +35,19 @@ # - `BROTLI_INCLUDE_DIRS`: The brotli include directories. # - `BROTLI_LIBRARIES`: The brotli library names. # - `BROTLI_LIBRARY_DIRS`: The brotli library directories. +# - `BROTLI_PC_REQUIRES`: The brotli pkg-config packages. # - `BROTLI_CFLAGS`: Required compiler flags. # - `BROTLI_VERSION`: Version of brotli. +set(BROTLI_PC_REQUIRES "libbrotlidec") + if(CURL_USE_PKGCONFIG AND NOT DEFINED BROTLI_INCLUDE_DIR AND NOT DEFINED BROTLICOMMON_LIBRARY AND NOT DEFINED BROTLIDEC_LIBRARY) find_package(PkgConfig QUIET) pkg_check_modules(BROTLI "libbrotlicommon") - pkg_check_modules(BROTLIDEC "libbrotlidec") + pkg_check_modules(BROTLIDEC ${BROTLI_PC_REQUIRES}) endif() if(BROTLI_FOUND AND BROTLIDEC_FOUND) diff --git a/CMake/FindCares.cmake b/CMake/FindCares.cmake index 28faab71292a..cd8de0cdde55 100644 --- a/CMake/FindCares.cmake +++ b/CMake/FindCares.cmake @@ -34,14 +34,17 @@ # - `CARES_INCLUDE_DIRS`: The c-ares include directories. # - `CARES_LIBRARIES`: The c-ares library names. # - `CARES_LIBRARY_DIRS`: The c-ares library directories. +# - `CARES_PC_REQUIRES`: The c-ares pkg-config packages. # - `CARES_CFLAGS`: Required compiler flags. # - `CARES_VERSION`: Version of c-ares. +set(CARES_PC_REQUIRES "libcares") + if(CURL_USE_PKGCONFIG AND NOT DEFINED CARES_INCLUDE_DIR AND NOT DEFINED CARES_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(CARES "libcares") + pkg_check_modules(CARES ${CARES_PC_REQUIRES}) endif() if(CARES_FOUND) diff --git a/CMake/FindLDAP.cmake b/CMake/FindLDAP.cmake index 07346206ea61..db4aad72dd39 100644 --- a/CMake/FindLDAP.cmake +++ b/CMake/FindLDAP.cmake @@ -39,12 +39,14 @@ # - `LDAP_CFLAGS`: Required compiler flags. # - `LDAP_VERSION`: Version of ldap. +set(LDAP_PC_REQUIRES "ldap") + if(CURL_USE_PKGCONFIG AND NOT DEFINED LDAP_INCLUDE_DIR AND NOT DEFINED LDAP_LIBRARY AND NOT DEFINED LDAP_LBER_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(LDAP "ldap") + pkg_check_modules(LDAP ${LDAP_PC_REQUIRES}) pkg_check_modules(LDAP_LBER "lber") endif() @@ -53,10 +55,11 @@ if(LDAP_FOUND AND LDAP_LBER_FOUND) list(REVERSE LDAP_LIBRARIES) list(REMOVE_DUPLICATES LDAP_LIBRARIES) list(REVERSE LDAP_LIBRARIES) - set(LDAP_PC_REQUIRES "ldap") string(REPLACE ";" " " LDAP_CFLAGS "${LDAP_CFLAGS}") message(STATUS "Found LDAP (via pkg-config): ${LDAP_INCLUDE_DIRS} (found version \"${LDAP_VERSION}\")") else() + set(LDAP_PC_REQUIRES "") # Depend on pkg-config only when found via pkg-config + # On Apple the SDK LDAP gets picked up from # 'MacOSX.sdk/System/Library/Frameworks/LDAP.framework/Headers', which contains # ldap.h and lber.h both being stubs to include and . diff --git a/CMake/FindLibgsasl.cmake b/CMake/FindLibgsasl.cmake index 82ed07edea99..c0ce67393fbc 100644 --- a/CMake/FindLibgsasl.cmake +++ b/CMake/FindLibgsasl.cmake @@ -34,14 +34,17 @@ # - `LIBGSASL_INCLUDE_DIRS`: The libgsasl include directories. # - `LIBGSASL_LIBRARIES`: The libgsasl library names. # - `LIBGSASL_LIBRARY_DIRS`: The libgsasl library directories. +# - `LIBGSASL_PC_REQUIRES`: The libgsasl pkg-config packages. # - `LIBGSASL_CFLAGS`: Required compiler flags. # - `LIBGSASL_VERSION`: Version of libgsasl. +set(LIBGSASL_PC_REQUIRES "libgsasl") + if(CURL_USE_PKGCONFIG AND NOT DEFINED LIBGSASL_INCLUDE_DIR AND NOT DEFINED LIBGSASL_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(LIBGSASL "libgsasl") + pkg_check_modules(LIBGSASL ${LIBGSASL_PC_REQUIRES}) endif() if(LIBGSASL_FOUND) diff --git a/CMake/FindLibidn2.cmake b/CMake/FindLibidn2.cmake index 35580ae28be5..a8887e8954f8 100644 --- a/CMake/FindLibidn2.cmake +++ b/CMake/FindLibidn2.cmake @@ -34,14 +34,17 @@ # - `LIBIDN2_INCLUDE_DIRS`: The libidn2 include directories. # - `LIBIDN2_LIBRARIES`: The libidn2 library names. # - `LIBIDN2_LIBRARY_DIRS`: The libidn2 library directories. +# - `LIBIDN2_PC_REQUIRES`: The libidn2 pkg-config packages. # - `LIBIDN2_CFLAGS`: Required compiler flags. # - `LIBIDN2_VERSION`: Version of libidn2. +set(LIBIDN2_PC_REQUIRES "libidn2") + if(CURL_USE_PKGCONFIG AND NOT DEFINED LIBIDN2_INCLUDE_DIR AND NOT DEFINED LIBIDN2_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(LIBIDN2 "libidn2") + pkg_check_modules(LIBIDN2 ${LIBIDN2_PC_REQUIRES}) endif() if(LIBIDN2_FOUND) diff --git a/CMake/FindLibpsl.cmake b/CMake/FindLibpsl.cmake index 0802174309d8..0d969951794f 100644 --- a/CMake/FindLibpsl.cmake +++ b/CMake/FindLibpsl.cmake @@ -34,14 +34,17 @@ # - `LIBPSL_INCLUDE_DIRS`: The libpsl include directories. # - `LIBPSL_LIBRARIES`: The libpsl library names. # - `LIBPSL_LIBRARY_DIRS`: The libpsl library directories. +# - `LIBPSL_PC_REQUIRES`: The libpsl pkg-config packages. # - `LIBPSL_CFLAGS`: Required compiler flags. # - `LIBPSL_VERSION`: Version of libpsl. +set(LIBPSL_PC_REQUIRES "libpsl") + if(CURL_USE_PKGCONFIG AND NOT DEFINED LIBPSL_INCLUDE_DIR AND NOT DEFINED LIBPSL_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(LIBPSL "libpsl") + pkg_check_modules(LIBPSL ${LIBPSL_PC_REQUIRES}) endif() if(LIBPSL_FOUND AND LIBPSL_INCLUDE_DIRS) diff --git a/CMake/FindLibssh.cmake b/CMake/FindLibssh.cmake index c4a0f622d515..b8b4a51a4a0d 100644 --- a/CMake/FindLibssh.cmake +++ b/CMake/FindLibssh.cmake @@ -34,14 +34,17 @@ # - `LIBSSH_INCLUDE_DIRS`: The libssh include directories. # - `LIBSSH_LIBRARIES`: The libssh library names. # - `LIBSSH_LIBRARY_DIRS`: The libssh library directories. +# - `LIBSSH_PC_REQUIRES`: The libssh pkg-config packages. # - `LIBSSH_CFLAGS`: Required compiler flags. # - `LIBSSH_VERSION`: Version of libssh. +set(LIBSSH_PC_REQUIRES "libssh") + if(CURL_USE_PKGCONFIG AND NOT DEFINED LIBSSH_INCLUDE_DIR AND NOT DEFINED LIBSSH_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(LIBSSH "libssh") + pkg_check_modules(LIBSSH ${LIBSSH_PC_REQUIRES}) endif() if(LIBSSH_FOUND) diff --git a/CMake/FindLibssh2.cmake b/CMake/FindLibssh2.cmake index 74480efec45d..dfb0582a8be9 100644 --- a/CMake/FindLibssh2.cmake +++ b/CMake/FindLibssh2.cmake @@ -34,14 +34,17 @@ # - `LIBSSH2_INCLUDE_DIRS`: The libssh2 include directories. # - `LIBSSH2_LIBRARIES`: The libssh2 library names. # - `LIBSSH2_LIBRARY_DIRS`: The libssh2 library directories. +# - `LIBSSH2_PC_REQUIRES`: The libssh2 pkg-config packages. # - `LIBSSH2_CFLAGS`: Required compiler flags. # - `LIBSSH2_VERSION`: Version of libssh2. +set(LIBSSH2_PC_REQUIRES "libssh2") + if(CURL_USE_PKGCONFIG AND NOT DEFINED LIBSSH2_INCLUDE_DIR AND NOT DEFINED LIBSSH2_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(LIBSSH2 "libssh2") + pkg_check_modules(LIBSSH2 ${LIBSSH2_PC_REQUIRES}) endif() if(LIBSSH2_FOUND AND LIBSSH2_INCLUDE_DIRS) diff --git a/CMake/FindLibuv.cmake b/CMake/FindLibuv.cmake index d647e3438f69..8255eaa13569 100644 --- a/CMake/FindLibuv.cmake +++ b/CMake/FindLibuv.cmake @@ -34,14 +34,17 @@ # - `LIBUV_INCLUDE_DIRS`: The libuv include directories. # - `LIBUV_LIBRARIES`: The libuv library names. # - `LIBUV_LIBRARY_DIRS`: The libuv library directories. +# - `LIBUV_PC_REQUIRES`: The libuv pkg-config packages. # - `LIBUV_CFLAGS`: Required compiler flags. # - `LIBUV_VERSION`: Version of libuv. +set(LIBUV_PC_REQUIRES "libuv") + if(CURL_USE_PKGCONFIG AND NOT DEFINED LIBUV_INCLUDE_DIR AND NOT DEFINED LIBUV_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(LIBUV "libuv") + pkg_check_modules(LIBUV ${LIBUV_PC_REQUIRES}) endif() if(LIBUV_FOUND) diff --git a/CMake/FindMSH3.cmake b/CMake/FindMSH3.cmake index 387d30b24e01..da38d458236a 100644 --- a/CMake/FindMSH3.cmake +++ b/CMake/FindMSH3.cmake @@ -38,18 +38,21 @@ # - `MSH3_CFLAGS`: Required compiler flags. # - `MSH3_VERSION`: Version of msh3. +set(MSH3_PC_REQUIRES "libmsh3") + if(CURL_USE_PKGCONFIG AND NOT DEFINED MSH3_INCLUDE_DIR AND NOT DEFINED MSH3_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(MSH3 "libmsh3") + pkg_check_modules(MSH3 ${MSH3_PC_REQUIRES}) endif() if(MSH3_FOUND) - set(MSH3_PC_REQUIRES "libmsh3") string(REPLACE ";" " " MSH3_CFLAGS "${MSH3_CFLAGS}") message(STATUS "Found MSH3 (via pkg-config): ${MSH3_INCLUDE_DIRS} (found version \"${MSH3_VERSION}\")") else() + set(MSH3_PC_REQUIRES "") # Depend on pkg-config only when found via pkg-config + find_path(MSH3_INCLUDE_DIR NAMES "msh3.h") find_library(MSH3_LIBRARY NAMES "msh3") diff --git a/CMake/FindMbedTLS.cmake b/CMake/FindMbedTLS.cmake index 21d47e0bba2a..c3ba27d8a7e6 100644 --- a/CMake/FindMbedTLS.cmake +++ b/CMake/FindMbedTLS.cmake @@ -46,13 +46,15 @@ if(DEFINED MBEDTLS_INCLUDE_DIRS AND NOT DEFINED MBEDTLS_INCLUDE_DIR) unset(MBEDTLS_INCLUDE_DIRS) endif() +set(MBEDTLS_PC_REQUIRES "mbedtls") + if(CURL_USE_PKGCONFIG AND NOT DEFINED MBEDTLS_INCLUDE_DIR AND NOT DEFINED MBEDTLS_LIBRARY AND NOT DEFINED MBEDX509_LIBRARY AND NOT DEFINED MBEDCRYPTO_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(MBEDTLS "mbedtls") + pkg_check_modules(MBEDTLS ${MBEDTLS_PC_REQUIRES}) pkg_check_modules(MBEDX509 "mbedx509") pkg_check_modules(MBEDCRYPTO "mbedcrypto") endif() @@ -62,10 +64,11 @@ if(MBEDTLS_FOUND AND MBEDX509_FOUND AND MBEDCRYPTO_FOUND) list(REVERSE MBEDTLS_LIBRARIES) list(REMOVE_DUPLICATES MBEDTLS_LIBRARIES) list(REVERSE MBEDTLS_LIBRARIES) - set(MBEDTLS_PC_REQUIRES "mbedtls") string(REPLACE ";" " " MBEDTLS_CFLAGS "${MBEDTLS_CFLAGS}") message(STATUS "Found MbedTLS (via pkg-config): ${MBEDTLS_INCLUDE_DIRS} (found version \"${MBEDTLS_VERSION}\")") else() + set(MBEDTLS_PC_REQUIRES "") # Depend on pkg-config only when found via pkg-config + find_path(MBEDTLS_INCLUDE_DIR NAMES "mbedtls/ssl.h") find_library(MBEDTLS_LIBRARY NAMES "mbedtls" "libmbedtls") find_library(MBEDX509_LIBRARY NAMES "mbedx509" "libmbedx509") diff --git a/CMake/FindNGHTTP2.cmake b/CMake/FindNGHTTP2.cmake index d9f5c0dd6316..b8f37fdaebf1 100644 --- a/CMake/FindNGHTTP2.cmake +++ b/CMake/FindNGHTTP2.cmake @@ -34,14 +34,17 @@ # - `NGHTTP2_INCLUDE_DIRS`: The nghttp2 include directories. # - `NGHTTP2_LIBRARIES`: The nghttp2 library names. # - `NGHTTP2_LIBRARY_DIRS`: The nghttp2 library directories. +# - `NGHTTP2_PC_REQUIRES`: The nghttp2 pkg-config packages. # - `NGHTTP2_CFLAGS`: Required compiler flags. # - `NGHTTP2_VERSION`: Version of nghttp2. +set(NGHTTP2_PC_REQUIRES "libnghttp2") + if(CURL_USE_PKGCONFIG AND NOT DEFINED NGHTTP2_INCLUDE_DIR AND NOT DEFINED NGHTTP2_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(NGHTTP2 "libnghttp2") + pkg_check_modules(NGHTTP2 ${NGHTTP2_PC_REQUIRES}) endif() if(NGHTTP2_FOUND) diff --git a/CMake/FindNGHTTP3.cmake b/CMake/FindNGHTTP3.cmake index 6002c16771be..99edd19955ed 100644 --- a/CMake/FindNGHTTP3.cmake +++ b/CMake/FindNGHTTP3.cmake @@ -34,14 +34,17 @@ # - `NGHTTP3_INCLUDE_DIRS`: The nghttp3 include directories. # - `NGHTTP3_LIBRARIES`: The nghttp3 library names. # - `NGHTTP3_LIBRARY_DIRS`: The nghttp3 library directories. +# - `NGHTTP3_PC_REQUIRES`: The nghttp3 pkg-config packages. # - `NGHTTP3_CFLAGS`: Required compiler flags. # - `NGHTTP3_VERSION`: Version of nghttp3. +set(NGHTTP3_PC_REQUIRES "libnghttp3") + if(CURL_USE_PKGCONFIG AND NOT DEFINED NGHTTP3_INCLUDE_DIR AND NOT DEFINED NGHTTP3_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(NGHTTP3 "libnghttp3") + pkg_check_modules(NGHTTP3 ${NGHTTP3_PC_REQUIRES}) endif() if(NGHTTP3_FOUND) diff --git a/CMake/FindNGTCP2.cmake b/CMake/FindNGTCP2.cmake index 332e266a3b13..0cbb3484d1ef 100644 --- a/CMake/FindNGTCP2.cmake +++ b/CMake/FindNGTCP2.cmake @@ -42,6 +42,7 @@ # - `NGTCP2_INCLUDE_DIRS`: The ngtcp2 include directories. # - `NGTCP2_LIBRARIES`: The ngtcp2 library names. # - `NGTCP2_LIBRARY_DIRS`: The ngtcp2 library directories. +# - `NGTCP2_PC_REQUIRES`: The ngtcp2 pkg-config packages. # - `NGTCP2_CFLAGS`: Required compiler flags. # - `NGTCP2_VERSION`: Version of ngtcp2. @@ -62,18 +63,25 @@ if(NGTCP2_FIND_COMPONENTS) endif() endif() +set(NGTCP2_PC_REQUIRES "libngtcp2") +if(_ngtcp2_crypto_backend) + set(NGTCP2_CRYPTO_PC_REQUIRES "lib${_crypto_library_lower}") +endif() + if(CURL_USE_PKGCONFIG AND NOT DEFINED NGTCP2_INCLUDE_DIR AND NOT DEFINED NGTCP2_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(NGTCP2 "libngtcp2") + pkg_check_modules(NGTCP2 ${NGTCP2_PC_REQUIRES}) if(_ngtcp2_crypto_backend) - pkg_check_modules("${_crypto_library_upper}" "lib${_crypto_library_lower}") + pkg_check_modules("${_crypto_library_upper}" ${NGTCP2_CRYPTO_PC_REQUIRES}) else() set("${_crypto_library_upper}_FOUND" TRUE) endif() endif() +list(APPEND NGTCP2_PC_REQUIRES ${NGTCP2_CRYPTO_PC_REQUIRES}) + if(NGTCP2_FOUND AND "${${_crypto_library_upper}_FOUND}") list(APPEND NGTCP2_LIBRARIES "${${_crypto_library_upper}_LIBRARIES}") list(REMOVE_DUPLICATES NGTCP2_LIBRARIES) diff --git a/CMake/FindNettle.cmake b/CMake/FindNettle.cmake index 56f2a940b304..753633a23e4c 100644 --- a/CMake/FindNettle.cmake +++ b/CMake/FindNettle.cmake @@ -34,14 +34,17 @@ # - `NETTLE_INCLUDE_DIRS`: The nettle include directories. # - `NETTLE_LIBRARIES`: The nettle library names. # - `NETTLE_LIBRARY_DIRS`: The nettle library directories. +# - `NETTLE_PC_REQUIRES`: The nettle pkg-config packages. # - `NETTLE_CFLAGS`: Required compiler flags. # - `NETTLE_VERSION`: Version of nettle. +set(NETTLE_PC_REQUIRES "nettle") + if(CURL_USE_PKGCONFIG AND NOT DEFINED NETTLE_INCLUDE_DIR AND NOT DEFINED NETTLE_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(NETTLE "nettle") + pkg_check_modules(NETTLE ${NETTLE_PC_REQUIRES}) endif() if(NETTLE_FOUND) diff --git a/CMake/FindQuiche.cmake b/CMake/FindQuiche.cmake index 6db5cb0c1c07..092aff89e50b 100644 --- a/CMake/FindQuiche.cmake +++ b/CMake/FindQuiche.cmake @@ -34,14 +34,17 @@ # - `QUICHE_INCLUDE_DIRS`: The quiche include directories. # - `QUICHE_LIBRARIES`: The quiche library names. # - `QUICHE_LIBRARY_DIRS`: The quiche library directories. +# - `QUICHE_PC_REQUIRES`: The quiche pkg-config packages. # - `QUICHE_CFLAGS`: Required compiler flags. # - `QUICHE_VERSION`: Version of quiche. +set(QUICHE_PC_REQUIRES "quiche") + if(CURL_USE_PKGCONFIG AND NOT DEFINED QUICHE_INCLUDE_DIR AND NOT DEFINED QUICHE_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(QUICHE "quiche") + pkg_check_modules(QUICHE ${QUICHE_PC_REQUIRES}) endif() if(QUICHE_FOUND) diff --git a/CMake/FindRustls.cmake b/CMake/FindRustls.cmake index db0e153f3bb7..faf178ad3b88 100644 --- a/CMake/FindRustls.cmake +++ b/CMake/FindRustls.cmake @@ -38,18 +38,21 @@ # - `RUSTLS_CFLAGS`: Required compiler flags. # - `RUSTLS_VERSION`: Version of Rustls. +set(RUSTLS_PC_REQUIRES "rustls") + if(CURL_USE_PKGCONFIG AND NOT DEFINED RUSTLS_INCLUDE_DIR AND NOT DEFINED RUSTLS_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(RUSTLS "rustls") + pkg_check_modules(RUSTLS ${RUSTLS_PC_REQUIRES}) endif() if(RUSTLS_FOUND) - set(RUSTLS_PC_REQUIRES "rustls") string(REPLACE ";" " " RUSTLS_CFLAGS "${RUSTLS_CFLAGS}") message(STATUS "Found Rustls (via pkg-config): ${RUSTLS_INCLUDE_DIRS} (found version \"${RUSTLS_VERSION}\")") else() + set(RUSTLS_PC_REQUIRES "") # Depend on pkg-config only when found via pkg-config + find_path(RUSTLS_INCLUDE_DIR NAMES "rustls.h") find_library(RUSTLS_LIBRARY NAMES "rustls") diff --git a/CMake/FindWolfSSL.cmake b/CMake/FindWolfSSL.cmake index 8f6f96462f70..577a34c33aa3 100644 --- a/CMake/FindWolfSSL.cmake +++ b/CMake/FindWolfSSL.cmake @@ -34,6 +34,7 @@ # - `WOLFSSL_INCLUDE_DIRS`: The wolfSSL include directories. # - `WOLFSSL_LIBRARIES`: The wolfSSL library names. # - `WOLFSSL_LIBRARY_DIRS`: The wolfSSL library directories. +# - `WOLFSSL_PC_REQUIRES`: The wolfSSL pkg-config packages. # - `WOLFSSL_CFLAGS`: Required compiler flags. # - `WOLFSSL_VERSION`: Version of wolfSSL. @@ -46,11 +47,13 @@ if(DEFINED WolfSSL_LIBRARY AND NOT DEFINED WOLFSSL_LIBRARY) set(WOLFSSL_LIBRARY "${WolfSSL_LIBRARY}") endif() +set(WOLFSSL_PC_REQUIRES "wolfssl") + if(CURL_USE_PKGCONFIG AND NOT DEFINED WOLFSSL_INCLUDE_DIR AND NOT DEFINED WOLFSSL_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(WOLFSSL "wolfssl") + pkg_check_modules(WOLFSSL ${WOLFSSL_PC_REQUIRES}) endif() if(WOLFSSL_FOUND) diff --git a/CMake/FindZstd.cmake b/CMake/FindZstd.cmake index a99f25aa03b5..dbfede708bdb 100644 --- a/CMake/FindZstd.cmake +++ b/CMake/FindZstd.cmake @@ -34,6 +34,7 @@ # - `ZSTD_INCLUDE_DIRS`: The zstd include directories. # - `ZSTD_LIBRARIES`: The zstd library names. # - `ZSTD_LIBRARY_DIRS`: The zstd library directories. +# - `ZSTD_PC_REQUIRES`: The zstd pkg-config packages. # - `ZSTD_CFLAGS`: Required compiler flags. # - `ZSTD_VERSION`: Version of zstd. @@ -46,11 +47,13 @@ if(DEFINED Zstd_LIBRARY AND NOT DEFINED ZSTD_LIBRARY) set(ZSTD_LIBRARY "${Zstd_LIBRARY}") endif() +set(ZSTD_PC_REQUIRES "libzstd") + if(CURL_USE_PKGCONFIG AND NOT DEFINED ZSTD_INCLUDE_DIR AND NOT DEFINED ZSTD_LIBRARY) find_package(PkgConfig QUIET) - pkg_check_modules(ZSTD "libzstd") + pkg_check_modules(ZSTD ${ZSTD_PC_REQUIRES}) endif() if(ZSTD_FOUND) diff --git a/CMakeLists.txt b/CMakeLists.txt index 197e94a0eb1c..9078db42fb9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -296,7 +296,7 @@ if(ENABLE_ARES) find_package(Cares REQUIRED) list(APPEND CURL_LIBS ${CARES_LIBRARIES}) list(APPEND CURL_LIBDIRS ${CARES_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libcares") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${CARES_PC_REQUIRES}) link_directories(${CARES_LIBRARY_DIRS}) if(CARES_CFLAGS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CARES_CFLAGS}") @@ -748,7 +748,7 @@ if(CURL_USE_WOLFSSL) set(USE_WOLFSSL ON) list(APPEND CURL_LIBS ${WOLFSSL_LIBRARIES}) list(APPEND CURL_LIBDIRS ${WOLFSSL_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "wolfssl") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${WOLFSSL_PC_REQUIRES}) include_directories(SYSTEM ${WOLFSSL_INCLUDE_DIRS}) link_directories(${WOLFSSL_LIBRARY_DIRS}) if(WOLFSSL_CFLAGS) @@ -777,7 +777,7 @@ if(CURL_USE_GNUTLS) set(USE_GNUTLS ON) list(APPEND CURL_LIBS ${GNUTLS_LIBRARIES} ${NETTLE_LIBRARIES}) list(APPEND CURL_LIBDIRS ${NETTLE_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "gnutls" "nettle") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "gnutls" ${NETTLE_PC_REQUIRES}) include_directories(SYSTEM ${GNUTLS_INCLUDE_DIRS} ${NETTLE_INCLUDE_DIRS}) link_directories(${NETTLE_LIBRARY_DIRS}) if(NETTLE_CFLAGS) @@ -840,7 +840,7 @@ if(BROTLI_FOUND) set(HAVE_BROTLI ON) list(APPEND CURL_LIBS ${BROTLI_LIBRARIES}) list(APPEND CURL_LIBDIRS ${BROTLI_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libbrotlidec") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${BROTLI_PC_REQUIRES}) include_directories(SYSTEM ${BROTLI_INCLUDE_DIRS}) link_directories(${BROTLI_LIBRARY_DIRS}) if(BROTLI_CFLAGS) @@ -855,7 +855,7 @@ if(ZSTD_FOUND) set(HAVE_ZSTD ON) list(APPEND CURL_LIBS ${ZSTD_LIBRARIES}) list(APPEND CURL_LIBDIRS ${ZSTD_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libzstd") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${ZSTD_PC_REQUIRES}) include_directories(SYSTEM ${ZSTD_INCLUDE_DIRS}) link_directories(${ZSTD_LIBRARY_DIRS}) if(ZSTD_CFLAGS) @@ -967,7 +967,7 @@ if(USE_NGHTTP2) if(NGHTTP2_FOUND) list(APPEND CURL_LIBS ${NGHTTP2_LIBRARIES}) list(APPEND CURL_LIBDIRS ${NGHTTP2_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libnghttp2") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${NGHTTP2_PC_REQUIRES}) include_directories(SYSTEM ${NGHTTP2_INCLUDE_DIRS}) link_directories(${NGHTTP2_LIBRARY_DIRS}) if(NGHTTP2_CFLAGS) @@ -983,13 +983,10 @@ if(USE_NGTCP2) if(USE_OPENSSL OR USE_WOLFSSL) if(USE_WOLFSSL) find_package(NGTCP2 REQUIRED "wolfSSL") - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_wolfssl") elseif(HAVE_BORINGSSL OR HAVE_AWSLC) find_package(NGTCP2 REQUIRED "BoringSSL") - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_boringssl") else() find_package(NGTCP2 REQUIRED "quictls") - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_quictls") if(NOT HAVE_LIBRESSL) set(_openssl "quictls") endif() @@ -997,13 +994,12 @@ if(USE_NGTCP2) curl_openssl_check_quic() elseif(USE_GNUTLS) find_package(NGTCP2 REQUIRED "GnuTLS") - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_gnutls") else() message(FATAL_ERROR "ngtcp2 requires OpenSSL, wolfSSL or GnuTLS") endif() list(APPEND CURL_LIBS ${NGTCP2_LIBRARIES}) list(APPEND CURL_LIBDIRS ${NGTCP2_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${NGTCP2_PC_REQUIRES}) include_directories(SYSTEM ${NGTCP2_INCLUDE_DIRS}) link_directories(${NGTCP2_LIBRARY_DIRS}) if(NGTCP2_CFLAGS) @@ -1014,7 +1010,7 @@ if(USE_NGTCP2) set(USE_NGHTTP3 ON) list(APPEND CURL_LIBS ${NGHTTP3_LIBRARIES}) list(APPEND CURL_LIBDIRS ${NGHTTP3_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libnghttp3") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${NGHTTP3_PC_REQUIRES}) include_directories(SYSTEM ${NGHTTP3_INCLUDE_DIRS}) link_directories(${NGHTTP3_LIBRARY_DIRS}) if(NGHTTP3_CFLAGS) @@ -1034,7 +1030,7 @@ if(USE_QUICHE) curl_openssl_check_quic() list(APPEND CURL_LIBS ${QUICHE_LIBRARIES}) list(APPEND CURL_LIBDIRS ${QUICHE_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "quiche") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${QUICHE_PC_REQUIRES}) include_directories(SYSTEM ${QUICHE_INCLUDE_DIRS}) link_directories(${QUICHE_LIBRARY_DIRS}) if(QUICHE_CFLAGS) @@ -1081,7 +1077,7 @@ if(USE_OPENSSL_QUIC) set(USE_NGHTTP3 ON) include_directories(SYSTEM ${NGHTTP3_INCLUDE_DIRS}) list(APPEND CURL_LIBS ${NGHTTP3_LIBRARIES}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libnghttp3") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${NGHTTP3_PC_REQUIRES}) endif() if(CURL_WITH_MULTI_SSL AND (USE_NGTCP2 OR USE_QUICHE OR USE_MSH3 OR USE_OPENSSL_QUIC)) @@ -1193,7 +1189,7 @@ if(USE_LIBIDN2 AND NOT USE_APPLE_IDN AND NOT USE_WIN32_IDN) if(LIBIDN2_FOUND) set(CURL_LIBS "${LIBIDN2_LIBRARIES};${CURL_LIBS}") list(APPEND CURL_LIBDIRS ${LIBIDN2_LIBRARY_DIRS}) - set(LIBCURL_PC_REQUIRES_PRIVATE "libidn2;${LIBCURL_PC_REQUIRES_PRIVATE}") + set(LIBCURL_PC_REQUIRES_PRIVATE "${LIBIDN2_PC_REQUIRES};${LIBCURL_PC_REQUIRES_PRIVATE}") include_directories(SYSTEM ${LIBIDN2_INCLUDE_DIRS}) link_directories(${LIBIDN2_LIBRARY_DIRS}) if(LIBIDN2_CFLAGS) @@ -1213,7 +1209,7 @@ if(CURL_USE_LIBPSL) find_package(Libpsl REQUIRED) list(APPEND CURL_LIBS ${LIBPSL_LIBRARIES}) list(APPEND CURL_LIBDIRS ${LIBPSL_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libpsl") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${LIBPSL_PC_REQUIRES}) include_directories(SYSTEM ${LIBPSL_INCLUDE_DIRS}) link_directories(${LIBPSL_LIBRARY_DIRS}) if(LIBPSL_CFLAGS) @@ -1232,7 +1228,7 @@ if(CURL_USE_LIBSSH2) if(LIBSSH2_FOUND) list(APPEND CURL_LIBS ${LIBSSH2_LIBRARIES}) list(APPEND CURL_LIBDIRS ${LIBSSH2_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libssh2") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${LIBSSH2_PC_REQUIRES}) include_directories(SYSTEM ${LIBSSH2_INCLUDE_DIRS}) link_directories(${LIBSSH2_LIBRARY_DIRS}) if(LIBSSH2_CFLAGS) @@ -1249,7 +1245,7 @@ if(NOT USE_LIBSSH2 AND CURL_USE_LIBSSH) find_package(Libssh REQUIRED) list(APPEND CURL_LIBS ${LIBSSH_LIBRARIES}) list(APPEND CURL_LIBDIRS ${LIBSSH_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libssh") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${LIBSSH_PC_REQUIRES}) include_directories(SYSTEM ${LIBSSH_INCLUDE_DIRS}) link_directories(${LIBSSH_LIBRARY_DIRS}) if(LIBSSH_CFLAGS) @@ -1281,7 +1277,7 @@ if(CURL_USE_GSASL) find_package(Libgsasl REQUIRED) list(APPEND CURL_LIBS ${LIBGSASL_LIBRARIES}) list(APPEND CURL_LIBDIRS ${LIBGSASL_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libgsasl") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${LIBGSASL_PC_REQUIRES}) include_directories(SYSTEM ${LIBGSASL_INCLUDE_DIRS}) link_directories(${LIBGSASL_LIBRARY_DIRS}) if(LIBGSASL_CFLAGS) @@ -1356,7 +1352,7 @@ if(CURL_USE_LIBUV) find_package(Libuv REQUIRED) list(APPEND CURL_LIBS ${LIBUV_LIBRARIES}) list(APPEND CURL_LIBDIRS ${LIBUV_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libuv") + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${LIBUV_PC_REQUIRES}) include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS}) link_directories(${LIBUV_LIBRARY_DIRS}) if(LIBUV_CFLAGS)