ENH: Grouping the logic that detects getopt.c into a single .cmake file.
[openjpeg.git] / JavaOpenJPEG / 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
8 # If not getopt was found then add it to the lib:
9 IF(DONT_HAVE_GETOPT)
10   SET(common_SRCS
11     ${common_SRCS}
12     compat/getopt.c
13   )
14 ENDIF(DONT_HAVE_GETOPT)
15
16
17 # Headers file are located here:
18 INCLUDE_DIRECTORIES(
19   ${OPENJPEG_SOURCE_DIR}/libopenjpeg
20   )
21
22 # Do the proper thing when building static...if only there was configured
23 # headers or def files instead
24 IF(NOT BUILD_SHARED_LIBS)
25   ADD_DEFINITIONS(-DOPJ_STATIC)
26 ENDIF(NOT BUILD_SHARED_LIBS)
27
28 FIND_PACKAGE(TIFF REQUIRED)
29
30 # Loop over all executables:
31 FOREACH(exe j2k_to_image image_to_j2k)
32   ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
33   TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjpeg ${TIFF_LIBRARIES})
34   # On unix you need to link to the math library:
35   IF(UNIX)
36     TARGET_LINK_LIBRARIES(${exe} -lm)
37   ENDIF(UNIX)
38   # Install exe
39   INSTALL_TARGETS(/bin/ ${exe})
40 ENDFOREACH(exe)
41
42