From: johanengelen Date: Tue, 6 Jan 2009 23:12:32 +0000 (+0000) Subject: fix cmake version checking X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=61ca845db16f0b18c66bf3134db1ed75a8ec04a1;p=inkscape.git fix cmake version checking --- diff --git a/CMakeScripts/FindGTK2.cmake b/CMakeScripts/FindGTK2.cmake index 1224b082b..9c7346e1d 100644 --- a/CMakeScripts/FindGTK2.cmake +++ b/CMakeScripts/FindGTK2.cmake @@ -67,22 +67,28 @@ IF (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS) SET(GTK2_FOUND TRUE) ELSE (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS) + #check whether cmake version is 2.4 or greater + if (${CMAKE_MAJOR_VERSION} GREATER 1 AND ${CMAKE_MINOR_VERSION} GREATER 3) + SET(GTK2_CMAKE_24 TRUE) + endif (${CMAKE_MAJOR_VERSION} GREATER 1 AND ${CMAKE_MINOR_VERSION} GREATER 3) + # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls - if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + if (GTK2_CMAKE_24) include(UsePkgConfig) - else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + else (GTK2_CMAKE_24) find_package(PkgConfig) - endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + endif (GTK2_CMAKE_24) INCLUDE(UsePkgConfig) - if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + if (GTK2_CMAKE_24) pkgconfig(gtk+-2.0 _GTK2_INCLUDEDIR _GTK2_LIBDIR _GTK2_LDFLAGS _GTK2_CFLAGS) - else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + MESSAGE(STATUS "DEBUG pkgconfig found: ${_GTK2_INCLUDEDIR} ${_GTK2_LIBDIR} ${_GTK2_LDFLAGS} ${_GTK2_CFLAGS}") + else (GTK2_CMAKE_24) if (PKG_CONFIG_FOUND) pkg_check_modules(_GTK2 gtk+-2.0) endif (PKG_CONFIG_FOUND) - endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + endif (GTK2_CMAKE_24) FIND_PATH(GTK2_GTK_INCLUDE_PATH gtk/gtk.h $ENV{GTK2_HOME} @@ -97,15 +103,15 @@ ELSE (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS) # and glib.h in different directories, so we need to look # for both. # - Atanas Georgiev - if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + if (GTK2_CMAKE_24) pkgconfig(glib-2.0 _GLIB2_INCLUDEDIR _GLIB2inkDir _GLIB2_LDFLAGS _GLIB2_CFLAGS) pkgconfig(gmodule-2.0 _GMODULE2_INCLUDEDIR _GMODULE2inkDir _GMODULE2_LDFLAGS _GMODULE2_CFLAGS) - else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + else (GTK2_CMAKE_24) if (PKG_CONFIG_FOUND) pkg_check_modules(_GLIB2 glib-2.0) pkg_check_modules(_GMODULE2 gmodule-2.0) endif (PKG_CONFIG_FOUND) - endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + endif (GTK2_CMAKE_24) SET(GDIR /opt/gnome/lib/glib-2.0/include) FIND_PATH(GTK2_GLIBCONFIG_INCLUDE_PATH glibconfig.h @@ -135,13 +141,13 @@ ELSE (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS) $ENV{DEVLIBS_PATH}//include// ) - if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + if (GTK2_CMAKE_24) pkgconfig(pango _PANGO_INCLUDEDIR _PANGOinkDir _PANGO_LDFLAGS _PANGO_CFLAGS) - else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + else (GTK2_CMAKE_24) if (PKG_CONFIG_FOUND) pkg_check_modules(_PANGO pango) endif (PKG_CONFIG_FOUND) - endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + endif (GTK2_CMAKE_24) FIND_PATH(GTK2_PANGO_INCLUDE_PATH pango/pango.h ${_PANGO_INCLUDEDIR} @@ -150,13 +156,13 @@ ELSE (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS) $ENV{DEVLIBS_PATH}//include// ) - if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + if (GTK2_CMAKE_24) pkgconfig(gdk-2.0 _GDK2_INCLUDEDIR _GDK2inkDir _GDK2_LDFLAGS _GDK2_CFLAGS) - else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + else (GTK2_CMAKE_24) if (PKG_CONFIG_FOUND) pkg_check_modules(_GDK2 gdk-2.0) endif (PKG_CONFIG_FOUND) - endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + endif (GTK2_CMAKE_24) FIND_PATH(GTK2_GDKCONFIG_INCLUDE_PATH gdkconfig.h ${_GDK2_INCLUDEDIR} @@ -167,13 +173,13 @@ ELSE (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS) $ENV{DEVLIBS_PATH}//include// ) - if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + if (GTK2_CMAKE_24) pkgconfig(cairo _CAIRO_INCLUDEDIR _CAIROinkDir _CAIRO_LDFLAGS _CAIRO_CFLAGS) - else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + else (GTK2_CMAKE_24) if (PKG_CONFIG_FOUND) pkg_check_modules(_CAIRO cairo) endif (PKG_CONFIG_FOUND) - endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + endif (GTK2_CMAKE_24) FIND_PATH(GTK2_CAIRO_INCLUDE_PATH cairo.h ${_CAIRO_INCLUDEDIR} @@ -184,13 +190,13 @@ ELSE (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS) ) #MESSAGE(STATUS "DEBUG: GTK2_CAIRO_INCLUDE_PATH = ${GTK2_CAIRO_INCLUDE_PATH}") - if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + if (GTK2_CMAKE_24) pkgconfig(atk _ATK_INCLUDEDIR _ATKinkDir _ATK_LDFLAGS _ATK_CFLAGS) - else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + else (GTK2_CMAKE_24) if (PKG_CONFIG_FOUND) pkg_check_modules(_ATK atk) endif (PKG_CONFIG_FOUND) - endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + endif (GTK2_CMAKE_24) FIND_PATH(GTK2_ATK_INCLUDE_PATH atk/atk.h ${_ATK_INCLUDEDIR}