From 856fc410bf5337295d0ff1bcb9b746d2b7811fc4 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 8 May 2020 11:13:15 +0200 Subject: ECMGeneratePriFile: make the pri files relocatable Summary: Instead of generating QT.KArchive.includes = /full/path/include/KF5/KArchive make it QT.KArchive.includes = $$PWD/../../include/KF5/KArchive This makes the whole install prefix relocatable after the fact, the includes will be found based on where the .pri file ended up. This is especially useful for Conan support, says Bogdan. Test Plan: After make install in ECM, cd karchive/examples/helloworld && qmake && make Reviewers: vatra, kfunk, apol, vkrause Reviewed By: vkrause Subscribers: ablu, kossebau, kde-frameworks-devel, kde-buildsystem Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D29274 --- modules/ECMGeneratePriFile.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules/ECMGeneratePriFile.cmake') diff --git a/modules/ECMGeneratePriFile.cmake b/modules/ECMGeneratePriFile.cmake index 037b78a8..4f893639 100644 --- a/modules/ECMGeneratePriFile.cmake +++ b/modules/ECMGeneratePriFile.cmake @@ -159,18 +159,22 @@ function(ECM_GENERATE_PRI_FILE) 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 "") -- cgit v1.2.1