Skip to content

Commit

Permalink
cmake check for min version of openjpeg 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenop committed Jan 6, 2024
1 parent 23aef07 commit c868936
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c868936

Please sign in to comment.