The change makes a relative path to header files

always correct regardless of the number of sub-
directories in OPENJPEG_INSTALL_PACKAGE_DIR variable.
This commit is contained in:
Libor Bukata 2018-08-31 12:57:40 +02:00
parent 9d1a9dc20d
commit 24fd3ce777
1 changed files with 7 additions and 2 deletions

View File

@ -26,8 +26,13 @@ get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake) if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
# This is an install tree # This is an install tree
include(${SELF_DIR}/OpenJPEGTargets.cmake) include(${SELF_DIR}/OpenJPEGTargets.cmake)
get_filename_component(OPENJPEG_INCLUDE_ROOT "${SELF_DIR}/../../@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE)
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_ROOT}) # We find a relative path from the PKG directory to header files.
set(PKG_DIR "@CMAKE_INSTALL_PREFIX@/@OPENJPEG_INSTALL_PACKAGE_DIR@")
set(INC_DIR "@CMAKE_INSTALL_PREFIX@/@OPENJPEG_INSTALL_INCLUDE_DIR@")
file(RELATIVE_PATH PKG_TO_INC_RPATH "${PKG_DIR}" "${INC_DIR}")
get_filename_component(OPENJPEG_INCLUDE_DIRS "${SELF_DIR}/${PKG_TO_INC_RPATH}" ABSOLUTE)
else() else()
if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake) if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)