]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: rename wolfSSL and zstd config variables to uppercase
authorViktor Szakats <commit@vsz.me>
Fri, 16 Aug 2024 16:56:49 +0000 (18:56 +0200)
committerViktor Szakats <commit@vsz.me>
Sat, 17 Aug 2024 19:23:51 +0000 (21:23 +0200)
To match with other config variables and other projects.

Rename these CMake configuration variables:
- `WolfSSL_INCLUDE_DIR` -> `WOLFSSL_INCLUDE_DIR`
- `WolfSSL_LIBRARY`     -> `WOLFSSL_LIBRARY`
- `Zstd_INCLUDE_DIR`    -> `ZSTD_INCLUDE_DIR`
- `Zstd_LIBRARY`        -> `ZSTD_LIBRARY`

The old values continue to work, with a warning suggesting the new name.

Also:
- add similar warnings for earlier renames for mbedTLS and BearSSL.
- rename internal variables `PC_Zstd_*` to uppercase.

Follow-up to db39c668a8e33e064b9eb20892cd027f46302f77 #14542

Closes #14574

CMake/FindBearSSL.cmake
CMake/FindMbedTLS.cmake
CMake/FindWolfSSL.cmake
CMake/FindZstd.cmake
CMakeLists.txt

index 4dd3817c89532e8a443067a4314a0ff7689e459d..2e25182c341934ac5d3807d251eca4f1d3756d62 100644 (file)
@@ -29,8 +29,8 @@
 # BEARSSL_INCLUDE_DIRS  The bearssl include directories
 # BEARSSL_LIBRARIES     The bearssl library names
 
-# 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)
+  message(WARNING "BEARSSL_INCLUDE_DIRS is deprecated, use BEARSSL_INCLUDE_DIR instead.")
   set(BEARSSL_INCLUDE_DIR "${BEARSSL_INCLUDE_DIRS}")
   unset(BEARSSL_INCLUDE_DIRS)
 endif()
index 90d6a24d451e123c8684ce91f0ecc99d8a8810f0..3376b2cee80f202f9eb3cf787495759f7ab5cfd1 100644 (file)
@@ -30,8 +30,8 @@
 # MBEDTLS_LIBRARIES     The mbedtls library names
 # MBEDTLS_VERSION       Version of mbedtls
 
-# 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)
+  message(WARNING "MBEDTLS_INCLUDE_DIRS is deprecated, use MBEDTLS_INCLUDE_DIR instead.")
   set(MBEDTLS_INCLUDE_DIR "${MBEDTLS_INCLUDE_DIRS}")
   unset(MBEDTLS_INCLUDE_DIRS)
 endif()
index 2136a456b2effd181797e0cb0ec8bd85b341f3ae..c4f28dfaa9fc762ef16cbcb62d360d99b8cbed2d 100644 (file)
 #
 # Result Variables:
 #
-# WolfSSL_FOUND         System has wolfssl
-# WolfSSL_INCLUDE_DIRS  The wolfssl include directories
-# WolfSSL_LIBRARIES     The wolfssl library names
-# WolfSSL_VERSION       Version of wolfssl
+# WOLFSSL_FOUND         System has wolfssl
+# WOLFSSL_INCLUDE_DIRS  The wolfssl include directories
+# WOLFSSL_LIBRARIES     The wolfssl library names
+# WOLFSSL_VERSION       Version of wolfssl
+
+if(DEFINED WolfSSL_INCLUDE_DIR AND NOT DEFINED WOLFSSL_INCLUDE_DIR)
+  message(WARNING "WolfSSL_INCLUDE_DIR is deprecated, use WOLFSSL_INCLUDE_DIR instead.")
+  set(WOLFSSL_INCLUDE_DIR "${WolfSSL_INCLUDE_DIR}")
+  unset(WolfSSL_INCLUDE_DIR)
+endif()
+if(DEFINED WolfSSL_LIBRARY AND NOT DEFINED WOLFSSL_LIBRARY)
+  message(WARNING "WolfSSL_LIBRARY is deprecated, use WOLFSSL_LIBRARY instead.")
+  set(WOLFSSL_LIBRARY "${WolfSSL_LIBRARY}")
+  unset(WolfSSL_LIBRARY)
+endif()
 
 if(CURL_USE_PKGCONFIG)
   find_package(PkgConfig QUIET)
   pkg_check_modules(PC_WOLFSSL QUIET "wolfssl")
 endif()
 
