58 lines
2.2 KiB
CMake
58 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_package(PkgConfig QUIET)
|
|
if(PkgConfig_FOUND)
|
|
pkg_check_modules(PC_GSASL QUIET libgsasl)
|
|
endif()
|
|
|
|
find_path(GSASL_INCLUDE_DIR NAMES gsasl.h
|
|
HINTS ${PC_GSASL_INCLUDEDIR} ${PC_GSASL_INCLUDE_DIRS})
|
|
find_library(GSASL_LIBRARY NAMES gsasl
|
|
HINTS ${PC_GSASL_LIBDIR} ${PC_GSASL_LIBRARY_DIRS})
|
|
|
|
set(GSASL_VERSION "${PC_GSASL_VERSION}")
|
|
if(GSASL_INCLUDE_DIR AND NOT GSASL_VERSION AND
|
|
EXISTS "${GSASL_INCLUDE_DIR}/gsasl-version.h")
|
|
file(STRINGS "${GSASL_INCLUDE_DIR}/gsasl-version.h" _GSASL_VERSION_LINE
|
|
REGEX "^# *define GSASL_VERSION +\"[0-9]+\\.[0-9]+\\.[0-9]+\"")
|
|
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" GSASL_VERSION
|
|
"${_GSASL_VERSION_LINE}")
|
|
endif()
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(GSASL
|
|
REQUIRED_VARS GSASL_LIBRARY GSASL_INCLUDE_DIR
|
|
VERSION_VAR GSASL_VERSION)
|
|
|
|
if(GSASL_FOUND AND NOT TARGET GSASL::GSASL)
|
|
add_library(GSASL::GSASL UNKNOWN IMPORTED)
|
|
set_target_properties(GSASL::GSASL PROPERTIES
|
|
IMPORTED_LOCATION "${GSASL_LIBRARY}"
|
|
INTERFACE_INCLUDE_DIRECTORIES "${GSASL_INCLUDE_DIR}")
|
|
if(PC_GSASL_CFLAGS_OTHER)
|
|
set_property(TARGET GSASL::GSASL PROPERTY
|
|
INTERFACE_COMPILE_OPTIONS "${PC_GSASL_CFLAGS_OTHER}")
|
|
endif()
|
|
endif()
|
|
|
|
mark_as_advanced(GSASL_INCLUDE_DIR GSASL_LIBRARY)
|