101738477f893c06cf1ac48824e72f74dbdf1526
[openjpeg.git] / thirdparty / CMakeLists.txt
1 IF(ZLIB_FOUND)
2
3   SET(Z_LIBNAME ${ZLIB_LIBRARIES} PARENT_SCOPE)
4   SET(Z_INCLUDE_DIRNAME ${ZLIB_INCLUDE_DIRS} PARENT_SCOPE) 
5   message(STATUS "Your system seems to have a Z lib available, we will use it to generate PNG lib")
6
7 ELSE (ZLIB_FOUND) # not found
8   
9   IF(BUILD_THIRDPARTY)
10     # Try to build it
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)
15     SET(ZLIB_FOUND 1)
16   ELSE (BUILD_THIRDPARTY)
17     message("Z lib not found, activate BUILD_THIRDPARTY if you want build it (necessary to build libPNG)")
18   ENDIF(BUILD_THIRDPARTY) 
19     
20 ENDIF(ZLIB_FOUND)
21
22 #------------
23 # Try to find lib PNG (which depends to zlib)
24 IF (ZLIB_FOUND)
25   FIND_PACKAGE(PNG)
26
27   IF(PNG_FOUND)
28
29     message("Your system seems to have a PNG lib available, we will use it")
30     SET(HAVE_PNG_H 1 PARENT_SCOPE)
31     SET(HAVE_LIBPNG 1 PARENT_SCOPE)
32     SET(PNG_LIBNAME ${PNG_LIBRARIES} PARENT_SCOPE)
33     SET(PNG_INCLUDE_DIRNAME ${PNG_PNG_INCLUDE_DIR} PARENT_SCOPE) 
34     
35   ELSE(PNG_FOUND) # not found
36     
37     IF(BUILD_THIRDPARTY)
38       # Try to build it
39       message("We will build PNG lib from thirdparty")
40       ADD_SUBDIRECTORY(libpng)
41       SET(HAVE_PNG_H 1 PARENT_SCOPE)
42       SET(HAVE_LIBPNG 1 PARENT_SCOPE)
43       SET(PNG_LIBNAME png PARENT_SCOPE)
44       SET(PNG_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libpng PARENT_SCOPE)
45     ELSE (BUILD_THIRDPARTY)
46       SET(HAVE_PNG_H 0 PARENT_SCOPE)
47       SET(HAVE_LIBPNG 0 PARENT_SCOPE)
48       message("PNG lib not found, activate BUILD_THIRDPARTY if you want build it")
49     ENDIF(BUILD_THIRDPARTY) 
50
51   ENDIF(PNG_FOUND)
52 ENDIF (ZLIB_FOUND)
53
54 #------------
55 # Try to find lib TIFF
56 FIND_PACKAGE(TIFF)
57
58 IF(TIFF_FOUND)
59
60   message("Your system seems to have a TIFF lib available, we will use it")
61   SET(HAVE_TIFF_H 1 PARENT_SCOPE)
62   SET(HAVE_LIBTIFF 1 PARENT_SCOPE)
63   SET(TIFF_LIBNAME ${TIFF_LIBRARIES} PARENT_SCOPE)
64   SET(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR} PARENT_SCOPE) 
65
66 ELSE (TIFF_FOUND) # not found
67   
68   IF(BUILD_THIRDPARTY)
69     # Try to build it
70     message("We will build TIFF lib from thirdparty")
71     ADD_SUBDIRECTORY(libtiff)
72     SET(TIFF_LIBNAME tiff PARENT_SCOPE)
73     SET(TIFF_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libtiff PARENT_SCOPE)
74     SET(HAVE_TIFF_H 1 PARENT_SCOPE)
75     SET(HAVE_LIBTIFF 1 PARENT_SCOPE)
76   ELSE (BUILD_THIRDPARTY)
77     SET(HAVE_TIFF_H 0 PARENT_SCOPE)
78     SET(HAVE_LIBTIFF 0 PARENT_SCOPE)
79     message("TIFF lib not found, activate BUILD_THIRDPARTY if you want build it")
80   ENDIF(BUILD_THIRDPARTY) 
81     
82 ENDIF(TIFF_FOUND)
83
84 #------------
85 # Try to find lib LCMS2 (or by default LCMS)
86 FIND_PACKAGE(LCMS2)
87
88 IF(LCMS2_FOUND)
89
90   message("Your system seems to have a LCMS2 lib available, we will use it")
91   SET(HAVE_LCMS2_H 1 PARENT_SCOPE)
92   SET(HAVE_LIBLCMS2 1 PARENT_SCOPE)
93   SET(LCMS_LIBNAME ${LCMS2_LIBRARIES} PARENT_SCOPE)
94   SET(LCMS_INCLUDE_DIRNAME ${LCMS2_INCLUDE_DIRS} PARENT_SCOPE) 
95
96 ELSE (LCMS2_FOUND) # not found lcms2
97   # try to find LCMS
98   FIND_PACKAGE(LCMS)  
99   
100   IF(LCMS_FOUND)
101   
102     message("Your system seems to have a LCMS lib available, we will use it")
103     SET(HAVE_LCMS_H 1 PARENT_SCOPE)
104     SET(HAVE_LIBLCMS 1 PARENT_SCOPE)
105     SET(LCMS_LIBNAME ${LCMS_LIBRARIES} PARENT_SCOPE)
106     SET(LCMS_INCLUDE_DIRNAME ${LCMS_INCLUDE_DIRS} PARENT_SCOPE) 
107    
108   ELSE (LCMS_FOUND) # not found lcms
109     SET(HAVE_LCMS_H 0 PARENT_SCOPE)
110     SET(HAVE_LIBLCMS 0 PARENT_SCOPE)
111     
112     IF( BUILD_THIRDPARTY)
113
114       # Try to build lcms2
115       message("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(HAVE_LCMS2_H 1 PARENT_SCOPE)
120       SET(HAVE_LIBLCMS2 1 PARENT_SCOPE)
121     ELSE (BUILD_THIRDPARTY)
122         SET(HAVE_LCMS2_H 0 PARENT_SCOPE)
123         SET(HAVE_LIBLCMS2 0 PARENT_SCOPE)
124         message("LCMS2 or LCMS lib not found, activate BUILD_THIRDPARTY if you want build it")
125     ENDIF(BUILD_THIRDPARTY) 
126     
127   ENDIF (LCMS_FOUND)
128 ENDIF(LCMS2_FOUND)
129
130 #------------
131 # Try to find lib FCGI
132 FIND_PACKAGE(FCGI)
133
134 IF(FCGI_FOUND)
135
136   SET(FCGI_LIBNAME ${FCGI_LIBRARIES} PARENT_SCOPE)
137   SET(FCGI_INCLUDE_DIRNAME ${FCGI_INCLUDE_DIRS} PARENT_SCOPE) 
138   message("Your system seems to have a FCGI lib available, we will use it to build JPIP")
139
140 ELSE (FCGI_FOUND) # not found
141   
142   message("FCGI lib not found, JPIP will not be built as it requires FCGI")
143     
144 ENDIF(FCGI_FOUND)
145
146
147