6c33b963bc5b865466b80aa0f2f7a9190e1732f6
[openjpeg.git] / 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     getopt.c
24   )
25 ENDIF(DONT_HAVE_GETOPT)
26
27 IF(WIN32)
28   IF(BUILD_SHARED_LIBS)
29     ADD_DEFINITIONS(-DOPJ_EXPORTS)
30   ELSE(BUILD_SHARED_LIBS)
31     ADD_DEFINITIONS(-DOPJ_STATIC)
32   ENDIF(BUILD_SHARED_LIBS)
33 ENDIF(WIN32)
34
35 # Loop over all executables:
36 FOREACH(exe jp3d_to_volume volume_to_jp3d)
37   ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
38   TARGET_LINK_LIBRARIES(${exe} ${OPENJPEG_LIBRARY_NAME}_JP3D) # ${TIFF_LIBRARIES})
39   # On unix you need to link to the math library:
40   IF(UNIX)
41     TARGET_LINK_LIBRARIES(${exe} m)
42   ENDIF(UNIX)
43   # Install exe
44   INSTALL_TARGETS(/bin/ ${exe})
45 ENDFOREACH(exe)
46
47