cmake: sync up formatting in Find modules

- lowercase internal variable names (FindGSS)
- comments
- whitespace

Closes #14527
This commit is contained in:
Viktor Szakats 2024-08-13 10:45:37 +02:00
parent 1a444e3153
commit 8ae7049f4b
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
14 changed files with 32 additions and 48 deletions

View File

@ -29,13 +29,12 @@
# BROTLI_INCLUDE_DIRS The brotli include directories # BROTLI_INCLUDE_DIRS The brotli include directories
# BROTLI_LIBRARIES The brotli library names # BROTLI_LIBRARIES The brotli library names
include(FindPackageHandleStandardArgs)
find_path(BROTLI_INCLUDE_DIR "brotli/decode.h") find_path(BROTLI_INCLUDE_DIR "brotli/decode.h")
find_library(BROTLICOMMON_LIBRARY NAMES "brotlicommon") find_library(BROTLICOMMON_LIBRARY NAMES "brotlicommon")
find_library(BROTLIDEC_LIBRARY NAMES "brotlidec") find_library(BROTLIDEC_LIBRARY NAMES "brotlidec")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Brotli find_package_handle_standard_args(Brotli
FOUND_VAR FOUND_VAR
BROTLI_FOUND BROTLI_FOUND

View File

@ -31,9 +31,7 @@
find_path(CARES_INCLUDE_DIR "ares.h") find_path(CARES_INCLUDE_DIR "ares.h")
find_library(CARES_LIBRARY find_library(CARES_LIBRARY NAMES ${CARES_NAMES} "cares")
NAMES ${CARES_NAMES} "cares"
)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CARES find_package_handle_standard_args(CARES

View File

@ -31,8 +31,8 @@
# #
# GSS_FOUND System has the Heimdal library # GSS_FOUND System has the Heimdal library
# GSS_FLAVOUR "MIT" or "Heimdal" if anything found # GSS_FLAVOUR "MIT" or "Heimdal" if anything found
# GSS_INCLUDE_DIR the Heimdal include directory # GSS_INCLUDE_DIR The GSS include directory
# GSS_LIBRARIES The libraries needed to use GSS # GSS_LIBRARIES The GSS library names
# GSS_LINK_DIRECTORIES Directories to add to linker search path # GSS_LINK_DIRECTORIES Directories to add to linker search path
# GSS_LINKER_FLAGS Additional linker flags # GSS_LINKER_FLAGS Additional linker flags
# GSS_COMPILER_FLAGS Additional compiler flags # GSS_COMPILER_FLAGS Additional compiler flags
@ -166,9 +166,7 @@ if(NOT _GSS_FOUND) # Not found by pkg-config. Let us take more traditional appr
else() # Either there is no config script or we are on a platform that does not provide one (Windows?) else() # Either there is no config script or we are on a platform that does not provide one (Windows?)
find_path(_GSS_INCLUDE_DIRS find_path(_GSS_INCLUDE_DIRS NAMES "gssapi/gssapi.h"
NAMES
"gssapi/gssapi.h"
HINTS HINTS
${_gss_root_hints} ${_gss_root_hints}
PATH_SUFFIXES PATH_SUFFIXES
@ -178,26 +176,24 @@ if(NOT _GSS_FOUND) # Not found by pkg-config. Let us take more traditional appr
if(_GSS_INCLUDE_DIRS) # jay, we have found something if(_GSS_INCLUDE_DIRS) # jay, we have found something
set(CMAKE_REQUIRED_INCLUDES "${_GSS_INCLUDE_DIRS}") set(CMAKE_REQUIRED_INCLUDES "${_GSS_INCLUDE_DIRS}")
check_include_files("gssapi/gssapi_generic.h;gssapi/gssapi_krb5.h" _GSS_HAVE_MIT_HEADERS) check_include_files("gssapi/gssapi_generic.h;gssapi/gssapi_krb5.h" _gss_have_mit_headers)
if(_GSS_HAVE_MIT_HEADERS) if(_gss_have_mit_headers)
set(GSS_FLAVOUR "MIT") set(GSS_FLAVOUR "MIT")
else() else()
# Prevent compiling the header - just check if we can include it # Prevent compiling the header - just check if we can include it
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D__ROKEN_H__") list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D__ROKEN_H__")
check_include_file("roken.h" _GSS_HAVE_ROKEN_H) check_include_file("roken.h" _gss_have_roken_h)
check_include_file("heimdal/roken.h" _GSS_HAVE_HEIMDAL_ROKEN_H) check_include_file("heimdal/roken.h" _gss_have_heimdal_roken_h)
if(_GSS_HAVE_ROKEN_H OR _GSS_HAVE_HEIMDAL_ROKEN_H) if(_gss_have_roken_h OR _gss_have_heimdal_roken_h)
set(GSS_FLAVOUR "Heimdal") set(GSS_FLAVOUR "Heimdal")
endif() endif()
list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS "-D__ROKEN_H__") list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS "-D__ROKEN_H__")
endif() endif()
else() else()
# I am not convinced if this is the right way but this is what autotools do at the moment # I am not convinced if this is the right way but this is what autotools do at the moment
find_path(_GSS_INCLUDE_DIRS find_path(_GSS_INCLUDE_DIRS NAMES "gssapi.h"
NAMES
"gssapi.h"
HINTS HINTS
${_gss_root_hints} ${_gss_root_hints}
PATH_SUFFIXES PATH_SUFFIXES
@ -242,9 +238,7 @@ if(NOT _GSS_FOUND) # Not found by pkg-config. Let us take more traditional appr
endif() endif()
endif() endif()
find_library(_GSS_LIBRARIES find_library(_GSS_LIBRARIES NAMES ${_gss_libname}
NAMES
${_gss_libname}
HINTS HINTS
${_gss_libdir_hints} ${_gss_libdir_hints}
PATH_SUFFIXES PATH_SUFFIXES
@ -302,7 +296,6 @@ if(GSS_FLAVOUR)
endif() endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GSS find_package_handle_standard_args(GSS
REQUIRED_VARS REQUIRED_VARS
GSS_LIBRARIES GSS_FLAVOUR GSS_LIBRARIES GSS_FLAVOUR

View File

@ -36,7 +36,7 @@ find_library(LIBPSL_LIBRARY NAMES "psl" "libpsl")
if(LIBPSL_INCLUDE_DIR) if(LIBPSL_INCLUDE_DIR)
file(STRINGS "${LIBPSL_INCLUDE_DIR}/libpsl.h" _libpsl_version_str REGEX "^#define[\t ]+PSL_VERSION[\t ]+\"(.*)\"") file(STRINGS "${LIBPSL_INCLUDE_DIR}/libpsl.h" _libpsl_version_str REGEX "^#define[\t ]+PSL_VERSION[\t ]+\"(.*)\"")
string(REGEX REPLACE "^.*\"([^\"]+)\"" "\\1" LIBPSL_VERSION "${_libpsl_version_str}") string(REGEX REPLACE "^.*\"([^\"]+)\"" "\\1" LIBPSL_VERSION "${_libpsl_version_str}")
endif() endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)

View File

@ -36,7 +36,7 @@ find_library(LIBSSH2_LIBRARY NAMES "ssh2" "libssh2")
if(LIBSSH2_INCLUDE_DIR) if(LIBSSH2_INCLUDE_DIR)
file(STRINGS "${LIBSSH2_INCLUDE_DIR}/libssh2.h" _libssh2_version_str REGEX "^#define[\t ]+LIBSSH2_VERSION[\t ]+\"(.*)\"") file(STRINGS "${LIBSSH2_INCLUDE_DIR}/libssh2.h" _libssh2_version_str REGEX "^#define[\t ]+LIBSSH2_VERSION[\t ]+\"(.*)\"")
string(REGEX REPLACE "^.*\"([^\"]+)\"" "\\1" LIBSSH2_VERSION "${_libssh2_version_str}") string(REGEX REPLACE "^.*\"([^\"]+)\"" "\\1" LIBSSH2_VERSION "${_libssh2_version_str}")
endif() endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)

View File

@ -27,7 +27,7 @@
# #
# MSH3_FOUND System has msh3 # MSH3_FOUND System has msh3
# MSH3_INCLUDE_DIRS The msh3 include directories # MSH3_INCLUDE_DIRS The msh3 include directories
# MSH3_LIBRARIES The libraries needed to use msh3 # MSH3_LIBRARIES The msh3 library names
if(CURL_USE_PKGCONFIG) if(CURL_USE_PKGCONFIG)
find_package(PkgConfig QUIET) find_package(PkgConfig QUIET)

View File

@ -27,7 +27,7 @@
# #
# MBEDTLS_FOUND System has mbedtls # MBEDTLS_FOUND System has mbedtls
# MBEDTLS_INCLUDE_DIRS The mbedtls include directories # MBEDTLS_INCLUDE_DIRS The mbedtls include directories
# MBEDTLS_LIBRARIES The libraries needed to use mbedtls # MBEDTLS_LIBRARIES The mbedtls library names
find_path(MBEDTLS_INCLUDE_DIRS "mbedtls/ssl.h") find_path(MBEDTLS_INCLUDE_DIRS "mbedtls/ssl.h")

View File

@ -27,7 +27,7 @@
# #
# NGHTTP2_FOUND System has nghttp2 # NGHTTP2_FOUND System has nghttp2
# NGHTTP2_INCLUDE_DIRS The nghttp2 include directories # NGHTTP2_INCLUDE_DIRS The nghttp2 include directories
# NGHTTP2_LIBRARIES The libraries needed to use nghttp2 # NGHTTP2_LIBRARIES The nghttp2 library names
# NGHTTP2_VERSION Version of nghttp2 # NGHTTP2_VERSION Version of nghttp2
if(CURL_USE_PKGCONFIG) if(CURL_USE_PKGCONFIG)

View File

@ -27,7 +27,7 @@
# #
# NGHTTP3_FOUND System has nghttp3 # NGHTTP3_FOUND System has nghttp3
# NGHTTP3_INCLUDE_DIRS The nghttp3 include directories # NGHTTP3_INCLUDE_DIRS The nghttp3 include directories
# NGHTTP3_LIBRARIES The libraries needed to use nghttp3 # NGHTTP3_LIBRARIES The nghttp3 library names
# NGHTTP3_VERSION Version of nghttp3 # NGHTTP3_VERSION Version of nghttp3
if(CURL_USE_PKGCONFIG) if(CURL_USE_PKGCONFIG)

View File

@ -35,7 +35,7 @@
# #
# NGTCP2_FOUND System has ngtcp2 # NGTCP2_FOUND System has ngtcp2
# NGTCP2_INCLUDE_DIRS The ngtcp2 include directories # NGTCP2_INCLUDE_DIRS The ngtcp2 include directories
# NGTCP2_LIBRARIES The libraries needed to use ngtcp2 # NGTCP2_LIBRARIES The ngtcp2 library names
# NGTCP2_VERSION Version of ngtcp2 # NGTCP2_VERSION Version of ngtcp2
if(CURL_USE_PKGCONFIG) if(CURL_USE_PKGCONFIG)
@ -75,9 +75,7 @@ if(NGTCP2_FIND_COMPONENTS)
if(CURL_USE_PKGCONFIG) if(CURL_USE_PKGCONFIG)
pkg_search_module(PC_${_crypto_library} "lib${_crypto_library}") pkg_search_module(PC_${_crypto_library} "lib${_crypto_library}")
endif() endif()
find_library(${_crypto_library}_LIBRARY find_library(${_crypto_library}_LIBRARY NAMES ${_crypto_library}
NAMES
${_crypto_library}
HINTS HINTS
${PC_${_crypto_library}_LIBDIR} ${PC_${_crypto_library}_LIBDIR}
${PC_${_crypto_library}_LIBRARY_DIRS} ${PC_${_crypto_library}_LIBRARY_DIRS}

View File

@ -45,10 +45,8 @@ else()
if(EXISTS "${NETTLE_INCLUDE_DIR}/nettle/version.h") if(EXISTS "${NETTLE_INCLUDE_DIR}/nettle/version.h")
set(_version_regex_major "^#define[ \t]+NETTLE_VERSION_MAJOR[ \t]+([0-9]+).*") set(_version_regex_major "^#define[ \t]+NETTLE_VERSION_MAJOR[ \t]+([0-9]+).*")
set(_version_regex_minor "^#define[ \t]+NETTLE_VERSION_MINOR[ \t]+([0-9]+).*") set(_version_regex_minor "^#define[ \t]+NETTLE_VERSION_MINOR[ \t]+([0-9]+).*")
file(STRINGS "${NETTLE_INCLUDE_DIR}/nettle/version.h" file(STRINGS "${NETTLE_INCLUDE_DIR}/nettle/version.h" _version_major REGEX "${_version_regex_major}")
_version_major REGEX "${_version_regex_major}") file(STRINGS "${NETTLE_INCLUDE_DIR}/nettle/version.h" _version_minor REGEX "${_version_regex_minor}")
file(STRINGS "${NETTLE_INCLUDE_DIR}/nettle/version.h"
_version_minor REGEX "${_version_regex_minor}")
string(REGEX REPLACE "${_version_regex_major}" "\\1" _version_major "${_version_major}") string(REGEX REPLACE "${_version_regex_major}" "\\1" _version_major "${_version_major}")
string(REGEX REPLACE "${_version_regex_minor}" "\\1" _version_minor "${_version_minor}") string(REGEX REPLACE "${_version_regex_minor}" "\\1" _version_minor "${_version_minor}")
unset(_version_regex_major) unset(_version_regex_major)

View File

@ -27,7 +27,7 @@
# #
# QUICHE_FOUND System has quiche # QUICHE_FOUND System has quiche
# QUICHE_INCLUDE_DIRS The quiche include directories # QUICHE_INCLUDE_DIRS The quiche include directories
# QUICHE_LIBRARIES The libraries needed to use quiche # QUICHE_LIBRARIES The quiche library names
if(CURL_USE_PKGCONFIG) if(CURL_USE_PKGCONFIG)
find_package(PkgConfig QUIET) find_package(PkgConfig QUIET)

View File

@ -35,22 +35,20 @@ if(CURL_USE_PKGCONFIG)
pkg_search_module(PC_WOLFSSL QUIET "wolfssl") pkg_search_module(PC_WOLFSSL QUIET "wolfssl")
endif() endif()
find_path(WolfSSL_INCLUDE_DIR find_path(WolfSSL_INCLUDE_DIR NAMES "wolfssl/ssl.h"
NAMES "wolfssl/ssl.h" HINTS
HINTS ${PC_WOLFSSL_INCLUDE_DIRS} ${PC_WOLFSSL_INCLUDE_DIRS}
) )
find_library(WolfSSL_LIBRARY find_library(WolfSSL_LIBRARY NAMES "wolfssl"
NAMES "wolfssl" HINTS
HINTS ${PC_WOLFSSL_LIBRARY_DIRS} ${PC_WOLFSSL_LIBRARY_DIRS}
) )
if(WolfSSL_INCLUDE_DIR) if(WolfSSL_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+LIBWOLFSSL_VERSION_STRING[ \t]+\"([^\"]+)\".*") set(_version_regex "^#define[ \t]+LIBWOLFSSL_VERSION_STRING[ \t]+\"([^\"]+)\".*")
file(STRINGS "${WolfSSL_INCLUDE_DIR}/wolfssl/version.h" file(STRINGS "${WolfSSL_INCLUDE_DIR}/wolfssl/version.h" WolfSSL_VERSION REGEX "${_version_regex}")
WolfSSL_VERSION REGEX "${_version_regex}") string(REGEX REPLACE "${_version_regex}" "\\1" WolfSSL_VERSION "${WolfSSL_VERSION}")
string(REGEX REPLACE "${_version_regex}" "\\1"
WolfSSL_VERSION "${WolfSSL_VERSION}")
unset(_version_regex) unset(_version_regex)
endif() endif()

View File

@ -27,7 +27,7 @@
# #
# Zstd_FOUND System has zstd # Zstd_FOUND System has zstd
# Zstd_INCLUDE_DIRS The zstd include directories # Zstd_INCLUDE_DIRS The zstd include directories
# Zstd_LIBRARIES The libraries needed to use zstd # Zstd_LIBRARIES The zstd library names
# Zstd_VERSION Version of zstd # Zstd_VERSION Version of zstd
if(CURL_USE_PKGCONFIG) if(CURL_USE_PKGCONFIG)