File: FindSASL2.cmake

package info (click to toggle)
mongo-c-driver 1.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 31,116 kB
  • sloc: ansic: 124,705; python: 2,971; sh: 138; makefile: 23
file content (49 lines) | stat: -rw-r--r-- 1,489 bytes parent folder | download | duplicates (2)
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
include (CheckSymbolExists)

message (STATUS "Searching for sasl/sasl.h")
find_path (
    SASL_INCLUDE_DIRS NAMES sasl/sasl.h
    PATHS /include /usr/include /usr/local/include /usr/share/include /opt/include c:/sasl/include
    DOC "Searching for sasl/sasl.h")

if (SASL_INCLUDE_DIRS)
    message (STATUS "  Found in ${SASL_INCLUDE_DIRS}")
else ()
    message (STATUS "  Not found (specify -DCMAKE_INCLUDE_PATH=/path/to/sasl/include for SASL support)")
endif ()

message (STATUS "Searching for libsasl2")
find_library (
    SASL_LIBRARIES NAMES sasl2
    PATHS /usr/lib /lib /usr/local/lib /usr/share/lib /opt/lib /opt/share/lib /var/lib c:/sasl/lib
    DOC "Searching for libsasl2")

if (SASL_LIBRARIES)
    message (STATUS "  Found ${SASL_LIBRARIES}")
else ()
    message (STATUS "  Not found (specify -DCMAKE_LIBRARY_PATH=/path/to/sasl/lib for SASL support)")
endif ()

if (SASL_INCLUDE_DIRS AND SASL_LIBRARIES)
    set (SASL_FOUND 1)

    check_symbol_exists (
        sasl_client_done
        ${SASL_INCLUDE_DIRS}/sasl/sasl.h
        MONGOC_HAVE_SASL_CLIENT_DONE)

    if (MONGOC_HAVE_SASL_CLIENT_DONE)
        set (MONGOC_HAVE_SASL_CLIENT_DONE 1)
    else ()
        set (MONGOC_HAVE_SASL_CLIENT_DONE 0)
    endif ()
else ()
    if (ENABLE_SASL STREQUAL AUTO)
        set (SASL_FOUND 0)
        set (SASL_INCLUDE_DIRS "")
        set (SASL_LIBRARIES "")
        set (MONGOC_HAVE_SASL_CLIENT_DONE 0)
    else ()
        message (FATAL_ERROR "  SASL not found")
    endif ()
endif ()