From c379d4c4e0655fac2dadd4be57e2e5cd23d40572 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Tue, 2 Dec 2008 21:49:01 +0000 Subject: -rework all uses of find_package(PkgConfig)/pkg_check_modules(): the prefix used for pkgconfig config (e.g. SQLITE) now *always* gets an additional "PC_" prefix, so the prefix used for pkgconfig is now "PC_SQLITE_". This avoids name clashes between variables defined by the pkgconfig macro and the find module and unwanted effects. *Never* use the _CFLAGS coming from pkgconfig, but always CFLAGS_OTHER, since these shouldn't contain the include directories. If the include directories would be in the DEFINITIONS variable this could clash with the results of find_path() for finding include dirs. *Always* use both foo_INCLUDEDIR, foo_INCLUDE_DIRS for searching the include dir, and also both foo_LIBDIR and foo_LIBRARY_DIRS for searching the libraries. These directories coming from pkgconfig are *never* used exclusively, but *always* additionally to the standard search dirs, either before them (then using the "HINTS" keyword) or after them (then using the "PATHS" keyword) I hope I didn't break (too much) stuff. At least on my system it all seems to work the same way as it did before, with and without pkgconfig. Alex svn path=/trunk/KDE/kdelibs/; revision=891805 --- modules/FindGObject.cmake | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'modules/FindGObject.cmake') diff --git a/modules/FindGObject.cmake b/modules/FindGObject.cmake index 3774b914..538cad5f 100644 --- a/modules/FindGObject.cmake +++ b/modules/FindGObject.cmake @@ -19,37 +19,40 @@ ENDIF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES) IF (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls - find_package(PkgConfig) - pkg_check_modules(GOBJECT gobject-2.0) + FIND_PACKAGE(PkgConfig) + PKG_CHECK_MODULES(PC_GOBJECT gobject-2.0) #MESSAGE(STATUS "DEBUG: GObject include directory = ${GOBJECT_INCLUDE_DIRS}") #MESSAGE(STATUS "DEBUG: GObject link directory = ${GOBJECT_LIBRARY_DIRS}") #MESSAGE(STATUS "DEBUG: GObject CFlags = ${GOBJECT_CFLAGS}") - SET(GOBJECT_DEFINITIONS ${GOBJECT_CFLAGS}) + SET(GOBJECT_DEFINITIONS ${PC_GOBJECT_CFLAGS_OTHER}) ENDIF (NOT WIN32) FIND_PATH(GOBJECT_INCLUDE_DIR gobject.h PATHS - ${GOBJECT_INCLUDE_DIRS} - ${GOBJECT_INCLUDE_DIRS}/glib-2.0/gobject/ - /usr/include/glib-2.0/gobject/ - #PATH_SUFFIXES gst + ${PC_GOBJECT_INCLUDEDIR} + ${PC_GOBJECT_INCLUDE_DIRS} + PATH_SUFFIXES glib-2.0/gobject/ ) FIND_LIBRARY(_GObjectLibs NAMES gobject-2.0 PATHS - ${GOBJECT_LIBRARY_DIRS} + ${PC_GOBJECT_LIBDIR} + ${PC_GOBJECT_LIBRARY_DIRS} ) FIND_LIBRARY(_GModuleLibs NAMES gmodule-2.0 PATHS - ${GOBJECT_LIBRARY_DIRS} + ${PC_GOBJECT_LIBDIR} + ${PC_GOBJECT_LIBRARY_DIRS} ) FIND_LIBRARY(_GThreadLibs NAMES gthread-2.0 PATHS - ${GOBJECT_LIBRARY_DIRS} + ${PC_GOBJECT_LIBDIR} + ${PC_GOBJECT_LIBRARY_DIRS} ) FIND_LIBRARY(_GLibs NAMES glib-2.0 PATHS - ${GOBJECT_LIBRARY_DIRS} + ${PC_GOBJECT_LIBDIR} + ${PC_GOBJECT_LIBRARY_DIRS} ) SET( GOBJECT_LIBRARIES ${_GObjectLibs} ${_GModuleLibs} ${_GThreadLibs} ${_GLibs} ) @@ -71,4 +74,4 @@ ELSE (GOBJECT_FOUND) ENDIF(GObject_FIND_REQUIRED) ENDIF (GOBJECT_FOUND) -MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR GOBJECT_LIBRARIES) +MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR _GObjectLibs _GModuleLibs _GThreadLibs _GLibs) -- cgit v1.2.1