Warning, /frameworks/extra-cmake-modules/find-modules/FindSasl2.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2006, 2007 Laurent Montel <montel@kde.org> 0002 # 0003 # SPDX-License-Identifier: BSD-3-Clause 0004 0005 #[=======================================================================[.rst: 0006 FindSasl2 0007 --------- 0008 0009 Try to find the SASL2 library. 0010 0011 This will define the following variables: 0012 0013 ``Sasl2_FOUND`` 0014 System has SASL2. 0015 0016 ``Sasl2_VERSION`` 0017 The version of SASL2. 0018 0019 ``Sasl2_INCLUDE_DIRS`` 0020 This should be passed to target_include_directories() if 0021 the target is not used for linking. 0022 0023 ``Sasl2_LIBRARIES`` 0024 The SASL2 library. 0025 This can be passed to target_link_libraries() instead of 0026 the ``Sasl2::Sasl2`` target 0027 0028 If ``Sasl2_FOUND`` is TRUE, the following imported target 0029 will be available: 0030 0031 ``Sasl2::Sasl2`` 0032 The SASL2 library 0033 0034 Since 5.41.0. 0035 #]=======================================================================] 0036 0037 # NOTE: libsasl2.pc doesn't export the include dir. 0038 find_package(PkgConfig QUIET) 0039 pkg_check_modules(PC_Sasl2 libsasl2) 0040 0041 find_path(Sasl2_INCLUDE_DIRS NAMES sasl/sasl.h) 0042 0043 # libsasl2 add for windows, because the windows package of cyrus-sasl2 0044 # contains a libsasl2 also for msvc which is not standard conform 0045 find_library(Sasl2_LIBRARIES 0046 NAMES sasl2 libsasl2 0047 HINTS ${PC_Sasl2_LIBRARY_DIRS} 0048 ) 0049 0050 set(Sasl2_VERSION "${PC_Sasl2_VERSION}") 0051 0052 if(NOT Sasl2_VERSION) 0053 if(EXISTS "${Sasl2_INCLUDE_DIRS}/sasl/sasl.h") 0054 file(READ "${Sasl2_INCLUDE_DIRS}/sasl/sasl.h" SASL2_H_CONTENT) 0055 string(REGEX MATCH "#define SASL_VERSION_MAJOR[ ]+[0-9]+" SASL2_VERSION_MAJOR_MATCH ${SASL2_H_CONTENT}) 0056 string(REGEX MATCH "#define SASL_VERSION_MINOR[ ]+[0-9]+" SASL2_VERSION_MINOR_MATCH ${SASL2_H_CONTENT}) 0057 string(REGEX MATCH "#define SASL_VERSION_STEP[ ]+[0-9]+" SASL2_VERSION_STEP_MATCH ${SASL2_H_CONTENT}) 0058 0059 string(REGEX REPLACE ".*_MAJOR[ ]+(.*)" "\\1" SASL2_VERSION_MAJOR ${SASL2_VERSION_MAJOR_MATCH}) 0060 string(REGEX REPLACE ".*_MINOR[ ]+(.*)" "\\1" SASL2_VERSION_MINOR ${SASL2_VERSION_MINOR_MATCH}) 0061 string(REGEX REPLACE ".*_STEP[ ]+(.*)" "\\1" SASL2_VERSION_STEP ${SASL2_VERSION_STEP_MATCH}) 0062 0063 set(Sasl2_VERSION "${SASL2_VERSION_MAJOR}.${SASL2_VERSION_MINOR}.${SASL2_VERSION_STEP}") 0064 else() 0065 # Could not find the version 0066 set(Sasl2_VERSION "0.0.0") 0067 endif() 0068 endif() 0069 0070 include(FindPackageHandleStandardArgs) 0071 0072 find_package_handle_standard_args(Sasl2 0073 FOUND_VAR Sasl2_FOUND 0074 REQUIRED_VARS Sasl2_LIBRARIES Sasl2_INCLUDE_DIRS 0075 VERSION_VAR Sasl2_VERSION 0076 ) 0077 if(Sasl2_FOUND AND NOT TARGET Sasl2::Sasl2) 0078 add_library(Sasl2::Sasl2 UNKNOWN IMPORTED) 0079 set_target_properties(Sasl2::Sasl2 PROPERTIES 0080 IMPORTED_LOCATION "${Sasl2_LIBRARIES}" 0081 INTERFACE_INCLUDE_DIRECTORIES "${Sasl2_INCLUDE_DIRS}") 0082 endif() 0083 0084 mark_as_advanced(Sasl2_LIBRARIES Sasl2_INCLUDE_DIRS Sasl2_VERSION) 0085 0086 include(FeatureSummary) 0087 set_package_properties(Sasl2 PROPERTIES 0088 URL "https://www.cyrusimap.org/sasl/" 0089 DESCRIPTION "The Cyrus-sasl library." 0090 ) 0091