[poppler] CMakeLists.txt config.h.cmake configure.ac

Albert Astals Cid aacid at kemper.freedesktop.org
Tue Aug 12 12:06:05 PDT 2014


 CMakeLists.txt |   16 ++++++++++++++++
 config.h.cmake |    2 +-
 configure.ac   |    7 ++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit e62e18e1b318d6fa664d236723de3c06ae43e86b
Author: Jehan Pagès <jehan at zemarmot.net>
Date:   Tue Aug 12 21:05:03 2014 +0200

    poppler: use poppler-data pkg-config for both cmake and autotools builds

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e100cd3..913d9f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -232,6 +232,22 @@ if(LCMS2_FOUND)
   include_directories(${LCMS2_INCLUDE_DIR})
 endif(LCMS2_FOUND)
 
+# Recent versions of poppler-data install a .pc file.
+# Use it to determine the encoding data path, if available.
+# Default to the same prefix otherwise.
+pkg_check_modules(POPPLER_DATA poppler-data)
+if(POPPLER_DATA_FOUND)
+  execute_process(COMMAND "${PKG_CONFIG_EXECUTABLE}" --variable=poppler_datadir poppler-data
+                  RESULT_VARIABLE _result_var
+                  OUTPUT_VARIABLE _output_var OUTPUT_STRIP_TRAILING_WHITESPACE)
+  if(_result_var STREQUAL "0" AND NOT _output_var STREQUAL "")
+    set(POPPLER_DATADIR "${_output_var}")
+  endif(_result_var STREQUAL "0" AND NOT _output_var STREQUAL "")
+endif(POPPLER_DATA_FOUND)
+if(NOT DEFINED POPPLER_DATADIR)
+  set(POPPLER_DATADIR "${CMAKE_INSTALL_PREFIX}/share/poppler")
+endif(NOT DEFINED POPPLER_DATADIR)
+
 if(DEFINED COMPILE_WARNINGS)
 else(DEFINED COMPILE_WARNINGS)
   set(COMPILE_WARNINGS "yes")
diff --git a/config.h.cmake b/config.h.cmake
index b707ba7..8ed1c92 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -169,7 +169,7 @@
 #define PACKAGE_VERSION "${POPPLER_VERSION}"
 
 /* Poppler data dir */
-#define POPPLER_DATADIR "${CMAKE_INSTALL_PREFIX}/share/poppler"
+#define POPPLER_DATADIR "${POPPLER_DATADIR}"
 
 /* Support for curl based doc builder is compiled in. */
 #cmakedefine POPPLER_HAS_CURL_SUPPORT 1
diff --git a/configure.ac b/configure.ac
index 477b2f7..ee20ed9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,7 +105,12 @@ if test x$enable_relocatable = xyes; then
     fi
 fi
 
-AC_DEFINE_DIR(POPPLER_DATADIR, "{datarootdir}/poppler", [Poppler data dir])
+dnl ##### Check for installed poppler-data. Use the same datarootdir as default otherwise.
+PKG_CHECK_EXISTS(poppler-data,
+                 [POPPLER_DATADIR=`$PKG_CONFIG --variable=poppler_datadir poppler-data`
+                  AC_DEFINE_DIR(POPPLER_DATADIR, "{POPPLER_DATADIR}", [Poppler data dir])],
+                 [AC_DEFINE_DIR(POPPLER_DATADIR, "{datarootdir}/poppler", [Poppler data dir])]
+                 )
 
 dnl ##### Checks for header files.
 AC_PATH_XTRA


More information about the poppler mailing list