1 # Copied from https://raw.github.com/facebook/hiphop-php/master/CMake/FindLdap.cmake
3 # - Try to find the LDAP client libraries
4 # Once done this will define
6 # LDAP_FOUND - system has libldap
7 # LDAP_INCLUDE_DIR - the ldap include directory
8 # LDAP_LIBRARIES - libldap + liblber (if found) library
9 # LBER_LIBRARIES - liblber library
11 if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
12 # Already in cache, be silent
13 set(Ldap_FIND_QUIETLY TRUE)
14 endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
17 FIND_PATH(LDAP_INCLUDE_DIR ldap.h)
18 FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap)
19 FIND_LIBRARY(LBER_LIBRARIES NAMES lber)
22 FIND_PATH(LDAP_INCLUDE_DIR winldap.h)
23 FIND_LIBRARY(LDAP_LIBRARIES NAMES wldap32)
26 if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
29 set(LDAP_LIBRARIES ${LDAP_LIBRARIES} ${LBER_LIBRARIES})
31 endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
34 if(NOT Ldap_FIND_QUIETLY)
35 message(STATUS "Found ldap: ${LDAP_LIBRARIES}")
36 endif(NOT Ldap_FIND_QUIETLY)
38 if (Ldap_FIND_REQUIRED)
39 message(FATAL_ERROR "Could NOT find ldap")
40 endif (Ldap_FIND_REQUIRED)
43 MARK_AS_ADVANCED(LDAP_INCLUDE_DIR LDAP_LIBRARIES LBER_LIBRARIES LDAP_DIR)