]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: auto-select static nghttp2/nghttp3/ngtcp2 Config
authorViktor Szakats <commit@vsz.me>
Wed, 29 Apr 2026 17:09:28 +0000 (19:09 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 11 May 2026 09:57:25 +0000 (11:57 +0200)
When detecting these dependencies via CMake Config and their main
imported target is undefined, automatically assume and use their static
imported target instead.

Adopting from vcpkg downstream, where it's done for nghttp3 and ngtcp2,
but not for nghttp2.

Refs:
https://github.com/microsoft/vcpkg/blob/773e092a82fc3b4c3e73ee7b049a5e119fa45898/ports/curl/dependencies.patch
https://github.com/microsoft/vcpkg/commit/70b941a5d2443e79eeab62507acb41bd22201277

Downstream-patch-by: Kai Pastor
Closes #21470

CMake/FindNGHTTP2.cmake
CMake/FindNGHTTP3.cmake
CMake/FindNGTCP2.cmake

index f93113f404e184a7480dda3a9ba9fd09ff304703..bca7cf8a8181ab55b2db795b8b18d89a36397eef 100644 (file)
@@ -61,7 +61,7 @@ if(_nghttp2_FOUND)
 elseif(nghttp2_CONFIG)
   set(NGHTTP2_FOUND TRUE)
   set(NGHTTP2_VERSION ${nghttp2_VERSION})
-  if(NGHTTP2_USE_STATIC_LIBS)
+  if(NGHTTP2_USE_STATIC_LIBS OR NOT TARGET nghttp2::nghttp2)
     set(_nghttp2_LIBRARIES nghttp2::nghttp2_static)
   else()
     set(_nghttp2_LIBRARIES nghttp2::nghttp2)
index 427c139f21c46b4d89a9ccb62f8884af2dec9063..ed671b7a492974c1c4bf19490f7380336c721bc6 100644 (file)
@@ -61,7 +61,7 @@ if(_nghttp3_FOUND)
 elseif(nghttp3_CONFIG)
   set(NGHTTP3_FOUND TRUE)
   set(NGHTTP3_VERSION ${nghttp3_VERSION})
-  if(NGHTTP3_USE_STATIC_LIBS)
+  if(NGHTTP3_USE_STATIC_LIBS OR NOT TARGET nghttp3::nghttp3)
     set(_nghttp3_LIBRARIES nghttp3::nghttp3_static)
   else()
     set(_nghttp3_LIBRARIES nghttp3::nghttp3)
index e4929163777c3adf8fd948207a743d5ed7a2d5a6..70dae14b8663268bdecd2f5351c2a8d552e50cd7 100644 (file)
@@ -105,7 +105,7 @@ if(_ngtcp2_FOUND)
 elseif(ngtcp2_CONFIG)
   set(NGTCP2_FOUND TRUE)
   set(NGTCP2_VERSION ${ngtcp2_VERSION})
-  if(NGTCP2_USE_STATIC_LIBS)
+  if(NGTCP2_USE_STATIC_LIBS OR NOT TARGET ngtcp2::ngtcp2)
     set(_ngtcp2_LIBRARIES ngtcp2::ngtcp2_static ngtcp2::${_crypto_library_lower}_static)
   else()
     set(_ngtcp2_LIBRARIES ngtcp2::ngtcp2 ngtcp2::${_crypto_library_lower})