[poppler] CMakeLists.txt cmake/modules config.h.cmake glib/CMakeLists.txt glib/poppler-page.cc glib/test-poppler-glib.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Mon Mar 24 09:14:39 PDT 2008
CMakeLists.txt | 1 +
cmake/modules/FindGTK.cmake | 23 ++++++++++++++++-------
config.h.cmake | 3 +++
glib/CMakeLists.txt | 17 +++++++++++------
glib/poppler-page.cc | 2 +-
glib/test-poppler-glib.cc | 2 +-
6 files changed, 33 insertions(+), 15 deletions(-)
New commits:
commit 0222c6ceb0fcf1d7c4422691a68a035a558ad614
Author: Albert Astals Cid <aacid at kde.org>
Date: Mon Mar 24 17:14:07 2008 +0100
fix build when using cmake, not sure it's completely ok, but at least i can compile
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed80cc5..87cf639 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,6 +48,7 @@ macro_optional_find_package(GTK)
if(GLIB_FOUND)
macro_optional_find_package(Cairo)
set(HAVE_CAIRO ${CAIRO_FOUND})
+ set(POPPLER_WITH_GDK ${GDK_FOUND})
if(CAIRO_FOUND)
set(CAIRO_REQ "cairo")
endif(CAIRO_FOUND)
diff --git a/cmake/modules/FindGTK.cmake b/cmake/modules/FindGTK.cmake
index 799bef6..0e90bd1 100644
--- a/cmake/modules/FindGTK.cmake
+++ b/cmake/modules/FindGTK.cmake
@@ -18,26 +18,33 @@ if (NOT WIN32)
pkgconfig(glib-2.0 _LibGLIB2IncDir _LibGLIB2LinkDir GLIB2LinkFlags GLIB2Cflags)
pkgconfig(gdk-2.0 _LibGDK2IncDir _LibGDK2LinkDir GDK2LinkFlags GDK2Cflags)
set (GLIB_FOUND FALSE)
- if (_LibGLIB2IncDir AND _LibGDK2IncDir)
+ if (_LibGLIB2IncDir)
exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=2.6 glib-2.0 RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
if(_return_VALUE STREQUAL "0")
set(_glib_FOUND TRUE)
endif(_return_VALUE STREQUAL "0")
+ endif (_LibGLIB2IncDir)
+ if (_LibGDK2IncDir)
exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=2.4.0 gdk-2.0 RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
if(_return_VALUE STREQUAL "0")
set(_gdk_FOUND TRUE)
endif(_return_VALUE STREQUAL "0")
+ endif (_LibGDK2IncDir)
- if (_glib_FOUND AND _gdk_FOUND)
- set (GLIB2_CFLAGS ${GLIB2Cflags} ${GDK2Cflags})
- set (GLIB2_LIBRARIES ${GLIB2LinkFlags} ${GDK2LinkFlags})
- endif (_glib_FOUND AND _gdk_FOUND)
+ if (_glib_FOUND)
+ set (GLIB2_CFLAGS ${GLIB2Cflags})
+ set (GLIB2_LIBRARIES ${GLIB2LinkFlags})
+ endif (_glib_FOUND)
- find_package_handle_standard_args(GLib DEFAULT_MSG GLIB2_LIBRARIES GLIB2_CFLAGS)
+ if (_gdk_FOUND)
+ set (GDK2_CFLAGS ${GDK2Cflags})
+ set (GDK2_LIBRARIES ${GDK2LinkFlags})
+ endif (_gdk_FOUND)
- endif (_LibGLIB2IncDir AND _LibGDK2IncDir)
+ find_package_handle_standard_args(GLib DEFAULT_MSG GLIB2_LIBRARIES GLIB2_CFLAGS)
+ find_package_handle_standard_args(GDK DEFAULT_MSG GDK2_LIBRARIES GDK2_CFLAGS)
pkgconfig(gtk+-2.0 _LibGTK2IncDir _LibGTK2LinkDir GTK2LinkFlags GTK2Cflags)
pkgconfig(gdk-pixbuf-2.0 _LibGDK2PixbufIncDir _LibGDK2PixbufLinkDir GDK2PixbufLinkFlags GDK2PixbufCflags)
@@ -64,6 +71,8 @@ endif(NOT WIN32)
mark_as_advanced(
GLIB2_CFLAGS
GLIB2_LIBRARIES
+ GDK2_CFLAGS
+ GDK2_LIBRARIES
GTK2_CFLAGS
GTK2_LIBRARIES
)
diff --git a/config.h.cmake b/config.h.cmake
index a9b58c8..1d34b54 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -84,6 +84,9 @@
/* Define to 1 if you have the <zlib.h> header file. */
#cmakedefine HAVE_ZLIB_H 1
+/* Define to 1 if gdk was found */
+#cmakedefine POPPLER_WITH_GDK 1
+
/* Enable multithreading support. */
#cmakedefine MULTITHREADED 1
diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
index dfc1999..372d984 100644
--- a/glib/CMakeLists.txt
+++ b/glib/CMakeLists.txt
@@ -12,6 +12,10 @@ else (CAIRO_FOUND)
set (CAIRO_FEATURE "#undef POPPLER_HAS_CAIRO")
endif (CAIRO_FOUND)
+if (GDK_FOUND)
+ add_definitions(${GDK2_CFLAGS})
+endif (GDK_FOUND)
+
configure_file(poppler-features.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/poppler-features.h)
if (GTK_FOUND)
@@ -100,10 +104,11 @@ install(FILES
DESTINATION include/poppler/glib)
-
-set(test_poppler_glib_SRCS
- test-poppler-glib.cc
-)
-poppler_add_test(test-poppler-glib BUILD_GTK_TESTS ${test_poppler_glib_SRCS})
-target_link_libraries(test-poppler-glib poppler-glib)
+if (GDK_FOUND)
+ set(test_poppler_glib_SRCS
+ test-poppler-glib.cc
+ )
+ poppler_add_test(test-poppler-glib BUILD_GTK_TESTS ${test_poppler_glib_SRCS})
+ target_link_libraries(test-poppler-glib poppler-glib ${GDK2_LIBRARIES})
+endif (GDK_FOUND)
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index e393601..5e0b2f1 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -375,7 +375,7 @@ poppler_page_set_selection_alpha (PopplerPage *page,
}
#endif /* POPPLER_WITH_GDK */
-#elif defined (HAVE_SPLASH)
+#elif defined (HAVE_SPLASH) && defined (POPPLER_WITH_GDK)
typedef struct {
} OutputDevData;
diff --git a/glib/test-poppler-glib.cc b/glib/test-poppler-glib.cc
index 65d4516..1e4f1cd 100644
--- a/glib/test-poppler-glib.cc
+++ b/glib/test-poppler-glib.cc
@@ -2,8 +2,8 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "poppler.h"
#include "config.h"
+#include "poppler.h"
#define FAIL(msg) \
do { fprintf (stderr, "FAIL: %s\n", msg); exit (-1); } while (0)
More information about the poppler
mailing list