Skip to content

Commit

Permalink
Find GConf using find_script
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-cerny committed Nov 14, 2017
1 parent 09c4cbc commit cf75182
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 4 deletions.
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ find_package(Doxygen)
pkg_check_modules(EXSLT REQUIRED libexslt>=0.8)

# GCONF2
pkg_check_modules(GCONF2 REQUIRED gconf-2.0)
if(GCONF2_FOUND)
CHECK_LIBRARY_EXISTS(gconf-2 gconf_engine_get_default "" HAVE_GCONF_ENGINE_GET_DEFAULT)
endif()
find_package(GConf REQUIRED)

# LDAP
find_package(Ldap REQUIRED)
Expand Down
37 changes: 37 additions & 0 deletions cmake/FindGConf.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# - Try to find GConf
# Once done, this will define
#
# GCONF_FOUND - system has GCONF
# GCONF_INCLUDE_DIRS - the GCONF include directories
# GCONF_LIBRARIES - link these to use GCONF

include(LibFindMacros)

# Dependencies
# The current package name (GCONF) is included as first paramater in order to foward the REQUIRED or QUIET paramaters
# to the find_package for the dependent library (ie Threads)
libfind_package(GCONF GLib)
libfind_package(GCONF GObject)

# Use pkg-config to get hints about paths
libfind_pkg_check_modules(GCONF_PKGCONF gconf-2.0)

# Include dir
find_path(GCONF_INCLUDE_DIR
NAMES gconf/gconf.h
HINTS ${GCONF_PKGCONF_INCLUDE_DIRS}
)

# Finally the library itself
find_library(GCONF_LIBRARY
NAMES gconf-2
HINTS ${GCONF_PKGCONF_LIBRARY_DIRS}
)

# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(GCONF_PROCESS_INCLUDES GCONF_INCLUDE_DIR GLib_INCLUDE_DIRS GObject_INCLUDE_DIRS)
set(GCONF_PROCESS_LIBS GCONF_LIBRARY GLib_LIBRARIES GObject_LIBRARIES)
libfind_process(GCONF)

mark_as_advanced(GLib_DIR GObject_DIR)
38 changes: 38 additions & 0 deletions cmake/FindGLib.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# - Try to find
# Once done, this will define
#
# GLib_FOUND - system has GLib
# GLib_INCLUDE_DIRS - the GLib include directories
# GLib_LIBRARIES - link these to use GLib

include(LibFindMacros)

# Dependencies
# The current package name (GLib) is included as first paramater in order to foward the REQUIRED or QUIET paramaters
# to the find_package for the dependent library (ie Threads)
#libfind_package(GLib)

# Use pkg-config to get hints about paths
libfind_pkg_check_modules(GLib_PKGCONF glib-2.0)

# Include dir
find_path(GLib_INCLUDE_DIR
NAMES glib.h
HINTS ${GLib_PKGCONF_INCLUDE_DIRS}
)
# glibconfig.h is located in a different directory, so include it here
find_path(GLibconfig_INCLUDE_DIR
NAMES glibconfig.h
HINTS ${GLib_PKGCONF_INCLUDE_DIRS})

# Finally the library itself
find_library(GLib_LIBRARY
NAMES glib-2.0
HINTS ${GLib_PKGCONF_LIBRARY_DIRS}
)

# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(GLib_PROCESS_INCLUDES GLib_INCLUDE_DIR GLibconfig_INCLUDE_DIR)
set(GLib_PROCESS_LIBS GLib_LIBRARY)
libfind_process(GLib)
34 changes: 34 additions & 0 deletions cmake/FindGObject.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# - Try to find
# Once done, this will define
#
# GObject_FOUND - system has GObject
# GObject_INCLUDE_DIRS - the GObject include directories
# GObject_LIBRARIES - link these to use GObject

include(LibFindMacros)

# Dependencies
# The current package name (GObject) is included as first paramater in order to foward the REQUIRED or QUIET paramaters
# to the find_package for the dependent library (ie Threads)
#libfind_package(GObject)

# Use pkg-config to get hints about paths
libfind_pkg_check_modules(GObject_PKGCONF gobject-2.0)

# Include dir
find_path(GObject_INCLUDE_DIR
NAMES gobject/gobject.h
HINTS ${GObject_PKGCONF_INCLUDE_DIRS}
)

# Finally the library itself
find_library(GObject_LIBRARY
NAMES gobject-2.0
HINTS ${GObject_PKGCONF_LIBRARY_DIRS}
)

# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(GObject_PROCESS_INCLUDES GObject_INCLUDE_DIR )
set(GObject_PROCESS_LIBS GObject_LIBRARY)
libfind_process(GObject)

0 comments on commit cf75182

Please sign in to comment.