1 # Build the demo app, small examples
4 if(COMMAND cmake_policy)
5 cmake_policy(SET CMP0003 NEW)
6 endif(COMMAND cmake_policy)
9 # First thing define the common source:
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)
24 # If not getopt was found then add it to the lib:
26 ADD_DEFINITIONS(-DDONT_HAVE_GETOPT)
31 ENDIF(DONT_HAVE_GETOPT)
34 # Headers file are located here:
36 ${OPENJPEG_SOURCE_DIR}/libopenjpeg
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)
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:
52 TARGET_LINK_LIBRARIES(${exe} -lm)