2010-09-25 15:38:12 +00:00
|
|
|
#
|
2013-09-23 21:45:55 +00:00
|
|
|
# - Try to find GModule2
|
2010-09-25 15:38:12 +00:00
|
|
|
# Find GModule headers, libraries and the answer to all questions.
|
|
|
|
#
|
|
|
|
# GMODULE2_FOUND True if GMODULE2 got found
|
2013-09-23 21:45:55 +00:00
|
|
|
# GMODULE2_INCLUDE_DIRS Location of GMODULE2 headers
|
|
|
|
# GMODULE2_LIBRARIES List of libraries to use GMODULE2
|
2010-09-25 15:38:12 +00:00
|
|
|
#
|
|
|
|
# Copyright (c) 2008 Bjoern Ricks <bjoern.ricks@googlemail.com>
|
|
|
|
#
|
|
|
|
# Redistribution and use is allowed according to the terms of the New
|
|
|
|
# BSD license.
|
|
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
#
|
|
|
|
|
2017-11-18 20:16:32 +00:00
|
|
|
if( NOT WIN32 )
|
|
|
|
include( FindPkgConfig )
|
2010-09-25 15:38:12 +00:00
|
|
|
|
2017-11-18 20:16:32 +00:00
|
|
|
if( GMODULE2_FIND_REQUIRED )
|
|
|
|
set( _pkgconfig_REQUIRED "REQUIRED" )
|
|
|
|
else()
|
|
|
|
set( _pkgconfig_REQUIRED "" )
|
|
|
|
endif()
|
2010-09-25 15:38:12 +00:00
|
|
|
|
2017-11-18 20:16:32 +00:00
|
|
|
if( GMODULE2_MIN_VERSION )
|
|
|
|
pkg_search_module( GMODULE2 ${_pkgconfig_REQUIRED} gmodule-2.0>=${GMODULE2_MIN_VERSION} )
|
|
|
|
else()
|
|
|
|
pkg_search_module( GMODULE2 ${_pkgconfig_REQUIRED} gmodule-2.0 )
|
|
|
|
endif()
|
2013-12-01 10:34:01 +00:00
|
|
|
endif()
|
2010-09-25 15:38:12 +00:00
|
|
|
|
2014-06-16 18:31:37 +00:00
|
|
|
if( GMODULE2_FOUND )
|
|
|
|
if( GMODULE2_LIBRARY_DIRS )
|
|
|
|
LINK_DIRECTORIES( ${GMODULE2_LIBRARY_DIRS} )
|
|
|
|
endif()
|
|
|
|
else()
|
2013-12-01 10:34:01 +00:00
|
|
|
include( FindWSWinLibs )
|
|
|
|
if( BUILD_wireshark )
|
|
|
|
if( ENABLE_GTK3 )
|
|
|
|
FindWSWinLibs( "gtk3" "GMODULE2_HINTS" )
|
|
|
|
else()
|
|
|
|
FindWSWinLibs( "gtk2" "GMODULE2_HINTS" )
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message( ERROR "Unsupported build setup" )
|
|
|
|
endif()
|
|
|
|
find_path( GMODULE2_INCLUDE_DIRS
|
2013-10-04 13:22:36 +00:00
|
|
|
NAMES
|
|
|
|
gmodule.h
|
|
|
|
PATH_SUFFIXES
|
|
|
|
glib-2.0
|
|
|
|
HINTS
|
|
|
|
"${GMODULE2_HINTS}/include"
|
|
|
|
)
|
2014-06-16 18:31:37 +00:00
|
|
|
find_library( GMODULE2_LIBRARIES NAMES gmodule-2.0 gmodule HINTS "${GMODULE2_HINTS}/lib" )
|
|
|
|
if( NOT GMODULE2_LIBRARIES AND APPLE )
|
|
|
|
# Fallback as APPLE glib libs already contain this - except
|
|
|
|
# Homebrew which needs the non-Apple setup
|
2013-12-01 10:34:01 +00:00
|
|
|
find_library( GMODULE2_LIBRARIES glib )
|
|
|
|
endif()
|
|
|
|
include( FindPackageHandleStandardArgs )
|
|
|
|
find_package_handle_standard_args( GMODULE2 DEFAULT_MSG GMODULE2_LIBRARIES GMODULE2_INCLUDE_DIRS )
|
|
|
|
endif()
|
2010-09-25 15:38:12 +00:00
|
|
|
|
2013-12-01 10:34:01 +00:00
|
|
|
mark_as_advanced( GMODULE2_LIBRARIES GMODULE2_INCLUDE_DIRS )
|