summaryrefslogtreecommitdiffstats
path: root/cmake/Modules/FindLdap.cmake
blob: be4693bd7664ba42b1e3a45e8cb61b950b7c86bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# - Try to find Ldap
# Once done this will define
#
#  LDAP_FOUND - system has Ldap
#  LDAP_INCLUDE_DIRS - the Ldap include directory
#  LDAP_LIBRARIES - Link these to use Ldap
#  LDAP_DEFINITIONS - Compiler switches required for using Ldap
#
#  Copyright (c) 2010 Matthew Harmsen <mharmsen@redhat.com>
#
#  NOTE:  This file was generated via 'generate_findpackage_file'
#
#         Copyright (c) 2006 Alexander Neundorf <neundorf@kde.org>
#         Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
#
#  Redistribution and use is allowed according to the terms of the New
#  BSD license.
#  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#


if (LDAP_LIBRARIES AND LDAP_INCLUDE_DIRS)
  # in cache already
  set(LDAP_FOUND TRUE)
else (LDAP_LIBRARIES AND LDAP_INCLUDE_DIRS)

  find_path(LDAP_INCLUDE_DIR
    NAMES
      ldap.h lber.h
    PATHS
      /usr/include
      /usr/local/include
      /opt/local/include
      /sw/include
  )

  find_library(LDAP_LIBRARY
    NAMES
      ldap
    PATHS
      /usr/lib
      /usr/local/lib
      /opt/local/lib
      /sw/lib
  )

  find_library(LBER_LIBRARY
    NAMES
      lber
    PATHS
      /usr/lib
      /usr/local/lib
      /opt/local/lib
      /sw/lib
  )

  set(LDAP_INCLUDE_DIRS
    ${LDAP_INCLUDE_DIR}
  )

  if (LDAP_LIBRARY)
    set(LDAP_LIBRARIES
        ${LDAP_LIBRARIES}
        ${LDAP_LIBRARY}
    )
  endif (LDAP_LIBRARY)

  if (LBER_LIBRARY)
    set(LDAP_LIBRARIES
        ${LDAP_LIBRARIES}
        ${LBER_LIBRARY}
    )
  endif (LBER_LIBRARY)

  include(FindPackageHandleStandardArgs)
  find_package_handle_standard_args(Ldap DEFAULT_MSG LDAP_LIBRARIES LDAP_INCLUDE_DIRS)

  # show the LDAP_INCLUDE_DIRS and LDAP_LIBRARIES variables only in the advanced view
  mark_as_advanced(LDAP_INCLUDE_DIRS LDAP_LIBRARIES)

endif (LDAP_LIBRARIES AND LDAP_INCLUDE_DIRS)