]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake/FindNGTCP2: use library path as hint for finding the crypto module
authorViktor Szakats <commit@vsz.me>
Thu, 12 Sep 2024 01:34:31 +0000 (03:34 +0200)
committerViktor Szakats <commit@vsz.me>
Thu, 19 Sep 2024 13:56:30 +0000 (15:56 +0200)
It allows finding the ngtcp2 crypto interface library automatically when
using a custom `NGTCP2_LIBRARY`.

Before this patch the library location had to be added via
`CMAKE_LIBRARY_PATH` or by other means.

Also add empty lines for readability / uniformity.

Fixes https://github.com/curl/curl-for-win/blob/8b8909e1206de1dcca356a8dd33eb1e4ffeea7fd/curl.sh#L289
Closes #14905

CMake/FindNGTCP2.cmake

index 194483d54cd89abc8f69b67bcc1ac79a7d2f4345..c6d66bfb789c534ee8359b3d96eaaeda39e543c6 100644 (file)
@@ -84,14 +84,19 @@ if(NGTCP2_FIND_COMPONENTS)
 
   if(_ngtcp2_crypto_backend)
     string(TOLOWER "ngtcp2_crypto_${_ngtcp2_crypto_backend}" _crypto_library)
+
     if(CURL_USE_PKGCONFIG)
       pkg_check_modules(PC_${_crypto_library} "lib${_crypto_library}")
     endif()
+
+    get_filename_component(_ngtcp2_library_dir "${NGTCP2_LIBRARY}" DIRECTORY)
     find_library(${_crypto_library}_LIBRARY NAMES ${_crypto_library}
       HINTS
+        ${_ngtcp2_library_dir}
         ${PC_${_crypto_library}_LIBDIR}
         ${PC_${_crypto_library}_LIBRARY_DIRS}
     )
+
     if(${_crypto_library}_LIBRARY)
       set(NGTCP2_${_ngtcp2_crypto_backend}_FOUND TRUE)
       set(NGTCP2_CRYPTO_LIBRARY ${${_crypto_library}_LIBRARY})