opj_compress: improve help message regarding new IMF switch
[openjpeg.git] / src / bin / jp2 / CMakeLists.txt
1 # Build the demo app, small examples
2
3 # First thing define the common source:
4 set(common_SRCS
5   convert.c
6   convert.h
7   convertbmp.c
8   index.c
9   index.h
10   ${OPENJPEG_SOURCE_DIR}/src/bin/common/color.c
11   ${OPENJPEG_SOURCE_DIR}/src/bin/common/color.h
12   ${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
13   ${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.h
14   ${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_string.h
15   )
16
17 if(OPJ_HAVE_LIBTIFF)
18         list(APPEND common_SRCS converttif.c)
19 endif()
20 if(OPJ_HAVE_LIBPNG)
21         list(APPEND common_SRCS convertpng.c)
22 endif()
23
24 # Headers file are located here:
25 include_directories(
26   ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
27   ${OPENJPEG_BINARY_DIR}/src/bin/common # opj_apps_config.h
28   ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
29   ${OPENJPEG_SOURCE_DIR}/src/bin/common
30   ${LCMS_INCLUDE_DIRNAME}
31   ${Z_INCLUDE_DIRNAME}
32   ${PNG_INCLUDE_DIRNAME}
33   ${TIFF_INCLUDE_DIRNAME}
34   )
35
36 if(WIN32)
37   if(BUILD_SHARED_LIBS)
38     add_definitions(-DOPJ_EXPORTS)
39   else()
40     add_definitions(-DOPJ_STATIC)
41   endif()
42 endif()
43
44 # Loop over all executables:
45 foreach(exe opj_decompress opj_compress opj_dump)
46   add_executable(${exe} ${exe}.c ${common_SRCS})
47   if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12")
48     target_compile_options(${exe} PRIVATE ${OPENJP2_COMPILE_OPTIONS})
49   endif()
50   target_link_libraries(${exe} ${OPENJPEG_LIBRARY_NAME}
51     ${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME}
52     )
53   # To support universal exe:
54   if(ZLIB_FOUND AND APPLE)
55     target_link_libraries(${exe} z)
56   else(ZLIB_FOUND AND APPLE)
57     target_link_libraries(${exe} ${Z_LIBNAME})
58   endif()
59
60   # On unix you need to link to the math library:
61   if(UNIX)
62     target_link_libraries(${exe} m)
63     IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
64       target_link_libraries(${exe} rt)
65     endif()
66   endif()
67   # Install exe
68   install(TARGETS ${exe}
69     EXPORT OpenJPEGTargets
70     DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
71   )
72   if(OPJ_USE_DSYMUTIL)
73     add_custom_command(TARGET ${exe} POST_BUILD
74     COMMAND "dsymutil" "$<TARGET_FILE:${exe}>"
75     COMMENT "dsymutil $<TARGET_FILE:${exe}>"
76     DEPENDS ${exe})
77   endif()
78 endforeach()
79
80 if(BUILD_DOC)
81 # Install man pages
82 install(
83   FILES       ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_compress.1
84               ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_decompress.1
85               ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_dump.1
86   DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1)
87 #
88 endif()