[poppler] CMakeLists.txt cmake/modules config.h.cmake utils/CMakeLists.txt

Pino Toscano pino at kemper.freedesktop.org
Mon Feb 20 13:19:03 PST 2012


 CMakeLists.txt                |   26 +++++++++++++-
 cmake/modules/FindLCMS2.cmake |   73 ++++++++++++++++++++++++++++++++++++++++++
 config.h.cmake                |    3 +
 utils/CMakeLists.txt          |    3 +
 4 files changed, 102 insertions(+), 3 deletions(-)

New commits:
commit d0186c558f4a84a9317687ad50b460d34fb5fdf0
Author: Pino Toscano <pino at kde.org>
Date:   Mon Feb 20 22:18:00 2012 +0100

    cmake: support for lcms2
    
    followup of e48c22d3b70412015b9cc07a9a6ce07845274e13 also for the CMake build system,
    importing the FindLCMS2.cmake from kdelibs

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9f438cc..3830066 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -137,8 +137,14 @@ if(ENABLE_LIBOPENJPEG)
   set(HAVE_OPENJPEG_H ON)
 endif(ENABLE_LIBOPENJPEG)
 if(ENABLE_LCMS)
-  find_package(LCMS)
-  set(USE_CMS ${LCMS_FOUND})
+  find_package(LCMS2)
+  if(LCMS2_FOUND)
+    set(USE_CMS ${LCMS2_FOUND})
+  else(LCMS2_FOUND)
+    find_package(LCMS)
+    set(USE_CMS ${LCMS_FOUND})
+    set(USE_LCMS1 ${LCMS_FOUND})
+  endif(LCMS2_FOUND)
 endif(ENABLE_LCMS)
 if(ENABLE_LIBCURL)
   find_package(CURL)
@@ -192,6 +198,9 @@ endif(LIBOPENJPEG_FOUND)
 if(LCMS_FOUND)
   include_directories(${LCMS_INCLUDE_DIR})
 endif(LCMS_FOUND)
+if(LCMS2_FOUND)
+  include_directories(${LCMS2_INCLUDE_DIR})
+endif(LCMS2_FOUND)
 
 if(DEFINED COMPILE_WARNINGS)
 else(DEFINED COMPILE_WARNINGS)
@@ -352,7 +361,12 @@ else (LIBOPENJPEG_FOUND)
   )
 endif(LIBOPENJPEG_FOUND)
 if(USE_CMS)
-  set(poppler_LIBS ${poppler_LIBS} ${LCMS_LIBRARIES})
+  if(LCMS_FOUND)
+    set(poppler_LIBS ${poppler_LIBS} ${LCMS_LIBRARIES})
+  endif(LCMS_FOUND)
+  if(LCMS2_FOUND)
+    set(poppler_LIBS ${poppler_LIBS} ${LCMS2_LIBRARIES})
+  endif(LCMS2_FOUND)
 endif(USE_CMS)
 if(WIN32)
   # gdi32 is needed under win32
@@ -595,6 +609,12 @@ show_end_message_yesno("use zlib" ENABLE_ZLIB)
 show_end_message_yesno("use curl" ENABLE_LIBCURL)
 show_end_message_yesno("use libopenjpeg" LIBOPENJPEG_FOUND)
 show_end_message_yesno("use cms" USE_CMS)
+if(LCMS_FOUND)
+  message("      with lcms1")
+endif(LCMS_FOUND)
+if(LCMS2_FOUND)
+  message("      with lcms2")
+endif(LCMS2_FOUND)
 show_end_message_yesno("command line utils" ENABLE_UTILS)
 show_end_message("test data dir" ${TESTDATADIR})
 
