added two files FindLCMS.cmake and FindLCMS2.cmake as they are not shipped by default...
authorAntonin Descampe <antonin@gmail.com>
Mon, 21 Mar 2011 21:51:04 +0000 (21:51 +0000)
committerAntonin Descampe <antonin@gmail.com>
Mon, 21 Mar 2011 21:51:04 +0000 (21:51 +0000)
CHANGES
CMakeLists.txt
thirdparty/FindLCMS.cmake [new file with mode: 0644]
thirdparty/FindLCMS2.cmake [new file with mode: 0644]

diff --git a/CHANGES b/CHANGES
index a5f5929fb4e1960b8abe1a98c037cecc27649a73..c3aa83ad2420a70e37787a0ff9d4bccc319ef3c6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,9 @@ What's New for OpenJPEG
 ! : changed
 + : added
 
+March 21, 2011
++ [antonin] added two files FindLCMS.cmake and FindLCMS2.cmake as they are not shipped by default with other cmake modules.
+
 March 20, 2011
 + [antonin] added a 'thirdparty' directory to include main source files of libtiff, libpng, libz and liblcms to enable support of these formats in the codec executables. CMake will try to statically build these libraries if they are not found on the system. Note that these third party libraries are not required to build libopenjpeg (which has no dependencies).
 - [antonin] removed the 'libs' directory containing win32 compiled versions of libpng, libtiff and liblcms. 
index 93c74add49341f7181bfb7bef9567e7dee420f2c..10a99306d22395399ce2987bb07acf9d4f83db1e 100644 (file)
@@ -279,7 +279,7 @@ IF(UNIX OR CYGWIN)
  SET(CMAKE_LIBRARY_PATH /usr/lib /usr/local/lib /opt/lib /opt/local/lib)
 ENDIF()
 #
- FIND_PACKAGE(ZLIB QUIET)
+ FIND_PACKAGE(ZLIB)
 #
  IF(ZLIB_LIBRARY STREQUAL "ZLIB_LIBRARY-NOTFOUND")
    SET(ZLIB_FOUND 0)
@@ -292,7 +292,7 @@ ENDIF()
    SET(Z_INCLUDE_DIRNAME ${ZLIB_INCLUDE_DIR}) 
  ENDIF(ZLIB_FOUND)
 #
- FIND_PACKAGE(PNG QUIET)
+ FIND_PACKAGE(PNG)
 #
  IF(PNG_LIBRARY STREQUAL "PNG_LIBRARY-NOTFOUND")
    SET(PNG_FOUND 0)
@@ -305,7 +305,7 @@ ENDIF()
    SET(PNG_INCLUDE_DIRNAME ${PNG_INCLUDE_DIR})
  ENDIF(PNG_FOUND)
 #
- FIND_PACKAGE(TIFF QUIET)
+ FIND_PACKAGE(TIFF)
 #
  IF(TIFF_LIBRARY STREQUAL "TIFF_LIBRARY-NOTFOUND")
    SET(TIFF_FOUND 0)
@@ -318,36 +318,32 @@ ENDIF()
    SET(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR})
  ENDIF(TIFF_FOUND)
 #
- FIND_PACKAGE(LCMS QUIET)
-#
- IF(LCMS_LIBRARY STREQUAL "LCMS_LIBRARY-NOTFOUND")
-  SET(LCMS_FOUND 0)
- ENDIF(LCMS_LIBRARY STREQUAL "LCMS_LIBRARY-NOTFOUND") 
-#
- IF(LCMS_FOUND)
-  SET(HAVE_LCMS1_H 1)
-  SET(HAVE_LCMS1_LIB 1)
-  SET(LCMS_LIBNAME ${LCMS_LIBRARIES})
-  SET(LCMS_INCLUDE_DIRNAME ${LCMS_INCLUDE_DIR})
- ENDIF(LCMS_FOUND)
-#
- IF(NOT LCMS_FOUND)
-  FIND_PACKAGE(LCMS2 QUIET)
-   IF(LCMS2_LIBRARY STREQUAL "LCMS2_LIBRARY-NOTFOUND")
-    SET(LCMS2_FOUND 0)
-  ENDIF(LCMS2_LIBRARY STREQUAL "LCMS2_LIBRARY-NOTFOUND")
-#
-  IF(LCMS2_FOUND)
-   SET(HAVE_LCMS2_H 1)
-    SET(HAVE_LCMS2_LIB 1)
-    SET(LCMS_LIBNAME ${LCMS2_LIBRARIES})
-    SET(LCMS_INCLUDE_DIRNAME ${LCMS2_INCLUDE_DIR})
-  ENDIF(LCMS2_FOUND)
- ENDIF(NOT LCMS_FOUND)
+ SET(LCMS12_MISSING 1)
+ INCLUDE(thirdparty/FindLCMS2.cmake OPTIONAL)
+#
+ IF(LCMS2_FOUND)
+  SET(LCMS12_MISSING 0)
+  SET(HAVE_LCMS2_H 1)
+  SET(HAVE_LCMS2_LIB 1)
+  SET(LCMS_LIBNAME ${LCMS2_LIBRARY})
+  SET(LCMS_INCLUDE_DIRNAME ${LCMS2_INCLUDE_DIR})
+ ENDIF(LCMS2_FOUND)
+#
+ IF(NOT LCMS2_FOUND)
+  INCLUDE(thirdparty/FindLCMS.cmake OPTIONAL)
+#
+  IF(LCMS_FOUND)
+   SET(LCMS12_MISSING 0)
+   SET(HAVE_LCMS_H 1)
+    SET(HAVE_LCMS_LIB 1)
+    SET(LCMS_LIBNAME ${LCMS_LIBRARRY} )
+    SET(LCMS_INCLUDE_DIRNAME ${LCMS_INCLUDE_DIR})
+  ENDIF(LCMS_FOUND)
+ ENDIF(NOT LCMS2_FOUND)
 #-------------------------------------------------------------
  OPTION(BUILD_THIRDPARTY "Build the thirdparty executables" ON)
 #
