Commit 4e3bfe0c authored by Simon McVittie's avatar Simon McVittie

cmake: Fold GObject detection into GLib detection

Everywhere that we want GLib, we also want GObject and GIO. Detecting
GLib and GIO but not GObject makes very little sense anyway, because
GIO depends on GObject.
Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105521Reviewed-by: Ralf Habacker's avatarRalf Habacker <ralf.habacker@freenet.de>
parent 27113c75
...@@ -139,8 +139,7 @@ endif() ...@@ -139,8 +139,7 @@ endif()
find_package(EXPAT) find_package(EXPAT)
find_package(X11) find_package(X11)
find_package(GLib2) find_package(GLib2)
find_package(GObject) if(GLIB2_FOUND)
if(GLIB2_FOUND AND GOBJECT_FOUND)
option (DBUS_WITH_GLIB "build with glib" ON) option (DBUS_WITH_GLIB "build with glib" ON)
endif() endif()
......
...@@ -32,12 +32,17 @@ find_library(GLIB2_LIBRARY ...@@ -32,12 +32,17 @@ find_library(GLIB2_LIBRARY
HINTS ${PC_LibGLIB2_LIBDIR} HINTS ${PC_LibGLIB2_LIBDIR}
) )
find_library(GOBJECT2_LIBRARY
NAMES gobject-2.0
HINTS ${PC_LibGLIB2_LIBDIR}
)
find_library(GIO2_LIBRARY find_library(GIO2_LIBRARY
NAMES gio-2.0 NAMES gio-2.0
HINTS ${PC_LibGLIB2_LIBDIR} HINTS ${PC_LibGLIB2_LIBDIR}
) )
set(GLIB2_LIBRARIES ${GLIB2_LIBRARY} ${GIO2_LIBRARY}) set(GLIB2_LIBRARIES ${GLIB2_LIBRARY} ${GOBJECT2_LIBRARY} ${GIO2_LIBRARY})
# search the glibconfig.h include dir under the same root where the library is found # search the glibconfig.h include dir under the same root where the library is found
get_filename_component(glib2LibDir "${GLIB2_LIBRARY}" PATH) get_filename_component(glib2LibDir "${GLIB2_LIBRARY}" PATH)
......
# - Try to find GObject
# Once done this will define
#
# GOBJECT_FOUND - system has GObject
# GOBJECT_INCLUDE_DIR - the GObject include directory
# GOBJECT_LIBRARIES - the libraries needed to use GObject
# GOBJECT_DEFINITIONS - Compiler switches required for using GObject
# Copyright (c) 2011, Raphael Kubo da Costa <kubito@gmail.com>
# Copyright (c) 2006, Tim Beaulen <tbscope@gmail.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PC_GOBJECT gobject-2.0)
SET(GOBJECT_DEFINITIONS ${PC_GOBJECT_CFLAGS_OTHER})
FIND_PATH(GOBJECT_INCLUDE_DIR gobject.h
HINTS
${PC_GOBJECT_INCLUDEDIR}
${PC_GOBJECT_INCLUDE_DIRS}
PATH_SUFFIXES glib-2.0/gobject/
)
FIND_LIBRARY(_GObjectLibs NAMES gobject-2.0
HINTS
${PC_GOBJECT_LIBDIR}
${PC_GOBJECT_LIBRARY_DIRS}
)
FIND_LIBRARY(_GModuleLibs NAMES gmodule-2.0
HINTS
${PC_GOBJECT_LIBDIR}
${PC_GOBJECT_LIBRARY_DIRS}
)
FIND_LIBRARY(_GThreadLibs NAMES gthread-2.0
HINTS
${PC_GOBJECT_LIBDIR}
${PC_GOBJECT_LIBRARY_DIRS}
)
FIND_LIBRARY(_GLibs NAMES glib-2.0
HINTS
${PC_GOBJECT_LIBDIR}
${PC_GOBJECT_LIBRARY_DIRS}
)
SET( GOBJECT_LIBRARIES ${_GObjectLibs} ${_GModuleLibs} ${_GThreadLibs} ${_GLibs} )
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GOBJECT DEFAULT_MSG GOBJECT_LIBRARIES GOBJECT_INCLUDE_DIR)
MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR _GObjectLibs _GModuleLibs _GThreadLibs _GLibs)
...@@ -89,14 +89,12 @@ if(DBUS_WITH_GLIB) ...@@ -89,14 +89,12 @@ if(DBUS_WITH_GLIB)
add_definitions( add_definitions(
${GLIB2_DEFINITIONS} ${GLIB2_DEFINITIONS}
${GOBJECT_DEFINITIONS}
) )
include_directories( include_directories(
${GLIB2_INCLUDE_DIR} ${GLIB2_INCLUDE_DIR}
${GOBJECT_INCLUDE_DIR}
) )
set(TEST_LIBRARIES ${DBUS_INTERNAL_LIBRARIES} dbus-testutils dbus-testutils-glib ${GLIB2_LIBRARIES} ${GOBJECT_LIBRARIES}) set(TEST_LIBRARIES ${DBUS_INTERNAL_LIBRARIES} dbus-testutils dbus-testutils-glib ${GLIB2_LIBRARIES})
add_test_executable(test-corrupt ${CMAKE_SOURCE_DIR}/../test/corrupt.c ${TEST_LIBRARIES}) add_test_executable(test-corrupt ${CMAKE_SOURCE_DIR}/../test/corrupt.c ${TEST_LIBRARIES})
add_test_executable(test-dbus-daemon ${CMAKE_SOURCE_DIR}/../test/dbus-daemon.c ${TEST_LIBRARIES}) add_test_executable(test-dbus-daemon ${CMAKE_SOURCE_DIR}/../test/dbus-daemon.c ${TEST_LIBRARIES})
......
...@@ -261,9 +261,7 @@ case "$ci_buildsys" in ...@@ -261,9 +261,7 @@ case "$ci_buildsys" in
set "$@" -D CMAKE_INCLUDE_PATH="${mingw}/include" set "$@" -D CMAKE_INCLUDE_PATH="${mingw}/include"
set "$@" -D CMAKE_LIBRARY_PATH="${mingw}/lib" set "$@" -D CMAKE_LIBRARY_PATH="${mingw}/lib"
set "$@" -D EXPAT_LIBRARY="${mingw}/lib/libexpat.dll.a" set "$@" -D EXPAT_LIBRARY="${mingw}/lib/libexpat.dll.a"
set "$@" -D GLIB2_LIBRARIES="${mingw}/lib/libglib-2.0.dll.a" set "$@" -D GLIB2_LIBRARIES="${mingw}/lib/libglib-2.0.dll.a ${mingw}/lib/libgobject-2.0.dll.a ${mingw}/lib/libgio-2.0.dll.a"
set "$@" -D GOBJECT_LIBRARIES="${mingw}/lib/libgobject-2.0.dll.a"
set "$@" -D GIO_LIBRARIES="${mingw}/lib/libgio-2.0.dll.a"
shift shift
# don't run tests yet, Wine needs Xvfb and more # don't run tests yet, Wine needs Xvfb and more
# msys2 libraries # msys2 libraries
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment