# Main CMakeLists.txt to build the OpenJPEG project using CMake (www.cmake.org) # Written by Mathieu Malaterre CMAKE_MINIMUM_REQUIRED(VERSION 2.6) IF(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0003 NEW) ENDIF(COMMAND CMAKE_POLICY) PROJECT(openjpeg) # Do full dependency headers. INCLUDE_REGULAR_EXPRESSION("^.*$") #----------------------------------------------------------------------------- # OPENJPEG version number, useful for packaging and doxygen doc: SET(OPENJPEG_VERSION_MAJOR 1) SET(OPENJPEG_VERSION_MINOR 4) SET(OPENJPEG_VERSION_BUILD 0) SET(OPENJPEG_VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}") # This setting of SOVERSION assumes that any API change # will increment either the minor or major version number of openjpeg SET(OPENJPEG_LIBRARY_PROPERTIES VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}" SOVERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}" ) # On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security # warnings IF(WIN32) IF(NOT BORLAND) IF(NOT CYGWIN) IF(NOT MINGW) IF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS) ADD_DEFINITIONS( -D_CRT_FAR_MAPPINGS_NO_DEPRECATE -D_CRT_IS_WCTYPE_NO_DEPRECATE -D_CRT_MANAGED_FP_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE_GLOBALS -D_CRT_SETERRORMODE_BEEP_SLEEP_NO_DEPRECATE -D_CRT_TIME_FUNCTIONS_NO_DEPRECATE -D_CRT_VCCLRIT_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE ) ENDIF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS) ENDIF(NOT MINGW) ENDIF(NOT CYGWIN) ENDIF(NOT BORLAND) ENDIF(WIN32) #----------------------------------------------------------------------------- # Test for some required system information. # INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake) #----------------------------------------------------------------------------- # Compiler specific flags: IF(CMAKE_COMPILER_IS_GNUCC) # For all builds, make sure openjpeg is std99 compliant: # SET(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build. # Do not use ffast-math for all build, it would produce incorrect results, only set for release: SET(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}") ENDIF(CMAKE_COMPILER_IS_GNUCC) # Defines the source code for the library SET(OPENJPEG_SRCS bio.c cio.c dwt.c event.c image.c j2k.c j2k_lib.c jp2.c jpt.c mct.c mqc.c openjpeg.c pi.c raw.c t1.c t2.c tcd.c tgt.c ) # Pass proper definition to preprocessor to generate shared lib IF(WIN32) IF(BUILD_SHARED_LIBS) ADD_DEFINITIONS(-DOPJ_EXPORTS) ELSE(BUILD_SHARED_LIBS) ADD_DEFINITIONS(-DOPJ_STATIC) ENDIF(BUILD_SHARED_LIBS) ENDIF(WIN32) # Create the library ADD_LIBRARY(openjpeg ${OPENJPEG_SRCS}) SET_TARGET_PROPERTIES(openjpeg PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})