Debian Codegraph @

tools/cmake/Modules/FindCyrusSASL.cmake

raw
1 #
2 # Licensed to the Apache Software Foundation (ASF) under one
3 # or more contributor license agreements. See the NOTICE file
4 # distributed with this work for additional information
5 # regarding copyright ownership. The ASF licenses this file
6 # to you under the Apache License, Version 2.0 (the
7 # "License"); you may not use this file except in compliance
8 # with the License. You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing,
13 # software distributed under the License is distributed on an
14 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 # KIND, either express or implied. See the License for the
16 # specific language governing permissions and limitations
17 # under the License.
18 #
19
20 #.rst
21 # FindCyrusSASL
22 #--------------
23 #
24 # Find Cyrus SASL include dirs and libraries.
25 #
26 # Sets the following variables:
27 #
28 # CyrusSASL_FOUND - True if headers and requested libraries were found
29 # CyrusSASL_INCLUDE_DIRS - Cyrus SASL include directories
30 # CyrusSASL_LIBRARIES - Link these to use Cyrus SASL library.
31 #
32
33 find_package (PkgConfig)
34 pkg_check_modules (PC_CyrusSASL QUIET libsasl2)
35
36 find_library (CyrusSASL_LIBRARY
37 NAMES sasl2
38 PATHS ${PC_CyrusSASL_LIBRARY_DIRS}
39 )
40 find_path (CyrusSASL_INCLUDE_DIR
41 NAMES sasl/sasl.h
42 PATHS ${PC_CyrusSASL_INCLUDE_DIRS}
43 PATH_SUFFIXES include
44 )
45
46 set (CyrusSASL_VERSION ${PC_CyrusSASL_VERSION})
47
48 include (FindPackageHandleStandardArgs)
49 find_package_handle_standard_args (CyrusSASL
50 FOUND_VAR CyrusSASL_FOUND
51 REQUIRED_VARS CyrusSASL_LIBRARY CyrusSASL_INCLUDE_DIR
52 VERSION_VAR CyrusSASL_VERSION
53 )
54
55 if (CyrusSASL_FOUND)
56 set (CyrusSASL_LIBRARIES ${CyrusSASL_LIBRARY})
57 set (CyrusSASL_INCLUDE_DIRS ${CyrusSASL_INCLUDE_DIR})
58
59 if (NOT TARGET CyrusSASL::CyrusSASL)
60 add_library(CyrusSASL::CyrusSASL UNKNOWN IMPORTED)
61 set_target_properties(CyrusSASL::CyrusSASL
62 PROPERTIES
63 IMPORTED_LOCATION "${CyrusSASL_LIBRARY}"
64 INTERFACE_INCLUDE_DIRECTORIES "${CyrusSASL_INCLUDE_DIR}"
65 )
66 endif ()
67
68 # Find saslpasswd2 executable to generate test config
69 find_program (CyrusSASL_Saslpasswd_EXECUTABLE
70 NAMES saslpasswd2
71 DOC "Program used to make the Cyrus SASL user database")
72
73 mark_as_advanced (CyrusSASL_Saslpasswd_EXECUTABLE)
74
75 endif ()
76
77 mark_as_advanced (CyrusSASL_LIBRARY CyrusSASL_INCLUDE_DIR)
78