Fix OpenJPEG version in cmake scripts

Currently, if OpenJPEG is found, only version information in summary is
correct and the information right after `find_package(OpenJPEG)` is
wrong.
```
-- Found system OpenJPEG: openjp2 (found version "")
```

The reason is OpenJPEGConfig.cmake only sets `OPENJPEG_MAJOR_VERSION`,
`OPENJPEG_MINOR_VERSION` and `OPENJPEG_BUILD_VERSION` but not `OPENJPEG_VERSION`.
This commit is contained in:
Letu Ren 2023-12-22 20:14:08 +08:00
parent a050285058
commit 4ee4479cd7
2 changed files with 2 additions and 1 deletions

View File

@ -1415,7 +1415,7 @@ endif()
if(HAVE_OPENJPEG)
status(" JPEG 2000:" OpenJPEG_FOUND
THEN "OpenJPEG (ver ${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION})"
THEN "OpenJPEG (ver ${OPENJPEG_VERSION})"
ELSE "build (ver ${OPENJPEG_VERSION})"
)
elseif(HAVE_JASPER)

View File

@ -202,6 +202,7 @@ if(WITH_OPENJPEG)
endif()
else()
set(HAVE_OPENJPEG YES)
set(OPENJPEG_VERSION "${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION}")
message(STATUS "Found system OpenJPEG: ${OPENJPEG_LIBRARIES} "
"(found version \"${OPENJPEG_VERSION}\")")
endif()