summaryrefslogtreecommitdiff
path: root/cmake/SelectGSSAPI.cmake
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2020-04-03 19:51:22 +0200
committerPatrick Steinhardt <ps@pks.im>2020-06-01 14:06:20 +0200
commitbc02bcd920eac0ca5a930a8272737db10fc4be1f (patch)
tree7bf9f6cc739d4b2127adb2704cdd3a8b9c3bdbe0 /cmake/SelectGSSAPI.cmake
parent172a28860b3e4743d7ccd4409f6f51bc7c00fdfd (diff)
downloadlibgit2-bc02bcd920eac0ca5a930a8272737db10fc4be1f.tar.gz
cmake: move modules into the "cmake/" top level dir
Our custom CMake module currently live in "cmake/Modules". As the "cmake/" directory doesn't contain anything except the "Modules" directory, it doesn't really make sense to have the additional intermediate directory. So let's instead move the modules one level up into the "cmake/" top level directory.
Diffstat (limited to 'cmake/SelectGSSAPI.cmake')
-rw-r--r--cmake/SelectGSSAPI.cmake48
1 files changed, 48 insertions, 0 deletions
diff --git a/cmake/SelectGSSAPI.cmake b/cmake/SelectGSSAPI.cmake
new file mode 100644
index 000000000..0a42eeefd
--- /dev/null
+++ b/cmake/SelectGSSAPI.cmake
@@ -0,0 +1,48 @@
+INCLUDE(SanitizeBool)
+
+# We try to find any packages our backends might use
+FIND_PACKAGE(GSSAPI)
+IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ INCLUDE(FindGSSFramework)
+ENDIF()
+
+IF(USE_GSSAPI)
+ # Auto-select GSS backend
+ SanitizeBool(USE_GSSAPI)
+ IF (USE_GSSAPI STREQUAL ON)
+ IF (GSSFRAMEWORK_FOUND)
+ SET(USE_GSSAPI "GSS.framework")
+ ELSEIF(GSSAPI_FOUND)
+ SET(USE_GSSAPI "gssapi")
+ ELSE()
+ MESSAGE(FATAL_ERROR "Unable to autodetect a usable GSS backend."
+ "Please pass the backend name explicitly (-DUSE_GSS=backend)")
+ ENDIF()
+ ENDIF()
+
+ # Check that we can find what's required for the selected backend
+ IF (USE_GSSAPI STREQUAL "GSS.framework")
+ IF (NOT GSSFRAMEWORK_FOUND)
+ MESSAGE(FATAL_ERROR "Asked for GSS.framework backend, but it wasn't found")
+ ENDIF()
+
+ LIST(APPEND LIBGIT2_LIBS ${GSSFRAMEWORK_LIBRARIES})
+
+ SET(GIT_GSSFRAMEWORK 1)
+ ADD_FEATURE_INFO(SPNEGO GIT_GSSFRAMEWORK "SPNEGO authentication support (${USE_GSSAPI})")
+ ELSEIF (USE_GSSAPI STREQUAL "gssapi")
+ IF (NOT GSSAPI_FOUND)
+ MESSAGE(FATAL_ERROR "Asked for gssapi GSS backend, but it wasn't found")
+ ENDIF()
+
+ LIST(APPEND LIBGIT2_LIBS ${GSSAPI_LIBRARIES})
+
+ SET(GIT_GSSAPI 1)
+ ADD_FEATURE_INFO(SPNEGO GIT_GSSAPI "SPNEGO authentication support (${USE_GSSAPI})")
+ ELSE()
+ MESSAGE(FATAL_ERROR "Asked for backend ${USE_GSSAPI} but it wasn't found")
+ ENDIF()
+ELSE()
+ SET(GIT_GSSAPI 0)
+ ADD_FEATURE_INFO(SPNEGO NO "SPNEGO authentication support")
+ENDIF()