diff --git a/modules/ECMGeneratePriFile.cmake b/modules/ECMGeneratePriFile.cmake --- a/modules/ECMGeneratePriFile.cmake +++ b/modules/ECMGeneratePriFile.cmake @@ -159,18 +159,22 @@ string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" PROJECT_VERSION_MINOR "${PROJECT_VERSION_STRING}") string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PROJECT_VERSION_PATCH "${PROJECT_VERSION_STRING}") + # Prepare the right number of "../.." to go from ECM_MKSPECS_INSTALL_DIR to the install prefix + # This allows to make the generated pri files relocatable (no absolute paths) + string(REGEX REPLACE "[^/]+" ".." PRI_ROOT_RELATIVE_TO_MKSPECS ${ECM_MKSPECS_INSTALL_DIR}) + set(PRI_TARGET_BASENAME ${EGPF_BASE_NAME}) set(PRI_TARGET_LIBNAME ${EGPF_LIB_NAME}) set(PRI_TARGET_QTDEPS ${EGPF_DEPS}) if(IS_ABSOLUTE "${EGPF_INCLUDE_INSTALL_DIR}") set(PRI_TARGET_INCLUDES "${EGPF_INCLUDE_INSTALL_DIR}") else() - set(PRI_TARGET_INCLUDES "${CMAKE_INSTALL_PREFIX}/${EGPF_INCLUDE_INSTALL_DIR}") + set(PRI_TARGET_INCLUDES "$$PWD/${PRI_ROOT_RELATIVE_TO_MKSPECS}/${EGPF_INCLUDE_INSTALL_DIR}") endif() if(IS_ABSOLUTE "${EGPF_LIB_INSTALL_DIR}") set(PRI_TARGET_LIBS "${EGPF_LIB_INSTALL_DIR}") else() - set(PRI_TARGET_LIBS "${CMAKE_INSTALL_PREFIX}/${EGPF_LIB_INSTALL_DIR}") + set(PRI_TARGET_LIBS "$$PWD/${PRI_ROOT_RELATIVE_TO_MKSPECS}/${EGPF_LIB_INSTALL_DIR}") endif() set(PRI_TARGET_DEFINES "")