aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2020-12-15 21:40:27 +0000
committerAleix Pol Gonzalez <aleixpol@kde.org>2021-02-08 14:31:43 +0000
commitcd2f66b9aa12455b914952c5c61518490d0c172d (patch)
treec2bdc3491f2bf93706dcc003af2bd0a51a1180e0 /modules
parent73c16740d2629cd03f9b9081919a569d2aaa4af4 (diff)
downloadextra-cmake-modules-cd2f66b9aa12455b914952c5c61518490d0c172d.tar.gz
extra-cmake-modules-cd2f66b9aa12455b914952c5c61518490d0c172d.tar.bz2
Define relative paths when KDE_INSTALL_USE_QT_SYS_PATHS is enabled
When building multiple KDE projects, installing them to "$DESTDIR" and having cmake look for kde dependencies in "$DESTDIR" using "CMAKE_PREFIX_PATH=$DESTDIR/usr", we currently get failures when calling find_package() on projects that use KDE_INSTALL_QTPLUGINDIR, KDE_INSTALL_QTQMLDIR and KDE_INSTALL_QTQUICKIMPORTSDIR because these are defined as absolute paths when KDE_INSTALL_USE_QT_SYS_PATHS is enabled. This commit defines these paths relative to qmake's QT_INSTALL_PREFIX property instead when KDE is install to the same prefix as Qt. This fixes DESTDIR installations because with relative paths, CMake will search for these paths in "$DESTDIR" as well as "/". We limit this change to the scenario where the Qt and CMake install prefixes are the same because always doing this would break backwards compatibility as qml and plugins would be installed into CMAKE_INSTALL_PREFIX instead of QT_INSTALL_PREFIX after this change.
Diffstat (limited to 'modules')
-rw-r--r--modules/ECMGeneratePriFile.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/ECMGeneratePriFile.cmake b/modules/ECMGeneratePriFile.cmake
index f63a0ce2..22c88183 100644
--- a/modules/ECMGeneratePriFile.cmake
+++ b/modules/ECMGeneratePriFile.cmake
@@ -89,7 +89,11 @@ endif()
if(KDE_INSTALL_USE_QT_SYS_PATHS OR _askqmake)
include(ECMQueryQmake)
+ query_qmake(qt_install_prefix_dir QT_INSTALL_PREFIX TRY)
query_qmake(qt_host_data_dir QT_HOST_DATA)
+ if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}")
+ file(RELATIVE_PATH qt_host_data_dir ${qt_install_prefix_dir} ${qt_host_data_dir})
+ endif()
set(ECM_MKSPECS_INSTALL_DIR ${qt_host_data_dir}/mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.")
else()
set(ECM_MKSPECS_INSTALL_DIR mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.")