X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=cmake%2FFindLdap.cmake;fp=cmake%2FFindLdap.cmake;h=e29d6a2adf7ae511a88e4772bc7ddadb510e13ba;hp=0000000000000000000000000000000000000000;hb=61aac1868f15babb7086d8bc6bbcff530346f438;hpb=dd69349ca91776432a4a53aa4d18dd8ef018cd26 diff --git a/cmake/FindLdap.cmake b/cmake/FindLdap.cmake new file mode 100644 index 00000000..e29d6a2a --- /dev/null +++ b/cmake/FindLdap.cmake @@ -0,0 +1,43 @@ +# Copied from https://raw.github.com/facebook/hiphop-php/master/CMake/FindLdap.cmake + +# - Try to find the LDAP client libraries +# Once done this will define +# +# LDAP_FOUND - system has libldap +# LDAP_INCLUDE_DIR - the ldap include directory +# LDAP_LIBRARIES - libldap + liblber (if found) library +# LBER_LIBRARIES - liblber library + +if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES) + # Already in cache, be silent + set(Ldap_FIND_QUIETLY TRUE) +endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES) + +if(UNIX) + FIND_PATH(LDAP_INCLUDE_DIR ldap.h) + FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap) + FIND_LIBRARY(LBER_LIBRARIES NAMES lber) + +else(UNIX) + FIND_PATH(LDAP_INCLUDE_DIR winldap.h) + FIND_LIBRARY(LDAP_LIBRARIES NAMES wldap32) +endif(UNIX) + +if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES) + set(LDAP_FOUND TRUE) + if(LBER_LIBRARIES) + set(LDAP_LIBRARIES ${LDAP_LIBRARIES} ${LBER_LIBRARIES}) + endif(LBER_LIBRARIES) +endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES) + +if(LDAP_FOUND) + if(NOT Ldap_FIND_QUIETLY) + message(STATUS "Found ldap: ${LDAP_LIBRARIES}") + endif(NOT Ldap_FIND_QUIETLY) +else(LDAP_FOUND) + if (Ldap_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find ldap") + endif (Ldap_FIND_REQUIRED) +endif(LDAP_FOUND) + +MARK_AS_ADVANCED(LDAP_INCLUDE_DIR LDAP_LIBRARIES LBER_LIBRARIES LDAP_DIR)