2013-09-23 21:45:55 +00:00
|
|
|
# - Try to find GThread2
|
2011-05-12 21:13:00 +00:00
|
|
|
#
|
|
|
|
# Find GThread headers, libraries and the answer to all questions.
|
|
|
|
#
|
|
|
|
# GTHREAD2_FOUND True if GTHREAD2 got found
|
2013-09-23 21:45:55 +00:00
|
|
|
# GTHREAD2_INCLUDE_DIRS Location of GTHREAD2 headers
|
|
|
|
# GTHREAD2_LIBRARIES List of libraries to use GTHREAD2
|
2011-05-12 21:13:00 +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.
|
|
|
|
#
|
|
|
|
|
2013-12-01 10:34:01 +00:00
|
|
|
include( FindPkgConfig )
|
2011-05-12 21:13:00 +00:00
|
|
|
|
2014-06-16 18:42:41 +00:00
|
|
|
if( GTHREAD2_MIN_VERSION )
|
2014-06-17 14:20:56 +00:00
|
|
|
PKG_SEARCH_MODULE( GTHREAD2 gthread-2.0>=${GTHREAD2_MIN_VERSION} )
|
2014-06-16 18:42:41 +00:00
|
|
|
else()
|
2014-06-17 14:20:56 +00:00
|
|
|
PKG_SEARCH_MODULE( GTHREAD2 gthread-2.0 )
|
2014-06-16 18:42:41 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if( GTHREAD2_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 )
|
2013-12-01 10:58:17 +00:00
|
|
|
FindWSWinLibs( "gtk3" "GTHREAD2_HINTS" )
|
2013-12-01 10:34:01 +00:00
|
|
|
else()
|
2013-12-01 10:58:17 +00:00
|
|
|
FindWSWinLibs( "gtk2" "GTHREAD2_HINTS" )
|
2013-12-01 10:34:01 +00:00
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message( ERROR "Unsupported build setup" )
|
|
|
|
endif()
|
|
|
|
find_path( GTHREAD2_INCLUDE_DIRS gthread.h PATH_SUFFIXES glib-2.0 glib GLib.framework/Headers/glib glib-2.0/glib HINTS "${GTHREAD2_HINTS}/include" )
|
2014-06-16 18:42:41 +00:00
|
|
|
find_library( GTHREAD2_LIBRARIES gthread-2.0 HINTS "${GTHREAD2_HINTS}/lib" )
|
2014-10-20 23:11:48 +00:00
|
|
|
if( NOT GTHREAD2_LIBRARIES )
|
|
|
|
# GLib contains GThread in some cases.
|
|
|
|
if( APPLE )
|
|
|
|
# Fallback as APPLE glib libs already contain this - except
|
|
|
|
# Homebrew which needs the non-Apple setup
|
|
|
|
find_library( GTHREAD2_LIBRARIES glib )
|
|
|
|
elseif( WIN32 )
|
|
|
|
find_library( GTHREAD2_LIBRARIES glib-2.0 HINTS "${GTHREAD2_HINTS}/lib" )
|
|
|
|
endif()
|
2013-12-01 10:34:01 +00:00
|
|
|
endif()
|
|
|
|
include( FindPackageHandleStandardArgs )
|
|
|
|
find_package_handle_standard_args( GTHREAD2 DEFAULT_MSG GTHREAD2_LIBRARIES GTHREAD2_INCLUDE_DIRS )
|
2014-06-17 14:20:56 +00:00
|
|
|
if( NOT GTHREAD2_FOUND AND GTHREAD2_FIND_REQUIRED )
|
|
|
|
message( SEND_ERROR "Package required but not found" )
|
|
|
|
endif()
|
2013-12-01 10:34:01 +00:00
|
|
|
endif()
|
2011-05-12 21:13:00 +00:00
|
|
|
|
2014-06-17 14:20:56 +00:00
|
|
|
|
2013-12-01 10:34:01 +00:00
|
|
|
mark_as_advanced( GTHREAD2_LIBRARIES GTHREAD2_INCLUDE_DIRS )
|