From 138bc262d6b33f986a04e08a291f5d5a5fb0de35 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 23 Oct 2017 12:00:29 +0100 Subject: [PATCH] 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 --- cmake/CMakeLists.txt | 3 +-- cmake/modules/FindGLib2.cmake | 7 +++++- cmake/modules/FindGObject.cmake | 52 ----------------------------------------- cmake/test/CMakeLists.txt | 4 +--- tools/ci-build.sh | 4 +--- 5 files changed, 9 insertions(+), 61 deletions(-) delete mode 100644 cmake/modules/FindGObject.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 3becfc90..4ae5c6d6 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -139,8 +139,7 @@ endif() find_package(EXPAT) find_package(X11) find_package(GLib2) -find_package(GObject) -if(GLIB2_FOUND AND GOBJECT_FOUND) +if(GLIB2_FOUND) option (DBUS_WITH_GLIB "build with glib" ON) endif() diff --git a/cmake/modules/FindGLib2.cmake b/cmake/modules/FindGLib2.cmake index d72b2a09..0cadba5e 100644 --- a/cmake/modules/FindGLib2.cmake +++ b/cmake/modules/FindGLib2.cmake @@ -32,12 +32,17 @@ find_library(GLIB2_LIBRARY HINTS ${PC_LibGLIB2_LIBDIR} ) +find_library(GOBJECT2_LIBRARY + NAMES gobject-2.0 + HINTS ${PC_LibGLIB2_LIBDIR} +) + find_library(GIO2_LIBRARY NAMES gio-2.0 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 get_filename_component(glib2LibDir "${GLIB2_LIBRARY}" PATH) diff --git a/cmake/modules/FindGObject.cmake b/cmake/modules/FindGObject.cmake deleted file mode 100644 index af0c9f73..00000000 --- a/cmake/modules/FindGObject.cmake +++ /dev/null @@ -1,52 +0,0 @@ -# - 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 -# Copyright (c) 2006, Tim Beaulen -# -# 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) diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index dac8113d..c9ac41f4 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -89,14 +89,12 @@ if(DBUS_WITH_GLIB) add_definitions( ${GLIB2_DEFINITIONS} - ${GOBJECT_DEFINITIONS} ) include_directories( ${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-dbus-daemon ${CMAKE_SOURCE_DIR}/../test/dbus-daemon.c ${TEST_LIBRARIES}) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 2876086c..81e05afa 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -261,9 +261,7 @@ case "$ci_buildsys" in set "$@" -D CMAKE_INCLUDE_PATH="${mingw}/include" set "$@" -D CMAKE_LIBRARY_PATH="${mingw}/lib" set "$@" -D EXPAT_LIBRARY="${mingw}/lib/libexpat.dll.a" - set "$@" -D GLIB2_LIBRARIES="${mingw}/lib/libglib-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" + 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" shift # don't run tests yet, Wine needs Xvfb and more # msys2 libraries -- 2.16.2