summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAmir Masoud Abdol <amir.abdol@qt.io>2023-05-17 13:48:29 +0200
committerAmir Masoud Abdol <amir.abdol@qt.io>2023-05-23 18:57:21 +0200
commitc3d3e7312499189dde2ff9c0cb14bd608d6fd1cd (patch)
treeb58da1b1d54944fc558c8ddcc8be1777ad246e68 /cmake
parent840939799e9803c863d1a311d429f40060ee5462 (diff)
Prefer GSS.framework on macOS over libgssapi_krb5.tbd when using vcpkg
On macOS, vcpkg toolchain sets the value of CMAKE_FIND_FRAMEWORK and CMAKE_FIND_APPBUNDLE to LAST which causes an issue when it comes to GSSAPI. This change in behavior leads to FindGSSAPI.cmake finding `usr/lib/libgssapi_krb5.tbd → Kerberos.framework` instead, which is not exactly what we want, and it misses some necessary symbols, and as a result Network fails to build.¹ We need to make sure that we find `GSS.framework`. Here by dropping the alternative name on Apple platform, we end up getting the Framework even if vcpkg prefer finding the framework LAST. [1]: https://github.com/microsoft/vcpkg/issues/23782 Pick-to: 6.5 Change-Id: I0e7e6272dcb0fdf2c746149d2969468d66ca9ec2 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindGSSAPI.cmake21
1 files changed, 16 insertions, 5 deletions
diff --git a/cmake/FindGSSAPI.cmake b/cmake/FindGSSAPI.cmake
index cc89406a72..91ad99c069 100644
--- a/cmake/FindGSSAPI.cmake
+++ b/cmake/FindGSSAPI.cmake
@@ -12,12 +12,24 @@ find_path(GSSAPI_INCLUDE_DIRS
HINTS ${PC_GSSAPI_INCLUDEDIR}
)
+# On macOS, vcpkg opts for finding frameworks LAST. This is generally fine;
+# however, in the case of GSSAPI, `usr/lib/libgssapi_krb5.tbd` which is a
+# symlink to `Kerberos.framework` misses a few symols, e.g.,
+# `___gss_c_nt_hostbased_service_oid_desc`, and it causes build failure.
+# So, we need to make sure that we find `GSS.framework`.
+set(gssapi_library_names
+ GSS # framework
+ gss # solaris
+ gssapi # FreeBSD
+ gssapi_krb5
+)
+if(VCPKG_TARGET_TRIPLET AND APPLE)
+ list(REMOVE_ITEM gssapi_library_names "gssapi_krb5")
+endif()
+
find_library(GSSAPI_LIBRARIES
NAMES
- GSS # framework
- gss # solaris
- gssapi # FreeBSD
- gssapi_krb5
+ ${gssapi_library_names}
HINTS ${PC_GSSAPI_LIBDIR}
)
@@ -44,4 +56,3 @@ mark_as_advanced(GSSAPI_INCLUDE_DIRS GSSAPI_LIBRARIES)
include(FeatureSummary)
set_package_properties(GSSAPI PROPERTIES
DESCRIPTION "Generic Security Services Application Program Interface")
-