[trunk] Attempt to fix compilation error with mj2
[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_SOURCE_DIR}/src/lib/openmj2
15   ${OPENJPEG_SOURCE_DIR}/src/bin/common
16   ${LCMS_INCLUDE_DIRNAME}
17   ${Z_INCLUDE_DIRNAME}
18   ${PNG_INCLUDE_DIRNAME}
19   ${TIFF_INCLUDE_DIRNAME}
20   )
21
22 if(WIN32)
23   if(BUILD_SHARED_LIBS)
24     add_definitions(-DOPJ_EXPORTS)
25   else()
26     add_definitions(-DOPJ_STATIC)
27   endif()
28 endif()
29
30 add_definitions(-DUSE_LEGACY)
31 foreach(exe decompress compress)
32   set(jpwl_exe opj_jpwl_${exe})
33   set(jp2_exe opj_${exe})
34   add_executable(${jpwl_exe}
35     #../jp2/${jp2_exe}.c
36     ${jpwl_exe}.c
37     ${common_SRCS}
38   )
39   set_property(
40     TARGET ${jpwl_exe}
41     APPEND PROPERTY COMPILE_DEFINITIONS USE_JPWL
42   )
43
44   target_link_libraries(${jpwl_exe} openjpwl
45     ${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
46
47   # To support universal exe:
48   if(ZLIB_FOUND AND APPLE)
49     target_link_libraries(${jpwl_exe} z)
50   else(ZLIB_FOUND AND APPLE)
51     target_link_libraries(${jpwl_exe} ${Z_LIBNAME})
52   endif()
53
54   if(UNIX)
55     target_link_libraries(${jpwl_exe} m)
56   endif()
57
58   install(TARGETS ${jpwl_exe}
59     DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
60   )
61 endforeach()