56 lines
2.2 KiB
CMake
56 lines
2.2 KiB
CMake
# /****************************************************************************
|
|
# * <Novell-copyright>
|
|
# * Copyright (c) 2001 Novell, Inc. All Rights Reserved.
|
|
# *
|
|
# * This program is free software; you can redistribute it and/or
|
|
# * modify it under the terms of version 2 of the GNU General Public License
|
|
# * as published by the Free Software Foundation.
|
|
# *
|
|
# * This program is distributed in the hope that it will be useful,
|
|
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# * GNU General Public License for more details.
|
|
# *
|
|
# * You should have received a copy of the GNU General Public License
|
|
# * along with this program; if not, contact Novell, Inc.
|
|
# *
|
|
# * To contact Novell about this file by physical or electronic mail, you
|
|
# * may find current contact information at www.novell.com.
|
|
# * </Novell-copyright>
|
|
# ****************************************************************************/
|
|
|
|
find_path(CyrusSASL_INCLUDE_DIR NAMES sasl/sasl.h)
|
|
find_library(CyrusSASL_LIBRARY NAMES sasl2)
|
|
|
|
if(CyrusSASL_INCLUDE_DIR)
|
|
file(STRINGS "${CyrusSASL_INCLUDE_DIR}/sasl/sasl.h"
|
|
_CyrusSASL_VERSION_LINES
|
|
REGEX "^#define SASL_VERSION_(MAJOR|MINOR|STEP)[ \t]+[0-9]+")
|
|
foreach(_component MAJOR MINOR STEP)
|
|
string(REGEX MATCH
|
|
"SASL_VERSION_${_component}[ \t]+([0-9]+)"
|
|
_CyrusSASL_VERSION_MATCH "${_CyrusSASL_VERSION_LINES}")
|
|
set(_CyrusSASL_VERSION_${_component} "${CMAKE_MATCH_1}")
|
|
endforeach()
|
|
if(DEFINED _CyrusSASL_VERSION_MAJOR AND
|
|
DEFINED _CyrusSASL_VERSION_MINOR AND
|
|
DEFINED _CyrusSASL_VERSION_STEP)
|
|
set(CyrusSASL_VERSION
|
|
"${_CyrusSASL_VERSION_MAJOR}.${_CyrusSASL_VERSION_MINOR}.${_CyrusSASL_VERSION_STEP}")
|
|
endif()
|
|
endif()
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(CyrusSASL
|
|
REQUIRED_VARS CyrusSASL_LIBRARY CyrusSASL_INCLUDE_DIR
|
|
VERSION_VAR CyrusSASL_VERSION)
|
|
|
|
if(CyrusSASL_FOUND AND NOT TARGET CyrusSASL::CyrusSASL)
|
|
add_library(CyrusSASL::CyrusSASL UNKNOWN IMPORTED)
|
|
set_target_properties(CyrusSASL::CyrusSASL PROPERTIES
|
|
IMPORTED_LOCATION "${CyrusSASL_LIBRARY}"
|
|
INTERFACE_INCLUDE_DIRECTORIES "${CyrusSASL_INCLUDE_DIR}")
|
|
endif()
|
|
|
|
mark_as_advanced(CyrusSASL_INCLUDE_DIR CyrusSASL_LIBRARY)
|