cmake: auto-select static nghttp2/nghttp3/ngtcp2 Config

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:
773e092a82/ports/curl/dependencies.patch
70b941a5d2

Downstream-patch-by: Kai Pastor

Closes #21470
This commit is contained in:
Viktor Szakats 2026-04-29 19:09:28 +02:00
parent 6f1dfab6a2
commit ed3cd8b046
No known key found for this signature in database
3 changed files with 3 additions and 3 deletions

View 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)