-find_path(WolfSSL_INCLUDE_DIR NAMES "wolfssl/ssl.h"
+find_path(WOLFSSL_INCLUDE_DIR NAMES "wolfssl/ssl.h"
   HINTS
     ${PC_WOLFSSL_INCLUDEDIR}
     ${PC_WOLFSSL_INCLUDE_DIRS}
 )
 
-find_library(WolfSSL_LIBRARY NAMES "wolfssl"
+find_library(WOLFSSL_LIBRARY NAMES "wolfssl"
   HINTS
     ${PC_WOLFSSL_LIBDIR}
     ${PC_WOLFSSL_LIBRARY_DIRS}
 )
 
 if(PC_WOLFSSL_VERSION)
-  set(WolfSSL_VERSION ${PC_WOLFSSL_VERSION})
-elseif(WolfSSL_INCLUDE_DIR AND EXISTS "${WolfSSL_INCLUDE_DIR}/wolfssl/version.h")
+  set(WOLFSSL_VERSION ${PC_WOLFSSL_VERSION})
+elseif(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}")
+  file(STRINGS "${WOLFSSL_INCLUDE_DIR}/wolfssl/version.h" _version_str REGEX "${_version_regex}")
   string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
-  set(WolfSSL_VERSION "${_version_str}")
+  set(WOLFSSL_VERSION "${_version_str}")
   unset(_version_regex)
   unset(_version_str)
 endif()
@@ -61,15 +72,15 @@ endif()
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(WolfSSL
   REQUIRED_VARS
-    WolfSSL_INCLUDE_DIR
-    WolfSSL_LIBRARY
+    WOLFSSL_INCLUDE_DIR
+    WOLFSSL_LIBRARY
   VERSION_VAR
-    WolfSSL_VERSION
+    WOLFSSL_VERSION
 )
 
-if(WolfSSL_FOUND)
-  set(WolfSSL_INCLUDE_DIRS ${WolfSSL_INCLUDE_DIR})
-  set(WolfSSL_LIBRARIES    ${WolfSSL_LIBRARY})
+if(WOLFSSL_FOUND)
+  set(WOLFSSL_INCLUDE_DIRS ${WOLFSSL_INCLUDE_DIR})
+  set(WOLFSSL_LIBRARIES    ${WOLFSSL_LIBRARY})
 endif()
 
-mark_as_advanced(WolfSSL_INCLUDE_DIR WolfSSL_LIBRARY)
+mark_as_advanced(WOLFSSL_INCLUDE_DIR WOLFSSL_LIBRARY)
index acd2d6a305ab0be17b849a4ee64bf2d0ef462974..72feb30c092b3923785f5c0027a3ecb28e020320 100644 (file)
 #
 # Result Variables:
 #
-# Zstd_FOUND         System has zstd
-# Zstd_INCLUDE_DIRS  The zstd include directories
-# Zstd_LIBRARIES     The zstd library names
-# Zstd_VERSION       Version of zstd
+# ZSTD_FOUND         System has zstd
+# ZSTD_INCLUDE_DIRS  The zstd include directories
+# ZSTD_LIBRARIES     The zstd library names
+# ZSTD_VERSION       Version of zstd
+
+if(DEFINED Zstd_INCLUDE_DIR AND NOT DEFINED ZSTD_INCLUDE_DIR)
+  message(WARNING "Zstd_INCLUDE_DIR is deprecated, use ZSTD_INCLUDE_DIR instead.")
+  set(ZSTD_INCLUDE_DIR "${Zstd_INCLUDE_DIR}")
+  unset(Zstd_INCLUDE_DIR)
+endif()
+if(DEFINED Zstd_LIBRARY AND NOT DEFINED ZSTD_LIBRARY)
+  message(WARNING "Zstd_LIBRARY is deprecated, use ZSTD_LIBRARY instead.")
+  set(ZSTD_LIBRARY "${Zstd_LIBRARY}")
+  unset(Zstd_LIBRARY)
+endif()
 
 if(CURL_USE_PKGCONFIG)
   find_package(PkgConfig QUIET)
-  pkg_check_modules(PC_Zstd "libzstd")
+  pkg_check_modules(PC_ZSTD "libzstd")
 endif()
 
-find_path(Zstd_INCLUDE_DIR "zstd.h"
+find_path(ZSTD_INCLUDE_DIR "zstd.h"
   HINTS
-    ${PC_Zstd_INCLUDEDIR}
-    ${PC_Zstd_INCLUDE_DIRS}
+    ${PC_ZSTD_INCLUDEDIR}
+    ${PC_ZSTD_INCLUDE_DIRS}
 )
 
-find_library(Zstd_LIBRARY NAMES "zstd"
+find_library(ZSTD_LIBRARY NAMES "zstd"
   HINTS
-    ${PC_Zstd_LIBDIR}
-    ${PC_Zstd_LIBRARY_DIRS}
+    ${PC_ZSTD_LIBDIR}
+    ${PC_ZSTD_LIBRARY_DIRS}
 )
 
-if(PC_Zstd_VERSION)
-  set(Zstd_VERSION ${PC_Zstd_VERSION})
-elseif(Zstd_INCLUDE_DIR AND EXISTS "${Zstd_INCLUDE_DIR}/zstd.h")
+if(PC_ZSTD_VERSION)
+  set(ZSTD_VERSION ${PC_ZSTD_VERSION})
+elseif(ZSTD_INCLUDE_DIR AND EXISTS "${ZSTD_INCLUDE_DIR}/zstd.h")
   set(_version_regex1 "#[\t ]*define[ \t]+ZSTD_VERSION_MAJOR[ \t]+([0-9]+).*")
   set(_version_regex2 "#[\t ]*define[ \t]+ZSTD_VERSION_MINOR[ \t]+([0-9]+).*")
   set(_version_regex3 "#[\t ]*define[ \t]+ZSTD_VERSION_RELEASE[ \t]+([0-9]+).*")
-  file(STRINGS "${Zstd_INCLUDE_DIR}/zstd.h" _version_str1 REGEX "${_version_regex1}")
-  file(STRINGS "${Zstd_INCLUDE_DIR}/zstd.h" _version_str2 REGEX "${_version_regex2}")
-  file(STRINGS "${Zstd_INCLUDE_DIR}/zstd.h" _version_str3 REGEX "${_version_regex3}")
+  file(STRINGS "${ZSTD_INCLUDE_DIR}/zstd.h" _version_str1 REGEX "${_version_regex1}")
+  file(STRINGS "${ZSTD_INCLUDE_DIR}/zstd.h" _version_str2 REGEX "${_version_regex2}")
+  file(STRINGS "${ZSTD_INCLUDE_DIR}/zstd.h" _version_str3 REGEX "${_version_regex3}")
   string(REGEX REPLACE "${_version_regex1}" "\\1" _version_str1 "${_version_str1}")
   string(REGEX REPLACE "${_version_regex2}" "\\1" _version_str2 "${_version_str2}")
   string(REGEX REPLACE "${_version_regex3}" "\\1" _version_str3 "${_version_str3}")
-  set(Zstd_VERSION "${_version_str1}.${_version_str2}.${_version_str3}")
+  set(ZSTD_VERSION "${_version_str1}.${_version_str2}.${_version_str3}")
   unset(_version_regex1)
   unset(_version_regex2)
   unset(_version_regex3)
@@ -71,15 +82,15 @@ endif()
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(Zstd
   REQUIRED_VARS
-    Zstd_INCLUDE_DIR
-    Zstd_LIBRARY
+    ZSTD_INCLUDE_DIR
+    ZSTD_LIBRARY
   VERSION_VAR
-    Zstd_VERSION
+    ZSTD_VERSION
 )
 
-if(Zstd_FOUND)
-  set(Zstd_INCLUDE_DIRS ${Zstd_INCLUDE_DIR})
-  set(Zstd_LIBRARIES    ${Zstd_LIBRARY})
+if(ZSTD_FOUND)
+  set(ZSTD_INCLUDE_DIRS ${ZSTD_INCLUDE_DIR})
+  set(ZSTD_LIBRARIES    ${ZSTD_LIBRARY})
 endif()
 
-mark_as_advanced(Zstd_INCLUDE_DIR Zstd_LIBRARY)
+mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARY)
index b8a42a5f8eb0eba3adc2ca5ff32a6273ade16bff..b72c7a871f1f097e3ac9f7c21a681c6f13ed2ec4 100644 (file)
@@ -594,9 +594,9 @@ if(CURL_USE_WOLFSSL)
   find_package(WolfSSL REQUIRED)
   set(_ssl_enabled ON)
   set(USE_WOLFSSL ON)
-  list(APPEND CURL_LIBS ${WolfSSL_LIBRARIES})
+  list(APPEND CURL_LIBS ${WOLFSSL_LIBRARIES})
   list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "wolfssl")
-  include_directories(${WolfSSL_INCLUDE_DIRS})
+  include_directories(${WOLFSSL_INCLUDE_DIRS})
 
   if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "wolfssl")
     set(_valid_default_ssl_backend TRUE)
@@ -688,11 +688,11 @@ option(CURL_ZSTD "Set to ON to enable building curl with zstd support." OFF)
 set(HAVE_ZSTD OFF)
 if(CURL_ZSTD)
   find_package(Zstd REQUIRED)
-  if(Zstd_FOUND AND NOT Zstd_VERSION VERSION_LESS 1.0.0)
+  if(ZSTD_FOUND AND NOT ZSTD_VERSION VERSION_LESS 1.0.0)
     set(HAVE_ZSTD ON)
-    list(APPEND CURL_LIBS ${Zstd_LIBRARIES})
+    list(APPEND CURL_LIBS ${ZSTD_LIBRARIES})
     list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libzstd")
-    include_directories(${Zstd_INCLUDE_DIRS})
+    include_directories(${ZSTD_INCLUDE_DIRS})
   else()
     message(WARNING "zstd v1.0.0 or newer is required, disabling zstd support.")
   endif()
@@ -712,8 +712,8 @@ macro(openssl_check_symbol_exists _symbol _files _variable _extra_libs)
       list(APPEND CMAKE_REQUIRED_LIBRARIES "bcrypt")  # for OpenSSL/LibreSSL
     endif()
   elseif(USE_WOLFSSL)
-    set(CMAKE_REQUIRED_INCLUDES   "${WolfSSL_INCLUDE_DIRS}")
-    set(CMAKE_REQUIRED_LIBRARIES  "${WolfSSL_LIBRARIES}")
+    set(CMAKE_REQUIRED_INCLUDES   "${WOLFSSL_INCLUDE_DIRS}")
+    set(CMAKE_REQUIRED_LIBRARIES  "${WOLFSSL_LIBRARIES}")
     if(HAVE_LIBZ)
       list(APPEND CMAKE_REQUIRED_INCLUDES  "${ZLIB_INCLUDE_DIRS}")  # Public wolfSSL headers require zlib headers
       list(APPEND CMAKE_REQUIRED_LIBRARIES "${ZLIB_LIBRARIES}")