]> Creatis software - gdcm.git/blob - src/gdcmopenjpeg/codec/CMakeLists.txt
Comments
[gdcm.git] / src / gdcmopenjpeg / codec / CMakeLists.txt
1 # Build the demo app, small examples
2
3
4      if(COMMAND cmake_policy)
5        cmake_policy(SET CMP0003 NEW)
6      endif(COMMAND cmake_policy)
7
8
9 # First thing define the common source:
10 SET(common_SRCS
11   convert.c
12   )
13 # Then check if getopt is present:
14 INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
15 SET(DONT_HAVE_GETOPT 1)
16 IF(UNIX) #I am pretty sure only *nix sys have this anyway
17   CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
18   # Seems like we need the contrary:
19   IF(CMAKE_HAVE_GETOPT_H)
20     SET(DONT_HAVE_GETOPT 0)
21   ENDIF(CMAKE_HAVE_GETOPT_H)
22 ENDIF(UNIX)
23
24 # If not getopt was found then add it to the lib:
25 IF(DONT_HAVE_GETOPT)
26   ADD_DEFINITIONS(-DDONT_HAVE_GETOPT)
27   SET(common_SRCS
28     ${common_SRCS}
29     compat/getopt.c
30   )
31 ENDIF(DONT_HAVE_GETOPT)
32
33
34 # Headers file are located here:
35 INCLUDE_DIRECTORIES(
36   ${OPENJPEG_SOURCE_DIR}/libopenjpeg
37   )
38
39 # Do the proper thing when building static...if only there was configured
40 # headers or def files instead
41 IF(NOT BUILD_SHARED_LIBS)
42   ADD_DEFINITIONS(-DOPJ_STATIC)
43 ENDIF(NOT BUILD_SHARED_LIBS)
44
45 # Loop over all executables:
46 #FOREACH(exe j2k_to_image image_to_j2k)
47 FOREACH(exe  image_to_j2k)
48   ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
49   TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjpeg)
50   # On unix you need to link to the math library:
51   IF(UNIX)
52     TARGET_LINK_LIBRARIES(${exe} -lm)
53   ENDIF(UNIX)
54 ENDFOREACH(exe)
55
56