]> Creatis software - gdcm.git/blob - src/gdcmopenjpeg/codec/CMakeLists.txt
ENH: Backport from openjpeg CVS
[gdcm.git] / src / gdcmopenjpeg / codec / 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   )
7 # Then check if getopt is present:
8 INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
9 SET(DONT_HAVE_GETOPT 1)
10 IF(UNIX) #I am pretty sure only *nix sys have this anyway
11   CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
12   # Seems like we need the contrary:
13   IF(CMAKE_HAVE_GETOPT_H)
14     SET(DONT_HAVE_GETOPT 0)
15   ENDIF(CMAKE_HAVE_GETOPT_H)
16 ENDIF(UNIX)
17
18 # If not getopt was found then add it to the lib:
19 IF(DONT_HAVE_GETOPT)
20   ADD_DEFINITIONS(-DDONT_HAVE_GETOPT)
21   SET(common_SRCS
22     ${common_SRCS}
23     compat/getopt.c
24   )
25 ENDIF(DONT_HAVE_GETOPT)
26
27
28 # Headers file are located here:
29 INCLUDE_DIRECTORIES(
30   ${OPENJPEG_SOURCE_DIR}/libopenjpeg
31   )
32
33 # Loop over all executables:
34 FOREACH(exe j2k_to_image image_to_j2k)
35   ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
36   TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjpeg)
37   IF(UNIX)
38     TARGET_LINK_LIBRARIES(${exe} -lm)
39   ENDIF(UNIX)
40 ENDFOREACH(exe)
41
42