diff options
author | David Faure <faure@kde.org> | 2020-05-08 11:13:15 +0200 |
---|---|---|
committer | David Faure <faure@kde.org> | 2020-05-08 11:13:23 +0200 |
commit | 856fc410bf5337295d0ff1bcb9b746d2b7811fc4 (patch) | |
tree | c97b1b19470d6ceacfd04db3085e81d8c805e7ce /modules | |
parent | 8d181637a0334eff48bebd8b6e21db3884f3c180 (diff) | |
download | extra-cmake-modules-856fc410bf5337295d0ff1bcb9b746d2b7811fc4.tar.gz extra-cmake-modules-856fc410bf5337295d0ff1bcb9b746d2b7811fc4.tar.bz2 |
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
Diffstat (limited to 'modules')
-rw-r--r-- | modules/ECMGeneratePriFile.cmake | 8 |
1 files changed, 6 insertions, 2 deletions
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 "") |