Description
Hey!
Building a project using OpenJPEG via cmake fails on Arch. I followed the instructions at the end of INSTALL.md:
find_package(OpenJPEG REQUIRED)
include_directories(${OPENJPEG_INCLUDE_DIRS})
add_executable(myapp myapp.c)
target_link_libraries(myapp ${OPENJPEG_LIBRARIES})
A subsequent make fails, because the included openjpeg.h can't be found.
As far as I understand it, OpenJPEGConfig.cmake defines the variable SELF_DIR
, and then OPENJPEG_INCLUDE_DIRS
is defined as ${SELF_DIR}/../../include/openjpeg-2.3
.
That would work out if SELF_DIR
was /usr/lib/openjpeg-2.3, but as it turns out SELF_DIR
is set to /lib64/openjpeg-2.3 whereas /lib64 is a symlink to /usr/lib. So in the end, OPENJPEG_INCLUDE_DIRS
is set to /include/openjpeg-3.2 which doesn't exist and the include fails.
Replacing include_directories(${OPENJPEG_INCLUDE_DIRS})
with include_directories("/usr/include/openjpeg-2.3")
solves it for the moment.