mirror of
https://github.com/curl/curl.git
synced 2024-12-21 06:50:10 +08:00
cmake: sync up result variable names in Find modules
- bearssl, c-ares, gss, libpsl, libssh2, mbedtls: Before this patch these Find modules returned results via `<NAME>_INCLUDE_DIR` and `<NAME>_LIBRARY`. This patch makes them return `<NAME>_INCLUDE_DIRS` (note the `S`) and `<NAME>_LIBRARIES` like other modules already did. - bearssl, mbedtls: Before this patch these Find modules allowed custom configuration via `<NAME>_INCLUDE_DIRS` (note the `S`). This patch makes them accept `<NAME>_INCLUDE_DIR`, like the rest of the modules did. Deprecate the old variables, but keep accepting them for compatibility. - bearssl: add missing `mark_as_advanced()` call. Closes #14542
This commit is contained in:
parent
65f5caee05
commit
db39c668a8
@ -29,7 +29,13 @@
|
||||
# BEARSSL_INCLUDE_DIRS The bearssl include directories
|
||||
# BEARSSL_LIBRARIES The bearssl library names
|
||||
|
||||
find_path(BEARSSL_INCLUDE_DIRS "bearssl.h")
|
||||
# for compatibility. Configuration via BEARSSL_INCLUDE_DIRS is deprecated, use BEARSSL_INCLUDE_DIR instead.
|
||||
if(DEFINED BEARSSL_INCLUDE_DIRS AND NOT DEFINED BEARSSL_INCLUDE_DIR)
|
||||
set(BEARSSL_INCLUDE_DIR "${BEARSSL_INCLUDE_DIRS}")
|
||||
unset(BEARSSL_INCLUDE_DIRS)
|
||||
endif()
|
||||
|
||||
find_path(BEARSSL_INCLUDE_DIR "bearssl.h")
|
||||
|
||||
find_library(BEARSSL_LIBRARY "bearssl")
|
||||
|
||||
@ -40,4 +46,9 @@ find_package_handle_standard_args(BEARSSL
|
||||
BEARSSL_LIBRARY
|
||||
)
|
||||
|
||||
mark_as_advanced(BEARSSL_INCLUDE_DIRS BEARSSL_LIBRARY)
|
||||
if(BEARSSL_FOUND)
|
||||
set(BEARSSL_INCLUDE_DIRS ${BEARSSL_INCLUDE_DIR})
|
||||
set(BEARSSL_LIBRARIES ${BEARSSL_LIBRARY})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(BEARSSL_INCLUDE_DIR BEARSSL_LIBRARY)
|
||||
|
@ -25,9 +25,9 @@
|
||||
#
|
||||
# Result Variables:
|
||||
#
|
||||
# CARES_FOUND System has c-ares
|
||||
# CARES_INCLUDE_DIR The c-ares include directory
|
||||
# CARES_LIBRARY The c-ares library name
|
||||
# CARES_FOUND System has c-ares
|
||||
# CARES_INCLUDE_DIRS The c-ares include directories
|
||||
# CARES_LIBRARIES The c-ares library names
|
||||
|
||||
find_path(CARES_INCLUDE_DIR "ares.h")
|
||||
|
||||
@ -40,4 +40,9 @@ find_package_handle_standard_args(CARES
|
||||
CARES_LIBRARY
|
||||
)
|
||||
|
||||
if(CARES_FOUND)
|
||||
set(CARES_INCLUDE_DIRS ${CARES_INCLUDE_DIR})
|
||||
set(CARES_LIBRARIES ${CARES_LIBRARY})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CARES_INCLUDE_DIR CARES_LIBRARY)
|
||||
|
@ -31,7 +31,7 @@
|
||||
#
|
||||
# GSS_FOUND System has the Heimdal library
|
||||
# GSS_FLAVOUR "MIT" or "Heimdal" if anything found
|
||||
# GSS_INCLUDE_DIR The GSS include directory
|
||||
# GSS_INCLUDE_DIRS The GSS include directories
|
||||
# GSS_LIBRARIES The GSS library names
|
||||
# GSS_LINK_DIRECTORIES Directories to add to linker search path
|
||||
# GSS_LINKER_FLAGS Additional linker flags
|
||||
@ -260,7 +260,7 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(GSS_INCLUDE_DIR ${_GSS_INCLUDE_DIRS})
|
||||
set(GSS_INCLUDE_DIRS ${_GSS_INCLUDE_DIRS})
|
||||
set(GSS_LIBRARIES ${_GSS_LIBRARIES})
|
||||
set(GSS_LINK_DIRECTORIES ${_GSS_LIBRARY_DIRS})
|
||||
set(GSS_LINKER_FLAGS ${_GSS_LDFLAGS})
|
||||
@ -275,8 +275,8 @@ if(GSS_FLAVOUR)
|
||||
set(_heimdal_manifest_file "Heimdal.Application.x86.manifest")
|
||||
endif()
|
||||
|
||||
if(EXISTS "${GSS_INCLUDE_DIR}/${_heimdal_manifest_file}")
|
||||
file(STRINGS "${GSS_INCLUDE_DIR}/${_heimdal_manifest_file}" _heimdal_version_str
|
||||
if(EXISTS "${GSS_INCLUDE_DIRS}/${_heimdal_manifest_file}")
|
||||
file(STRINGS "${GSS_INCLUDE_DIRS}/${_heimdal_manifest_file}" _heimdal_version_str
|
||||
REGEX "^.*version=\"[0-9]\\.[^\"]+\".*$")
|
||||
|
||||
string(REGEX MATCH "[0-9]\\.[^\"]+" GSS_VERSION "${_heimdal_version_str}")
|
||||
|
@ -25,10 +25,10 @@
|
||||
#
|
||||
# Result Variables:
|
||||
#
|
||||
# LIBPSL_FOUND System has libpsl
|
||||
# LIBPSL_INCLUDE_DIR The libpsl include directory
|
||||
# LIBPSL_LIBRARY The libpsl library name
|
||||
# LIBPSL_VERSION Version of libpsl
|
||||
# LIBPSL_FOUND System has libpsl
|
||||
# LIBPSL_INCLUDE_DIRS The libpsl include directories
|
||||
# LIBPSL_LIBRARIES The libpsl library names
|
||||
# LIBPSL_VERSION Version of libpsl
|
||||
|
||||
find_path(LIBPSL_INCLUDE_DIR "libpsl.h")
|
||||
|
||||
@ -49,4 +49,9 @@ find_package_handle_standard_args(LibPSL
|
||||
LIBPSL_VERSION
|
||||
)
|
||||
|
||||
if(LIBPSL_FOUND)
|
||||
set(LIBPSL_INCLUDE_DIRS ${LIBPSL_INCLUDE_DIR})
|
||||
set(LIBPSL_LIBRARIES ${LIBPSL_LIBRARY})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(LIBPSL_INCLUDE_DIR LIBPSL_LIBRARY)
|
||||
|
@ -25,10 +25,10 @@
|
||||
#
|
||||
# Result Variables:
|
||||
#
|
||||
# LIBSSH2_FOUND System has libssh2
|
||||
# LIBSSH2_INCLUDE_DIR The libssh2 include directory
|
||||
# LIBSSH2_LIBRARY The libssh2 library name
|
||||
# LIBSSH2_VERSION Version of libssh2
|
||||
# LIBSSH2_FOUND System has libssh2
|
||||
# LIBSSH2_INCLUDE_DIRS The libssh2 include directories
|
||||
# LIBSSH2_LIBRARIES The libssh2 library names
|
||||
# LIBSSH2_VERSION Version of libssh2
|
||||
|
||||
find_path(LIBSSH2_INCLUDE_DIR "libssh2.h")
|
||||
|
||||
@ -49,4 +49,9 @@ find_package_handle_standard_args(LibSSH2
|
||||
LIBSSH2_VERSION
|
||||
)
|
||||
|
||||
if(LIBSSH2_FOUND)
|
||||
set(LIBSSH2_INCLUDE_DIRS ${LIBSSH2_INCLUDE_DIR})
|
||||
set(LIBSSH2_LIBRARIES ${LIBSSH2_LIBRARY})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY)
|
||||
|
@ -29,21 +29,30 @@
|
||||
# MBEDTLS_INCLUDE_DIRS The mbedtls include directories
|
||||
# MBEDTLS_LIBRARIES The mbedtls library names
|
||||
|
||||
find_path(MBEDTLS_INCLUDE_DIRS "mbedtls/ssl.h")
|
||||
# for compatibility. Configuration via MBEDTLS_INCLUDE_DIRS is deprecated, use MBEDTLS_INCLUDE_DIR instead.
|
||||
if(DEFINED MBEDTLS_INCLUDE_DIRS AND NOT DEFINED MBEDTLS_INCLUDE_DIR)
|
||||
set(MBEDTLS_INCLUDE_DIR "${MBEDTLS_INCLUDE_DIRS}")
|
||||
unset(MBEDTLS_INCLUDE_DIRS)
|
||||
endif()
|
||||
|
||||
find_path(MBEDTLS_INCLUDE_DIR "mbedtls/ssl.h")
|
||||
|
||||
find_library(MBEDTLS_LIBRARY "mbedtls")
|
||||
find_library(MBEDX509_LIBRARY "mbedx509")
|
||||
find_library(MBEDCRYPTO_LIBRARY "mbedcrypto")
|
||||
|
||||
set(MBEDTLS_LIBRARIES "${MBEDTLS_LIBRARY}" "${MBEDX509_LIBRARY}" "${MBEDCRYPTO_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(MbedTLS
|
||||
REQUIRED_VARS
|
||||
MBEDTLS_INCLUDE_DIRS
|
||||
MBEDTLS_INCLUDE_DIR
|
||||
MBEDTLS_LIBRARY
|
||||
MBEDX509_LIBRARY
|
||||
MBEDCRYPTO_LIBRARY
|
||||
)
|
||||
|
||||
mark_as_advanced(MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
|
||||
if(MBEDTLS_FOUND)
|
||||
set(MBEDTLS_INCLUDE_DIRS ${MBEDTLS_INCLUDE_DIR})
|
||||
set(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARY} ${MBEDX509_LIBRARY} ${MBEDCRYPTO_LIBRARY})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
|
||||
|
@ -216,7 +216,7 @@ set(LIBCURL_PC_REQUIRES_PRIVATE "")
|
||||
if(ENABLE_ARES)
|
||||
set(USE_ARES 1)
|
||||
find_package(CARES REQUIRED)
|
||||
list(APPEND CURL_LIBS ${CARES_LIBRARY})
|
||||
list(APPEND CURL_LIBS ${CARES_LIBRARIES})
|
||||
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libcares")
|
||||
endif()
|
||||
|
||||
@ -568,7 +568,7 @@ if(CURL_USE_BEARSSL)
|
||||
find_package(BearSSL REQUIRED)
|
||||
set(_ssl_enabled ON)
|
||||
set(USE_BEARSSL ON)
|
||||
list(APPEND CURL_LIBS ${BEARSSL_LIBRARY})
|
||||
list(APPEND CURL_LIBS ${BEARSSL_LIBRARIES})
|
||||
include_directories(${BEARSSL_INCLUDE_DIRS})
|
||||
|
||||
if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "bearssl")
|
||||
@ -1019,10 +1019,10 @@ set(USE_LIBPSL OFF)
|
||||
if(CURL_USE_LIBPSL)
|
||||
find_package(LibPSL)
|
||||
if(LIBPSL_FOUND)
|
||||
list(APPEND CURL_LIBS ${LIBPSL_LIBRARY})
|
||||
list(APPEND CURL_LIBS ${LIBPSL_LIBRARIES})
|
||||
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libpsl")
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "${LIBPSL_INCLUDE_DIR}")
|
||||
include_directories(${LIBPSL_INCLUDE_DIR})
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "${LIBPSL_INCLUDE_DIRS}")
|
||||
include_directories(${LIBPSL_INCLUDE_DIRS})
|
||||
set(USE_LIBPSL ON)
|
||||
endif()
|
||||
endif()
|
||||
@ -1035,10 +1035,10 @@ set(USE_LIBSSH2 OFF)
|
||||
if(CURL_USE_LIBSSH2)
|
||||
find_package(LibSSH2)
|
||||
if(LIBSSH2_FOUND)
|
||||
list(APPEND CURL_LIBS ${LIBSSH2_LIBRARY})
|
||||
list(APPEND CURL_LIBS ${LIBSSH2_LIBRARIES})
|
||||
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libssh2")
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "${LIBSSH2_INCLUDE_DIR}")
|
||||
include_directories(${LIBSSH2_INCLUDE_DIR})
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "${LIBSSH2_INCLUDE_DIRS}")
|
||||
include_directories(${LIBSSH2_INCLUDE_DIRS})
|
||||
set(USE_LIBSSH2 ON)
|
||||
endif()
|
||||
endif()
|
||||
@ -1093,7 +1093,7 @@ if(CURL_USE_GSSAPI)
|
||||
|
||||
message(STATUS "Found ${GSS_FLAVOUR} GSSAPI version: \"${GSS_VERSION}\"")
|
||||
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES ${GSS_INCLUDE_DIR})
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES ${GSS_INCLUDE_DIRS})
|
||||
|
||||
string(REPLACE ";" " " GSS_COMPILER_FLAGS "${GSS_COMPILER_FLAGS}")
|
||||
string(REPLACE ";" " " GSS_LINKER_FLAGS "${GSS_LINKER_FLAGS}")
|
||||
@ -1129,7 +1129,7 @@ if(CURL_USE_GSSAPI)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include_directories(${GSS_INCLUDE_DIR})
|
||||
include_directories(${GSS_INCLUDE_DIRS})
|
||||
link_directories(${GSS_LINK_DIRECTORIES})
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GSS_COMPILER_FLAGS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GSS_LINKER_FLAGS}")
|
||||
|
@ -43,7 +43,7 @@ include_directories(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
)
|
||||
if(USE_ARES)
|
||||
include_directories(${CARES_INCLUDE_DIR})
|
||||
include_directories(${CARES_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
|
@ -38,7 +38,7 @@ function(setup_test _test_name) # ARGN are the files in the test
|
||||
"${CURL_SOURCE_DIR}/tests/libtest" # to be able to build generated tests
|
||||
)
|
||||
if(USE_ARES)
|
||||
include_directories(${CARES_INCLUDE_DIR})
|
||||
include_directories(${CARES_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${_test_name} ${LIB_SELECTED} ${CURL_LIBS})
|
||||
|
@ -31,7 +31,7 @@ function(setup_executable _test_name) # ARGN are the files in the test
|
||||
"${CURL_SOURCE_DIR}/src" # for "tool_xattr.h" in disabled_SOURCES
|
||||
)
|
||||
if(USE_ARES)
|
||||
include_directories(${CARES_INCLUDE_DIR})
|
||||
include_directories(${CARES_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${_test_name} ${CURL_LIBS})
|
||||
|
Loading…
Reference in New Issue
Block a user