Updating submodules
[hiphop-php.git] / CMake / FindLdap.cmake
blobc2cb803797f4b9c6d50fc78c915ee2d06bbf9bef
1 # - Try to find the LDAP client libraries
2 # Once done this will define
4 #  LDAP_FOUND - system has libldap
5 #  LDAP_INCLUDE_DIR - the ldap include directory
6 #  LDAP_LIBRARIES - libldap + liblber (if found) library
7 #  LBER_LIBRARIES - liblber library
9 if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
10   # Already in cache, be silent
11   set(Ldap_FIND_QUIETLY TRUE)
12 endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
14 if(UNIX)
15   FIND_PATH(LDAP_INCLUDE_DIR ldap.h)
16   FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap)
17   FIND_LIBRARY(LBER_LIBRARIES NAMES lber)
19 else(UNIX)
20   FIND_PATH(LDAP_INCLUDE_DIR winldap.h)
21   FIND_LIBRARY(LDAP_LIBRARIES NAMES wldap32)
22 endif(UNIX)
24 if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
25   set(LDAP_FOUND TRUE)
26   if(LBER_LIBRARIES)
27     set(LDAP_LIBRARIES ${LDAP_LIBRARIES} ${LBER_LIBRARIES})
28   endif(LBER_LIBRARIES)
29 endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
31 if(LDAP_FOUND)
32   if(NOT Ldap_FIND_QUIETLY)
33     message(STATUS "Found ldap: ${LDAP_LIBRARIES}")
34   endif(NOT Ldap_FIND_QUIETLY)
35 else(LDAP_FOUND)
36   if (Ldap_FIND_REQUIRED)
37     message(FATAL_ERROR "Could NOT find ldap")
38   endif (Ldap_FIND_REQUIRED)
39 endif(LDAP_FOUND)
41 MARK_AS_ADVANCED(LDAP_INCLUDE_DIR LDAP_LIBRARIES LBER_LIBRARIES)