[JPWL] fix CVE-2018-16375
[openjpeg.git] / src / bin / jpwl / CMakeLists.txt
1 # jpwl apps
2
3 # First thing define the common source:
4 set(common_SRCS
5   convert.c
6   index.c
7   ${OPENJPEG_SOURCE_DIR}/src/bin/common/color.c
8   ${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
9   )
10
11 # Headers file are located here:
12 include_directories(
13   ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
14   ${OPENJPEG_BINARY_DIR}/src/bin/common # opj_apps_config.h
15   ${OPENJPEG_SOURCE_DIR}/src/lib/openmj2
16   ${OPENJPEG_SOURCE_DIR}/src/bin/common
17   ${LCMS_INCLUDE_DIRNAME}
18   ${Z_INCLUDE_DIRNAME}
19   ${PNG_INCLUDE_DIRNAME}
20   ${TIFF_INCLUDE_DIRNAME}
21   )
22
23 if(WIN32)
24   if(BUILD_SHARED_LIBS)
25     add_definitions(-DOPJ_EXPORTS)
26   else()
27     add_definitions(-DOPJ_STATIC)
28   endif()
29 endif()
30
31 add_definitions(-DOPJ_USE_LEGACY)
32 foreach(exe decompress compress)
33   set(jpwl_exe opj_jpwl_${exe})
34   set(jp2_exe opj_${exe})
35   add_executable(${jpwl_exe}
36     #../jp2/${jp2_exe}.c
37     ${jpwl_exe}.c
38     ${common_SRCS}
39   )
40   set_property(
41     TARGET ${jpwl_exe}
42     APPEND PROPERTY COMPILE_DEFINITIONS USE_JPWL
43   )
44
45   target_link_libraries(${jpwl_exe} openjpwl
46     ${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
47
48   # To support universal exe:
49   if(ZLIB_FOUND AND APPLE)
50     target_link_libraries(${jpwl_exe} z)
51   else(ZLIB_FOUND AND APPLE)
52     target_link_libraries(${jpwl_exe} ${Z_LIBNAME})
53   endif()
54
55   if(UNIX)
56     target_link_libraries(${jpwl_exe} m)
57   endif()
58
59   install(TARGETS ${jpwl_exe}
60     DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
61   )
62 endforeach()