56 lines
2.4 KiB
CMake
56 lines
2.4 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(GMime_INCLUDE_DIR NAMES gmime/gmime.h
|
|
PATH_SUFFIXES gmime-3.0 gmime-2.6 gmime-2.4 gmime-2.2 gmime-2.0 gmime)
|
|
find_library(GMime_LIBRARY NAMES gmime-3.0 gmime-2.6 gmime-2.4 gmime-2.2 gmime-2.0 gmime)
|
|
|
|
if(GMime_INCLUDE_DIR AND EXISTS "${GMime_INCLUDE_DIR}/gmime/gmime-version.h")
|
|
file(STRINGS "${GMime_INCLUDE_DIR}/gmime/gmime-version.h"
|
|
_GMime_VERSION_LINES
|
|
REGEX "^#define GMIME_(MAJOR|MINOR|MICRO)_VERSION[ \t]+\\([0-9]+U?\\)")
|
|
foreach(_component MAJOR MINOR MICRO)
|
|
string(REGEX MATCH "GMIME_${_component}_VERSION[ \t]+\\(([0-9]+)U?\\)"
|
|
_GMime_VERSION_MATCH "${_GMime_VERSION_LINES}")
|
|
set(_GMime_VERSION_${_component} "${CMAKE_MATCH_1}")
|
|
endforeach()
|
|
if(DEFINED _GMime_VERSION_MAJOR AND DEFINED _GMime_VERSION_MINOR AND
|
|
DEFINED _GMime_VERSION_MICRO)
|
|
set(GMime_VERSION
|
|
"${_GMime_VERSION_MAJOR}.${_GMime_VERSION_MINOR}.${_GMime_VERSION_MICRO}")
|
|
endif()
|
|
endif()
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(GMime
|
|
REQUIRED_VARS GMime_LIBRARY GMime_INCLUDE_DIR
|
|
VERSION_VAR GMime_VERSION)
|
|
|
|
if(GMime_FOUND AND NOT TARGET GMime::GMime)
|
|
add_library(GMime::GMime UNKNOWN IMPORTED)
|
|
set_target_properties(GMime::GMime PROPERTIES
|
|
IMPORTED_LOCATION "${GMime_LIBRARY}"
|
|
INTERFACE_INCLUDE_DIRECTORIES "${GMime_INCLUDE_DIR}"
|
|
INTERFACE_LINK_LIBRARIES "GLib2::GObject")
|
|
endif()
|
|
|
|
mark_as_advanced(GMime_INCLUDE_DIR GMime_LIBRARY)
|