FindGLIB2.cmake

Alexander Neundorf neundorf at kde.org
Sat Sep 1 01:01:20 CEST 2007


On Friday 31 August 2007 15:50, Allen Winter wrote:
> Howdy,
>
> On my system,
> % pkg-config glib-2.0 --cflags
> -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
>
> but FindGLIB2.cmake only sets
> GLIB2_INCLUDE_DIR:PATH=/usr/include/glib-2.0
>
> So how to get the missing /usr/lib/glib-2.0/include into the
> GLIB2_INCLUDE_DIR?

Fixed and committed, the additional include directory is right now optional, 
i.e. it doesn't fail if it is not found:

Index: FindGLIB2.cmake
===================================================================
--- FindGLIB2.cmake     (revision 707065)
+++ FindGLIB2.cmake     (working copy)
@@ -15,7 +15,7 @@
    pkgconfig(glib-2.0 _LibGLIB2IncDir _LibGLIB2LinkDir _LibGLIB2LinkFlags 
_LibGLIB2Cflags)
 endif(NOT WIN32)

-find_path(GLIB2_INCLUDE_DIR glib.h
+find_path(GLIB2_MAIN_INCLUDE_DIR glib.h
           PATH_SUFFIXES glib-2.0
           PATHS ${_LibGLIB2IncDir} )

@@ -23,7 +23,21 @@
              NAMES glib-2.0
              PATHS ${_LibGLIB2LinkDir} )

+get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH)
+
+find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h
+          PATH_SUFFIXES glib-2.0/include
+          PATHS ${_LibGLIB2IncDir} "${glib2LibDir}" )
+
+set(GLIB2_INCLUDE_DIR "${GLIB2_MAIN_INCLUDE_DIR}")
+
+# not sure if this include dir is optional or required
+# for now it is optional
+if(GLIB2_INTERNAL_INCLUDE_DIR)
+  set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} "${GLIB2_INTERNAL_INCLUDE_DIR}")
+endif(GLIB2_INTERNAL_INCLUDE_DIR)
+
 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(GLIB2  DEFAULT_MSG  GLIB2_LIBRARIES 
GLIB2_INCLUDE_DIR)
+find_package_handle_standard_args(GLIB2  DEFAULT_MSG  GLIB2_LIBRARIES 
GLIB2_MAIN_INCLUDE_DIR)

 mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES)


More information about the Kde-buildsystem mailing list