diff --git a/CMakeLists.txt b/CMakeLists.txt index c968d8f8b..596ae44d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,24 +185,31 @@ if(NOT SW_BUILD) if(ENABLE_OPENJPEG) find_package(OpenJPEG CONFIG) if(OpenJPEG_FOUND) - set(pkgs_private "${pkgs_private} libopenjp2") - set(HAVE_LIBJP2K 1) - include_directories(${OPENJPEG_INCLUDE_DIRS}) - if(WIN32) - if(BUILD_SHARED_LIBS) - add_definitions(-DOPJ_EXPORTS) - else() - add_definitions(-DOPJ_STATIC) - endif() - endif(WIN32) - message(STATUS "Found OpenJPEG: ${OPENJPEG_LIBRARIES} (${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION})") + set(OPENJPEG_VERSION ${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}) + if(${OPENJPEG_VERSION} LESS "2.1") + message (STATUS "Your libopenjp version is too old ${OPENJPEG_VERSION}") + set(HAVE_LIBJP2K 0) + else(${OPENJPEG_VERSION} LESS "2.1") + set(pkgs_private "${pkgs_private} libopenjp2") + set(HAVE_LIBJP2K 1) + include_directories(${OPENJPEG_INCLUDE_DIRS}) + if(WIN32) + if(BUILD_SHARED_LIBS) + add_definitions(-DOPJ_EXPORTS) + else() + add_definitions(-DOPJ_STATIC) + endif() + endif(WIN32) + message(STATUS + "Found OpenJPEG: ${OPENJPEG_LIBRARIES} (${OPENJPEG_VERSION}.${OPENJPEG_BUILD_VERSION})") + endif(${OPENJPEG_VERSION} LESS "2.1") else() - if(STRICT_CONF) - message( - FATAL_ERROR + if(STRICT_CONF) + message( + FATAL_ERROR "Could not find OpenJPEG libs.\n Use -DENABLE_OPENJPEG=OFF to disable OpenJPEG support." - ) - endif(STRICT_CONF) + ) + endif(STRICT_CONF) endif(OpenJPEG_FOUND) endif(ENABLE_OPENJPEG) else() # SW_BUILD=ON