- IF(NOT ZLIB_FOUND OR NOT PNG_FOUND OR NOT TIFF_FOUND OR (NOT LCMS_FOUND AND NOT LCMS2_FOUND)
+ IF(NOT ZLIB_FOUND OR NOT PNG_FOUND OR NOT TIFF_FOUND OR LCMS12_MISSING
   IF(BUILD_THIRDPARTY)
    SET(HAVE_ZLIB_H 1)
    SET(HAVE_LIBZ 1)
@@ -388,7 +384,7 @@ ENDIF()
    ENDIF(NOT TIFF_FOUND)
 #
   ENDIF(BUILD_THIRDPARTY)
- ENDIF(NOT ZLIB_FOUND OR NOT PNG_FOUND OR NOT TIFF_FOUND OR (NOT LCMS_FOUND AND NOT LCMS2_FOUND))
+ ENDIF(NOT ZLIB_FOUND OR NOT PNG_FOUND OR NOT TIFF_FOUND OR LCMS12_MISSING)
 #
 ENDIF(BUILD_CODEC OR BUILD_JPWL OR BUILD_MJ2)
 #
diff --git a/thirdparty/FindLCMS.cmake b/thirdparty/FindLCMS.cmake
new file mode 100644 (file)
index 0000000..8125e62
--- /dev/null
@@ -0,0 +1,24 @@
+# - Find LCMS library
+# Find the native LCMS includes and library
+# This module defines
+#  LCMS_INCLUDE_DIR, where to find tiff.h, etc.
+#  LCMS_LIBRARIES, libraries to link against to use LCMS.
+#  LCMS_FOUND, If false, do not try to use LCMS.
+# also defined, but not for general use are
+#  LCMS_LIBRARY, where to find the LCMS library.
+#
+FIND_PATH(LCMS_INCLUDE_DIR lcms.h  PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
+#
+SET(LCMS_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static)
+FIND_LIBRARY(LCMS_LIBRARY NAMES ${LCMS_NAMES} )
+#
+# handle the QUIETLY and REQUIRED arguments and set LCMS_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS  DEFAULT_MSG  LCMS_LIBRARY  LCMS_INCLUDE_DIR)
+#
+IF(LCMS_FOUND)
+  SET( LCMS_LIBRARIES ${LCMS_LIBRARY} )
+ENDIF(LCMS_FOUND)
+
+MARK_AS_ADVANCED(LCMS_INCLUDE_DIR LCMS_LIBRARY)
diff --git a/thirdparty/FindLCMS2.cmake b/thirdparty/FindLCMS2.cmake
new file mode 100644 (file)
index 0000000..219800e
--- /dev/null
@@ -0,0 +1,23 @@
+# - Find LCMS2 library
+# Find the native LCMS2 includes and library
+# This module defines
+#  LCMS2_INCLUDE_DIR, where to find tiff.h, etc.
+#  LCMS2_LIBRARIES, libraries to link against to use LCMS2.
+#  LCMS2_FOUND, If false, do not try to use LCMS2.
+# also defined, but not for general use are
+#  LCMS2_LIBRARY, where to find the LCMS2 library.
+#
+FIND_PATH(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
+SET(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static)
+FIND_LIBRARY(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
+
+# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS2  DEFAULT_MSG  LCMS2_LIBRARY  LCMS2_INCLUDE_DIR)
+#
+IF(LCMS2_FOUND)
+  SET( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
+ENDIF(LCMS2_FOUND)
+#
+MARK_AS_ADVANCED(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)