Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion FindLibKrb5.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,24 @@
# LibKrb5_INCLUDE_DIR The location of Krb5 headers

if (NOT LibKrb5_ROOT_DIR)
find_path(LibKrb5_ROOT_DIR NAMES include/krb5.h)
find_path(LibKrb5_ROOT_DIR NAMES include/krb5/krb5.h)
endif ()

find_library(LibKrb5_LIBRARY NAMES krb5 HINTS ${LibKrb5_ROOT_DIR}/lib)

find_path(LibKrb5_INCLUDE_DIR NAMES krb5/krb5.h HINTS ${LibKrb5_ROOT_DIR}/include)

# If using macOS, make sure that we're not finding the system's libkrb5. It
# an old version, which points you at GSS.framework, which is also deprecated.
if (LibKrb5_LIBRARY AND "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
if ("${LibKrb5_LIBRARY}" MATCHES "^/Library/Developer/CommandLineTools/SDKs/.*")
message(
FATAL_ERROR
"Found macOS system version of libkrb5 at ${LibKrb5_LIBRARY}. Please use the version from Homebrew instead, which is known to be more stable."
)
endif ()
endif ()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibKrb5 DEFAULT_MSG LibKrb5_LIBRARY LibKrb5_INCLUDE_DIR)

Expand Down
Loading