3 if(NOT BUILD_THIRDPARTY)
5 endif(NOT BUILD_THIRDPARTY)
11 message(STATUS "We will build Z lib from thirdparty")
12 add_subdirectory(libz)
13 set(Z_LIBNAME z PARENT_SCOPE)
14 set(Z_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/include PARENT_SCOPE)
16 else(BUILD_THIRDPARTY)
20 set(Z_LIBNAME ${ZLIB_LIBRARIES} PARENT_SCOPE)
21 set(Z_INCLUDE_DIRNAME ${ZLIB_INCLUDE_DIRS} PARENT_SCOPE)
22 message(STATUS "Your system seems to have a Z lib available, we will use it to generate PNG lib")
23 # message(STATUS "DEBUG: ${ZLIB_INCLUDE_DIRS} vs ${ZLIB_INCLUDE_DIR}")
24 else(ZLIB_FOUND) # not found
25 message(STATUS "Z lib not found, activate BUILD_THIRDPARTY if you want build it (necessary to build libPNG)")
27 endif(BUILD_THIRDPARTY)
31 # Try to find lib PNG (which depends on zlib)
34 message(STATUS "We will build PNG lib from thirdparty")
35 add_subdirectory(libpng)
36 set(OPJ_HAVE_PNG_H 1 PARENT_SCOPE)
37 set(OPJ_HAVE_LIBPNG 1 PARENT_SCOPE)
38 set(PNG_LIBNAME png PARENT_SCOPE)
39 set(PNG_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libpng PARENT_SCOPE)
40 else(BUILD_THIRDPARTY)
44 # it is not necessary to invoke pkg_check_module on libpng, because libpng
45 # only depends on zlib, which is already checked.
47 message(STATUS "Your system seems to have a PNG lib available, we will use it")
48 set(OPJ_HAVE_PNG_H 1 PARENT_SCOPE)
49 set(OPJ_HAVE_LIBPNG 1 PARENT_SCOPE)
50 set(PNG_LIBNAME ${PNG_LIBRARIES} PARENT_SCOPE)
51 set(PNG_INCLUDE_DIRNAME ${PNG_PNG_INCLUDE_DIR} PARENT_SCOPE)
52 else(PNG_FOUND) # not found
53 set(OPJ_HAVE_PNG_H 0 PARENT_SCOPE)
54 set(OPJ_HAVE_LIBPNG 0 PARENT_SCOPE)
55 message(STATUS "PNG lib not found, activate BUILD_THIRDPARTY if you want build it")
58 endif(BUILD_THIRDPARTY)
61 # Try to find lib TIFF
65 message(STATUS "We will build TIFF lib from thirdparty")
66 add_subdirectory(libtiff)
67 set(TIFF_LIBNAME tiff PARENT_SCOPE)
68 set(TIFF_INCLUDE_DIRNAME
69 ${OPENJPEG_SOURCE_DIR}/thirdparty/libtiff
70 ${OPENJPEG_BINARY_DIR}/thirdparty/libtiff
72 set(OPJ_HAVE_TIFF_H 1 PARENT_SCOPE)
73 set(OPJ_HAVE_LIBTIFF 1 PARENT_SCOPE)
74 else(BUILD_THIRDPARTY)
77 # it is necessary to invoke pkg_check_module on libtiff since it may have
78 # several other dependencies not declared by its cmake module, but they are
79 # in the its pkgconfig module.
81 foreach(pc_tiff_module tiff tiff3 tiff4 tiff-3 tiff-4 libtiff libtiff3 libtiff4 libtiff-3 libtiff-4)
82 pkg_check_modules(PC_TIFF QUIET ${pc_tiff_module})
87 endif(PKG_CONFIG_FOUND)
89 message(STATUS "Your system seems to have a TIFF lib available, we will use it")
90 set(OPJ_HAVE_TIFF_H 1 PARENT_SCOPE)
91 set(OPJ_HAVE_LIBTIFF 1 PARENT_SCOPE)
92 if(BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS)
93 # Probably incorrect as PC_TIFF_STATIC_LIBRARIES will lack the path to the libraries
94 # and will only work if they are in system directories
95 set(TIFF_LIBNAME ${PC_TIFF_STATIC_LIBRARIES} PARENT_SCOPE)
96 set(TIFF_INCLUDE_DIRNAME ${PC_TIFF_STATIC_INCLUDE_DIRS} PARENT_SCOPE)
98 set(TIFF_LIBNAME ${TIFF_LIBRARIES} PARENT_SCOPE)
99 set(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR} PARENT_SCOPE)
101 else(TIFF_FOUND) # not found
102 set(OPJ_HAVE_TIFF_H 0 PARENT_SCOPE)
103 set(OPJ_HAVE_LIBTIFF 0 PARENT_SCOPE)
104 message(STATUS "TIFF lib not found, activate BUILD_THIRDPARTY if you want build it")
106 endif(BUILD_THIRDPARTY)
109 # Try to find lib LCMS2 (or by default LCMS)
110 set(OPJ_HAVE_LCMS_H 0 PARENT_SCOPE)
111 set(OPJ_HAVE_LIBLCMS 0 PARENT_SCOPE)
113 if( BUILD_THIRDPARTY)
115 message(STATUS "We will build LCMS2 lib from thirdparty")
116 add_subdirectory(liblcms2)
117 set(LCMS_LIBNAME lcms2 PARENT_SCOPE)
118 set(LCMS_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/liblcms2/include PARENT_SCOPE) #
119 set(OPJ_HAVE_LCMS2_H 1 PARENT_SCOPE)
120 set(OPJ_HAVE_LIBLCMS2 1 PARENT_SCOPE)
121 else(BUILD_THIRDPARTY)
124 # it is necessary to invoke pkg_check_module on lcms2 since it may have
125 # several other dependencies not declared by its cmake module, but they are
126 # in the its pkgconfig module.
128 pkg_check_modules(PC_LCMS2 QUIET lcms2)
129 endif(PKG_CONFIG_FOUND)
131 message(STATUS "Your system seems to have a LCMS2 lib available, we will use it")
132 set(OPJ_HAVE_LCMS2_H 1 PARENT_SCOPE)
133 set(OPJ_HAVE_LIBLCMS2 1 PARENT_SCOPE)
134 if(BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS)
135 # Probably incorrect as PC_LCMS2_STATIC_LIBRARIES will lack the path to the libraries
136 # and will only work if they are in system directories
137 set(LCMS_LIBNAME ${PC_LCMS2_STATIC_LIBRARIES} PARENT_SCOPE)
138 set(LCMS_INCLUDE_DIRNAME ${PC_LCMS2_STATIC_INCLUDE_DIRS} PARENT_SCOPE)
140 set(LCMS_LIBNAME ${LCMS2_LIBRARIES} PARENT_SCOPE)
141 set(LCMS_INCLUDE_DIRNAME ${LCMS2_INCLUDE_DIRS} PARENT_SCOPE)
143 else(LCMS2_FOUND) # not found lcms2
147 message(STATUS "Your system seems to have a LCMS lib available, we will use it")
148 set(OPJ_HAVE_LCMS_H 1 PARENT_SCOPE)
149 set(OPJ_HAVE_LIBLCMS 1 PARENT_SCOPE)
150 set(LCMS_LIBNAME ${LCMS_LIBRARIES} PARENT_SCOPE)
151 set(LCMS_INCLUDE_DIRNAME ${LCMS_INCLUDE_DIRS} PARENT_SCOPE)
152 else(LCMS_FOUND) # not found lcms
153 set(OPJ_HAVE_LCMS2_H 0 PARENT_SCOPE)
154 set(OPJ_HAVE_LIBLCMS2 0 PARENT_SCOPE)
155 message(STATUS "LCMS2 or LCMS lib not found, activate BUILD_THIRDPARTY if you want build it")
158 endif(BUILD_THIRDPARTY)
164 ADD_SUBDIRECTORY(astyle)