diff --git a/cmake/modules/FindLCMS2.cmake b/cmake/modules/FindLCMS2.cmake
new file mode 100644
index 0000000..2ec91d0
--- /dev/null
+++ b/cmake/modules/FindLCMS2.cmake
@@ -0,0 +1,73 @@
+# - Find LCMS2
+# Find the LCMS2 includes and library
+# This module defines
+#  LCMS2_INCLUDE_DIR, where to find lcms.h
+#  LCMS2_LIBRARIES, the libraries needed to use LCMS2.
+#  LCMS2_VERSION, The value of LCMS_VERSION defined in lcms.h
+#  LCMS2_FOUND, If false, do not try to use LCMS2.
+
+
+# Copyright (c) 2008, Adrian Page, <adrian at pagenet.plus.com>
+# Copyright (c) 2009, Cyrille Berger, <cberger at cberger.net>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+if(NOT WIN32)
+   find_package(PkgConfig)
+   pkg_check_modules(PC_LCMS2 lcms2)
+   set(LCMS2_DEFINITIONS ${PC_LCMS2_CFLAGS_OTHER})
+endif(NOT WIN32)
+
+find_path(LCMS2_INCLUDE_DIR lcms2.h
+   PATHS
+   ${PC_LCMS2_INCLUDEDIR}
+   ${PC_LCMS2_INCLUDE_DIRS}
+   PATH_SUFFIXES lcms2 liblcms2
+)
+
+find_library(LCMS2_LIBRARIES NAMES lcms2 liblcms2 lcms-2 liblcms-2
+   PATHS     
+   ${PC_LCMS2_LIBDIR}
+   ${PC_LCMS2_LIBRARY_DIRS}
+   PATH_SUFFIXES lcms2
+)
+
+if(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
+   set(LCMS2_FOUND TRUE)
+else(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
+   set(LCMS2_FOUND FALSE)
+endif(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
+
+if(LCMS2_FOUND)
+   file(READ ${LCMS2_INCLUDE_DIR}/lcms2.h LCMS2_VERSION_CONTENT)
+   string(REGEX MATCH "#define LCMS_VERSION[ ]*[0-9]*\n" LCMS2_VERSION_MATCH ${LCMS2_VERSION_CONTENT})
+   if(LCMS2_VERSION_MATCH)
+      string(REGEX REPLACE "#define LCMS_VERSION[ ]*([0-9]*)\n" "\\1" LCMS2_VERSION ${LCMS2_VERSION_MATCH})
+      if(NOT LCMS2_FIND_QUIETLY)
+         string(SUBSTRING ${LCMS2_VERSION} 0 1 LCMS2_MAJOR_VERSION)
+         string(SUBSTRING ${LCMS2_VERSION} 1 2 LCMS2_MINOR_VERSION)
+         message(STATUS "Found lcms version ${LCMS2_MAJOR_VERSION}.${LCMS2_MINOR_VERSION}, ${LCMS2_LIBRARIES}")
+      endif(NOT LCMS2_FIND_QUIETLY)
+   else(LCMS2_VERSION_MATCH)
+      if(NOT LCMS2_FIND_QUIETLY)
+         message(STATUS "Found lcms2 but failed to find version ${LCMS2_LIBRARIES}")
+      endif(NOT LCMS2_FIND_QUIETLY)
+      set(LCMS2_VERSION NOTFOUND)
+   endif(LCMS2_VERSION_MATCH)
+else(LCMS2_FOUND)
+   if(NOT LCMS2_FIND_QUIETLY)
+      if(LCMS2_FIND_REQUIRED)
+         message(FATAL_ERROR "Required package lcms2 NOT found")
+      else(LCMS2_FIND_REQUIRED)
+         message(STATUS "lcms2 NOT found")
+      endif(LCMS2_FIND_REQUIRED)
+   endif(NOT LCMS2_FIND_QUIETLY)
+endif(LCMS2_FOUND)
+
+mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARIES LCMS2_VERSION)
+
+
diff --git a/config.h.cmake b/config.h.cmake
index 7dcb1f7..3c7b968 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -180,6 +180,9 @@
 /* Use single precision arithmetic in the Splash backend */
 #cmakedefine USE_FLOAT 1
 
+/* Defines if use lcms1 */
+#cmakedefine USE_LCMS1 1
+
 /* Version number of package */
 #define VERSION "${POPPLER_VERSION}"
 
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index e2fabb6..4a29841 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -39,6 +39,9 @@ if (HAVE_CAIRO)
   if(LCMS_FOUND)
     target_link_libraries(pdftocairo ${LCMS_LIBRARIES})
   endif(LCMS_FOUND)
+  if(LCMS2_FOUND)
+    target_link_libraries(pdftocairo ${LCMS2_LIBRARIES})
+  endif(LCMS2_FOUND)
   install(TARGETS pdftocairo DESTINATION bin)
   install(FILES pdftocairo.1 DESTINATION share/man/man1)
 endif (HAVE_CAIRO)


More information about the poppler mailing list