mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-25 22:30:51 +08:00
Add gssapi support to cmake
This commit is contained in:
parent
aa885c5a15
commit
43a8b3c6c8
7
.github/workflows/CI.yaml
vendored
7
.github/workflows/CI.yaml
vendored
@ -55,6 +55,13 @@ jobs:
|
|||||||
DRAFT: enabled
|
DRAFT: enabled
|
||||||
PACKAGES: cmake libsodium-dev
|
PACKAGES: cmake libsodium-dev
|
||||||
TLS: enabled
|
TLS: enabled
|
||||||
|
- os: ubuntu-latest
|
||||||
|
BUILD_TYPE: cmake
|
||||||
|
CURVE: libsodium
|
||||||
|
DRAFT: enabled
|
||||||
|
GSSAPI: enabled
|
||||||
|
PACKAGES: cmake libsodium-dev libkrb5-dev
|
||||||
|
TLS: enabled
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
BUILD_TYPE: cmake
|
BUILD_TYPE: cmake
|
||||||
DRAFT: enabled
|
DRAFT: enabled
|
||||||
|
@ -295,6 +295,16 @@ else() # ENABLE_CURVE
|
|||||||
message(STATUS "CURVE security is disabled")
|
message(STATUS "CURVE security is disabled")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(WITH_GSSAPI_KRB5 "Use libgssapi_krb5" OFF)
|
||||||
|
if(WITH_GSSAPI_KRB5)
|
||||||
|
find_package("gssapi_krb5" REQUIRED)
|
||||||
|
message(STATUS "Using GSSAPI_KRB5")
|
||||||
|
include_directories(${GSSAPI_KRB5_INCLUDE_DIRS})
|
||||||
|
link_directories(${GSSAPI_KRB5_LIBRARY_DIRS})
|
||||||
|
set(HAVE_LIBGSSAPI_KRB5 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
|
||||||
option(WITH_MILITANT "Enable militant assertions" OFF)
|
option(WITH_MILITANT "Enable militant assertions" OFF)
|
||||||
@ -1218,6 +1228,10 @@ if(ZMQ_HAVE_TIPC)
|
|||||||
list(APPEND cxx-sources tipc_address.cpp tipc_connecter.cpp tipc_listener.cpp)
|
list(APPEND cxx-sources tipc_address.cpp tipc_connecter.cpp tipc_listener.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WITH_GSSAPI_KRB5)
|
||||||
|
list(APPEND cxx-sources gssapi_client.cpp gssapi_mechanism_base.cpp gssapi_server.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# source generators
|
# source generators
|
||||||
|
|
||||||
@ -1491,6 +1505,10 @@ if(BUILD_SHARED)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WITH_GSSAPI_KRB5)
|
||||||
|
target_link_libraries(libzmq ${GSSAPI_KRB5_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(HAVE_WS2_32)
|
if(HAVE_WS2_32)
|
||||||
target_link_libraries(libzmq ws2_32)
|
target_link_libraries(libzmq ws2_32)
|
||||||
elseif(HAVE_WS2)
|
elseif(HAVE_WS2)
|
||||||
@ -1541,6 +1559,10 @@ if(BUILD_STATIC)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WITH_GSSAPI_KRB5)
|
||||||
|
target_link_libraries(libzmq-static ${GSSAPI_KRB5_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(HAVE_WS2_32)
|
if(HAVE_WS2_32)
|
||||||
target_link_libraries(libzmq-static ws2_32)
|
target_link_libraries(libzmq-static ws2_32)
|
||||||
elseif(HAVE_WS2)
|
elseif(HAVE_WS2)
|
||||||
@ -1610,6 +1632,10 @@ if(BUILD_SHARED)
|
|||||||
target_link_libraries(${perf-tool} ${SODIUM_LIBRARIES})
|
target_link_libraries(${perf-tool} ${SODIUM_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WITH_GSSAPI_KRB5)
|
||||||
|
target_link_libraries(${perf-tool} ${GSSAPI_KRB5_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ZMQ_BUILD_FRAMEWORK)
|
if(ZMQ_BUILD_FRAMEWORK)
|
||||||
# Copy perf-tools binaries into Framework
|
# Copy perf-tools binaries into Framework
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
|
45
builds/cmake/Modules/Findgssapi_krb5.cmake
Normal file
45
builds/cmake/Modules/Findgssapi_krb5.cmake
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
if (NOT MSVC)
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(PC_GSSAPI_KRB5 "libgssapi_krb5")
|
||||||
|
if (PC_GSSAPI_KRB5_FOUND)
|
||||||
|
set(pkg_config_names_private "${pkg_config_names_private} libgssapi_krb5")
|
||||||
|
endif()
|
||||||
|
if (NOT PC_GSSAPI_KRB5_FOUND)
|
||||||
|
pkg_check_modules(PC_GSSAPI_KRB5 "gssapi_krb5")
|
||||||
|
if (PC_GSSAPI_KRB5_FOUND)
|
||||||
|
set(pkg_config_names_private "${pkg_config_names_private} gssapi_krb5")
|
||||||
|
endif()
|
||||||
|
endif (NOT PC_GSSAPI_KRB5_FOUND)
|
||||||
|
if (PC_GSSAPI_KRB5_FOUND)
|
||||||
|
set(GSSAPI_KRB5_INCLUDE_HINTS ${PC_GSSAPI_KRB5_INCLUDE_DIRS} ${PC_GSSAPI_KRB5_INCLUDE_DIRS}/*)
|
||||||
|
set(GSSAPI_KRB5_LIBRARY_HINTS ${PC_GSSAPI_KRB5_LIBRARY_DIRS} ${PC_GSSAPI_KRB5_LIBRARY_DIRS}/*)
|
||||||
|
else()
|
||||||
|
set(pkg_config_libs_private "${pkg_config_libs_private} -lgssapi_krb5")
|
||||||
|
endif()
|
||||||
|
endif (NOT MSVC)
|
||||||
|
|
||||||
|
# some libraries install the headers is a subdirectory of the include dir
|
||||||
|
# returned by pkg-config, so use a wildcard match to improve chances of finding
|
||||||
|
# headers and libraries.
|
||||||
|
find_path(
|
||||||
|
GSSAPI_KRB5_INCLUDE_DIRS
|
||||||
|
NAMES gssapi/gssapi_krb5.h
|
||||||
|
HINTS ${GSSAPI_KRB5_INCLUDE_HINTS}
|
||||||
|
)
|
||||||
|
|
||||||
|
set (GSSAPI_NAMES libgssapi_krb5 gssapi_krb5)
|
||||||
|
if (${CMAKE_SIZEOF_VOID_P} STREQUAL 8)
|
||||||
|
set (GSSAPI_NAMES ${GSSAPI_NAMES} gssapi64)
|
||||||
|
elseif (${CMAKE_SIZEOF_VOID_P} STREQUAL 4)
|
||||||
|
set (GSSAPI_NAMES ${GSSAPI_NAMES} gssapi32)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
GSSAPI_KRB5_LIBRARIES
|
||||||
|
NAMES ${GSSAPI_NAMES}
|
||||||
|
HINTS ${GSSAPI_KRB5_LIBRARY_HINTS}
|
||||||
|
)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(gssapi_krb5 DEFAULT_MSG GSSAPI_KRB5_LIBRARIES GSSAPI_KRB5_INCLUDE_DIRS)
|
||||||
|
mark_as_advanced(GSSAPI_KRB5_FOUND GSSAPI_KRB5_LIBRARIES GSSAPI_KRB5_INCLUDE_DIRS)
|
@ -49,6 +49,10 @@ elif [ $CURVE == "libsodium" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$GSSAPI" == "enabled" ]; then
|
||||||
|
CMAKE_OPTS+=("-DWITH_GSSAPI_KRB5=ON")
|
||||||
|
fi
|
||||||
|
|
||||||
CMAKE_PREFIXES=()
|
CMAKE_PREFIXES=()
|
||||||
MAKE_PREFIXES=()
|
MAKE_PREFIXES=()
|
||||||
PARALLEL_MAKE_OPT="-j5"
|
PARALLEL_MAKE_OPT="-j5"
|
||||||
|
@ -77,6 +77,7 @@
|
|||||||
#cmakedefine ZMQ_HAVE_CURVE
|
#cmakedefine ZMQ_HAVE_CURVE
|
||||||
#cmakedefine ZMQ_USE_LIBSODIUM
|
#cmakedefine ZMQ_USE_LIBSODIUM
|
||||||
#cmakedefine SODIUM_STATIC
|
#cmakedefine SODIUM_STATIC
|
||||||
|
#cmakedefine HAVE_LIBGSSAPI_KRB5
|
||||||
#cmakedefine ZMQ_USE_GNUTLS
|
#cmakedefine ZMQ_USE_GNUTLS
|
||||||
#cmakedefine ZMQ_USE_RADIX_TREE
|
#cmakedefine ZMQ_USE_RADIX_TREE
|
||||||
#cmakedefine HAVE_IF_NAMETOINDEX
|
#cmakedefine HAVE_IF_NAMETOINDEX
|
||||||
|
@ -288,6 +288,10 @@ foreach(test ${tests})
|
|||||||
target_link_libraries(${test} ${RT_LIBRARY})
|
target_link_libraries(${test} ${RT_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WITH_GSSAPI_KRB5)
|
||||||
|
target_link_libraries(${static} ${GSSAPI_KRB5_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "QNX")
|
if(CMAKE_SYSTEM_NAME MATCHES "QNX")
|
||||||
target_link_libraries(${test} socket)
|
target_link_libraries(${test} socket)
|
||||||
target_link_libraries(${test} m)
|
target_link_libraries(${test} m)
|
||||||
|
@ -43,6 +43,10 @@ foreach(test ${unittests})
|
|||||||
target_link_libraries(${test} m)
|
target_link_libraries(${test} m)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WITH_GSSAPI_KRB5)
|
||||||
|
target_link_libraries(${static} ${GSSAPI_KRB5_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_test(
|
add_test(
|
||||||
NAME ${test}
|
NAME ${test}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user