Commit 13cbb881 authored by Christophe Giboudeaux's avatar Christophe Giboudeaux

Use the same FindSasl2.cmake as kldap.

parent 504b0e68
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#.rst:
# FindSasl2
# ---------
#
# - Try to find the sasl2 directory library
# Once done this will define
# Try to find the SASL2 library.
#
# Sasl2_FOUND - system has SASL2
# Sasl2_INCLUDE_DIRS - the SASL2 include directory
# Sasl2_LIBRARIES - The libraries needed to use SASL2
# Copyright (c) 2006, 2007 Laurent Montel, <montel@kde.org>
# This will define the following variables:
#
# ``Sasl2_FOUND``
# System has SASL2.
#
# ``Sasl2_VERSION``
# The version of SASL2.
#
# ``Sasl2_INCLUDE_DIRS``
# This should be passed to target_include_directories() if
# the target is not used for linking.
#
# ``Sasl2_LIBRARIES``
# The SASL2 library.
# This can be passed to target_link_libraries() instead of
# the ``Sasl2::Sasl2`` target
#
# If ``Sasl2_FOUND`` is TRUE, the following imported target
# will be available:
#
# ``Sasl2::Sasl2``
# The SASL2 library
#
# Since pre-5.0.0.
#
# Imported target since 5.1.41
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#=============================================================================
# Copyright 2006, 2007 Laurent Montel <montel@kde.org>
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
# Note: libsasl2.pc doesn't export the include dir.
# NOTE: libsasl2.pc doesn't export the include dir.
find_package(PkgConfig QUIET)
pkg_check_modules(PC_Sasl2 libsasl2)
find_path(Sasl2_INCLUDE_DIRS sasl/sasl.h
)
find_path(Sasl2_INCLUDE_DIRS NAMES sasl/sasl.h)
# libsasl2 add for windows, because the windows package of cyrus-sasl2
# contains a libsasl2 also for msvc which is not standard conform
......@@ -49,5 +96,18 @@ find_package_handle_standard_args(Sasl2
REQUIRED_VARS Sasl2_LIBRARIES Sasl2_INCLUDE_DIRS
VERSION_VAR Sasl2_VERSION
)
if(Sasl2_FOUND AND NOT TARGET Sasl2::Sasl2)
add_library(Sasl2::Sasl2 UNKNOWN IMPORTED)
set_target_properties(Sasl2::Sasl2 PROPERTIES
IMPORTED_LOCATION "${Sasl2_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${Sasl2_INCLUDE_DIRS}")
endif()
mark_as_advanced(Sasl2_LIBRARIES Sasl2_INCLUDE_DIRS Sasl2_VERSION)
include(FeatureSummary)
set_package_properties(Sasl2 PROPERTIES
URL "http://www.cyrussasl.org/"
DESCRIPTION "The Cyrus-sasl library."
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment