Warning, /frameworks/kio/cmake/FindGSSAPI.cmake is written in an unsupported language. File is not indexed.

0001 # - Try to detect the GSSAPI support
0002 # Once done this will define
0003 #
0004 #  GSSAPI_FOUND - system supports GSSAPI
0005 #  GSSAPI_INCS - the GSSAPI include directory
0006 #  GSSAPI_LIBS - the libraries needed to use GSSAPI
0007 #  GSSAPI_FLAVOR - the type of API - MIT or HEIMDAL
0008 
0009 # SPDX-FileCopyrightText: 2006 Pino Toscano <toscano.pino@tiscali.it>
0010 #
0011 # SPDX-License-Identifier: BSD-3-Clause
0012 
0013 if(GSSAPI_LIBS AND GSSAPI_FLAVOR)
0014 
0015   # in cache already
0016   set(GSSAPI_FOUND TRUE)
0017 
0018 else(GSSAPI_LIBS AND GSSAPI_FLAVOR)
0019 
0020   find_program(KRB5_CONFIG NAMES krb5-config PATHS
0021      /opt/local/bin
0022      /usr/lib/mit/bin # e.g. openSUSE
0023      ONLY_CMAKE_FIND_ROOT_PATH               # this is required when cross compiling with cmake 2.6 and ignored with cmake 2.4, Alex
0024   )
0025   mark_as_advanced(KRB5_CONFIG)
0026   
0027   #reset vars
0028   set(GSSAPI_INCS)
0029   set(GSSAPI_LIBS)
0030   set(GSSAPI_FLAVOR)
0031   
0032   if(KRB5_CONFIG)
0033   
0034     set(HAVE_KRB5_GSSAPI TRUE)
0035     exec_program(${KRB5_CONFIG} ARGS --libs gssapi RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GSSAPI_LIBS)
0036     if(_return_VALUE)
0037       message(STATUS "GSSAPI configure check failed.")
0038       set(HAVE_KRB5_GSSAPI FALSE)
0039     endif(_return_VALUE)
0040   
0041     exec_program(${KRB5_CONFIG} ARGS --cflags gssapi RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GSSAPI_INCS)
0042     string(REGEX REPLACE "(\r?\n)+$" "" GSSAPI_INCS "${GSSAPI_INCS}")
0043     string(REGEX REPLACE " *-I" ";" GSSAPI_INCS "${GSSAPI_INCS}")
0044 
0045     exec_program(${KRB5_CONFIG} ARGS --vendor RETURN_VALUE _return_VALUE OUTPUT_VARIABLE gssapi_flavor_tmp)
0046     set(GSSAPI_FLAVOR_MIT)
0047     if(gssapi_flavor_tmp MATCHES ".*Massachusetts.*")
0048       set(GSSAPI_FLAVOR "MIT")
0049     else(gssapi_flavor_tmp MATCHES ".*Massachusetts.*")
0050       set(GSSAPI_FLAVOR "HEIMDAL")
0051     endif(gssapi_flavor_tmp MATCHES ".*Massachusetts.*")
0052   
0053     if(NOT HAVE_KRB5_GSSAPI)
0054       if (gssapi_flavor_tmp MATCHES "Sun Microsystems.*")
0055          message(STATUS "Solaris Kerberos does not have GSSAPI; this is normal.")
0056          set(GSSAPI_LIBS)
0057          set(GSSAPI_INCS)
0058       else(gssapi_flavor_tmp MATCHES "Sun Microsystems.*")
0059          message(WARNING "${KRB5_CONFIG} failed unexpectedly.")
0060       endif(gssapi_flavor_tmp MATCHES "Sun Microsystems.*")
0061     endif(NOT HAVE_KRB5_GSSAPI)
0062 
0063     if(GSSAPI_LIBS) # GSSAPI_INCS can be also empty, so don't rely on that
0064       set(GSSAPI_FOUND TRUE)
0065       message(STATUS "Found GSSAPI: ${GSSAPI_LIBS}")
0066 
0067       set(GSSAPI_INCS ${GSSAPI_INCS})
0068       set(GSSAPI_LIBS ${GSSAPI_LIBS})
0069       set(GSSAPI_FLAVOR ${GSSAPI_FLAVOR})
0070 
0071       mark_as_advanced(GSSAPI_INCS GSSAPI_LIBS GSSAPI_FLAVOR)
0072 
0073     endif(GSSAPI_LIBS)
0074   
0075   endif(KRB5_CONFIG)
0076 
0077 endif(GSSAPI_LIBS AND GSSAPI_FLAVOR)