mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
CMake: Add Requires.private information for GSSAPI to .pc file
Try to find GSSAPI via pkg-config. If found, add the appropriate module name, depending on the flavor, to the libssh.pc file so that the pkg-config can report the list of libraries needed when linking against the static library version of libssh. Fix #293 Signed-off-by: John Thacker <johnthacker@gmail.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
committed by
Jakub Jelen
parent
7e3935e7d2
commit
bf2b8954e8
@@ -41,6 +41,8 @@ macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source buil
|
|||||||
# Copy library files to a lib sub-directory
|
# Copy library files to a lib sub-directory
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||||
|
|
||||||
|
set(LIBSSSH_PC_REQUIRES_PRIVATE "")
|
||||||
|
|
||||||
# search for libraries
|
# search for libraries
|
||||||
if (WITH_ZLIB)
|
if (WITH_ZLIB)
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
@@ -66,6 +68,7 @@ find_package(Threads)
|
|||||||
|
|
||||||
if (WITH_GSSAPI)
|
if (WITH_GSSAPI)
|
||||||
find_package(GSSAPI)
|
find_package(GSSAPI)
|
||||||
|
list(APPEND LIBSSH_PC_REQUIRES_PRIVATE ${GSSAPI_PC_REQUIRES})
|
||||||
endif (WITH_GSSAPI)
|
endif (WITH_GSSAPI)
|
||||||
|
|
||||||
if (WITH_NACL)
|
if (WITH_NACL)
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
# GSSAPI_INCLUDE_DIR - the GSSAPI include directory
|
# GSSAPI_INCLUDE_DIR - the GSSAPI include directory
|
||||||
# GSSAPI_LIBRARIES - Link these to use GSSAPI
|
# GSSAPI_LIBRARIES - Link these to use GSSAPI
|
||||||
# GSSAPI_DEFINITIONS - Compiler switches required for using GSSAPI
|
# GSSAPI_DEFINITIONS - Compiler switches required for using GSSAPI
|
||||||
|
# GSSAPI_PC_REQUIRES - pkg-config module name if found, needed for
|
||||||
|
# Requires.private for static linking
|
||||||
#
|
#
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Copyright (c) 2013 Andreas Schneider <asn@cryptomilk.org>
|
# Copyright (c) 2013 Andreas Schneider <asn@cryptomilk.org>
|
||||||
@@ -24,12 +26,23 @@
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set(_mit_modname "mit-krb5-gssapi")
|
||||||
|
set(_heimdal_modname "heimdal-gssapi")
|
||||||
|
|
||||||
|
if(NOT _GSSAPI_ROOT_HINTS AND NOT _GSSAPI_ROOT_PATHS)
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
if (PKG_CONFIG_FOUND)
|
||||||
|
pkg_search_module(_GSSAPI ${_mit_modname} ${_heimdal_modname})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
find_path(GSSAPI_ROOT_DIR
|
find_path(GSSAPI_ROOT_DIR
|
||||||
NAMES
|
NAMES
|
||||||
include/gssapi.h
|
include/gssapi.h
|
||||||
include/gssapi/gssapi.h
|
include/gssapi/gssapi.h
|
||||||
HINTS
|
HINTS
|
||||||
${_GSSAPI_ROOT_HINTS}
|
${_GSSAPI_ROOT_HINTS}
|
||||||
|
"${_GSSAPI_INCLUDEDIR}"
|
||||||
PATHS
|
PATHS
|
||||||
${_GSSAPI_ROOT_PATHS}
|
${_GSSAPI_ROOT_PATHS}
|
||||||
)
|
)
|
||||||
@@ -317,5 +330,15 @@ endif (GSSAPI_FLAVOR_HEIMDAL)
|
|||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(GSSAPI DEFAULT_MSG GSSAPI_LIBRARIES GSSAPI_INCLUDE_DIR)
|
find_package_handle_standard_args(GSSAPI DEFAULT_MSG GSSAPI_LIBRARIES GSSAPI_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(GSSAPI_FOUND)
|
||||||
|
if(_GSSAPI_FOUND) # via pkg-config
|
||||||
|
if (GSSAPI_FLAVOR_MIT)
|
||||||
|
set(GSSAPI_PC_REQUIRES ${_mit_modname})
|
||||||
|
elseif (GSSAPI_FLAVOR_HEIMDAL)
|
||||||
|
set(GSSAPI_PC_REQUIRES ${_heimdal_modname})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# show the GSSAPI_INCLUDE_DIR and GSSAPI_LIBRARIES variables only in the advanced view
|
# show the GSSAPI_INCLUDE_DIR and GSSAPI_LIBRARIES variables only in the advanced view
|
||||||
mark_as_advanced(GSSAPI_INCLUDE_DIR GSSAPI_LIBRARIES)
|
mark_as_advanced(GSSAPI_INCLUDE_DIR GSSAPI_LIBRARIES)
|
||||||
|
|||||||
@@ -8,3 +8,4 @@ Description: The SSH Library
|
|||||||
Version: @PROJECT_VERSION@
|
Version: @PROJECT_VERSION@
|
||||||
Libs: -L${libdir} -lssh
|
Libs: -L${libdir} -lssh
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
Requires.private: @LIBSSH_PC_REQUIRES_PRIVATE@
|
||||||
|
|||||||
Reference in New Issue
Block a user