Warning, /pim/kimap2/cmake/FindSasl2.cmake is written in an unsupported language. File is not indexed.

0001 #
0002 # - Try to find the sasl2 directory library
0003 # Once done this will define
0004 #
0005 #  Sasl2_FOUND - system has SASL2
0006 #  Sasl2_INCLUDE_DIRS - the SASL2 include directory
0007 #  Sasl2_LIBRARIES - The libraries needed to use SASL2
0008 
0009 # Copyright (c) 2006, 2007 Laurent Montel, <montel@kde.org>
0010 #
0011 # Redistribution and use is allowed according to the terms of the BSD license.
0012 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
0013 
0014 # Note: libsasl2.pc doesn't export the include dir.
0015 find_package(PkgConfig QUIET)
0016 pkg_check_modules(PC_Sasl2 libsasl2)
0017 
0018 find_path(Sasl2_INCLUDE_DIRS sasl/sasl.h
0019 )
0020 
0021 # libsasl2 add for windows, because the windows package of cyrus-sasl2
0022 # contains a libsasl2 also for msvc which is not standard conform
0023 find_library(Sasl2_LIBRARIES
0024   NAMES sasl2 libsasl2
0025   HINTS ${PC_Sasl2_LIBRARY_DIRS}
0026 )
0027 
0028 set(Sasl2_VERSION ${PC_Sasl2_VERSION})
0029 
0030 if(NOT Sasl2_VERSION)
0031   if(EXISTS ${Sasl2_INCLUDE_DIRS}/sasl/sasl.h)
0032     file(READ ${Sasl2_INCLUDE_DIRS}/sasl/sasl.h SASL2_H_CONTENT)
0033     string(REGEX MATCH "#define SASL_VERSION_MAJOR[ ]+[0-9]+" SASL2_VERSION_MAJOR_MATCH ${SASL2_H_CONTENT})
0034     string(REGEX MATCH "#define SASL_VERSION_MINOR[ ]+[0-9]+" SASL2_VERSION_MINOR_MATCH ${SASL2_H_CONTENT})
0035     string(REGEX MATCH "#define SASL_VERSION_STEP[ ]+[0-9]+" SASL2_VERSION_STEP_MATCH ${SASL2_H_CONTENT})
0036 
0037     string(REGEX REPLACE ".*_MAJOR[ ]+(.*)" "\\1" SASL2_VERSION_MAJOR ${SASL2_VERSION_MAJOR_MATCH})
0038     string(REGEX REPLACE ".*_MINOR[ ]+(.*)" "\\1" SASL2_VERSION_MINOR ${SASL2_VERSION_MINOR_MATCH})
0039     string(REGEX REPLACE ".*_STEP[ ]+(.*)" "\\1"  SASL2_VERSION_STEP  ${SASL2_VERSION_STEP_MATCH})
0040 
0041     set(Sasl2_VERSION "${SASL2_VERSION_MAJOR}.${SASL2_VERSION_MINOR}.${SASL2_VERSION_STEP}")
0042   endif()
0043 endif()
0044 
0045 include(FindPackageHandleStandardArgs)
0046 
0047 find_package_handle_standard_args(Sasl2
0048     FOUND_VAR Sasl2_FOUND
0049     REQUIRED_VARS Sasl2_LIBRARIES Sasl2_INCLUDE_DIRS
0050     VERSION_VAR Sasl2_VERSION
0051 )
0052 
0053 mark_as_advanced(Sasl2_LIBRARIES Sasl2_INCLUDE_DIRS Sasl2_VERSION)