summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-03-01 15:31:42 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2021-03-01 17:36:56 +0100
commitd1101c460e173e3554fa4e5c800ab3e82ddc3aad (patch)
tree20a1a442dc1218f59dce2e4c17976719919d16ef /qmake
parent93f55570c4800d78760ad76207d8410622efaa9c (diff)
Simplify prefix-related functionality of qmake
Since the QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH and QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH definitions keep the same value in modern CMake build, no need to have special handling in cases where these values are used in qmake. Also it will be useful to specify the relative path to the prefix directory from the directories different of 'bin' when use QMakeLibraryInfo. Task-number: QTBUG-75870 Change-Id: I5a777001eb334dcf05e22853a514d4257352d59b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/CMakeLists.txt9
-rw-r--r--qmake/qmakelibraryinfo.cpp21
2 files changed, 12 insertions, 18 deletions
diff --git a/qmake/CMakeLists.txt b/qmake/CMakeLists.txt
index 08b23df587..5a464ece40 100644
--- a/qmake/CMakeLists.txt
+++ b/qmake/CMakeLists.txt
@@ -21,6 +21,14 @@ Required features:
return()
endif()
+# The QT_CONFIGURE_HOSTBINDIR_TO_*PREFIX_PATH defines are exclusively used by qmake to determine
+# the prefix from the location of the qmake executable. In our build of qmake host_prefix is
+# always the same as ext_prefix, and we can just use CMAKE_INSTALL_PREFIX for the calculation of
+# the relative path between <ext_prefix>/bin and <ext_prefix>.
+file(RELATIVE_PATH QT_CONFIGURE_RELATIVE_PREFIX_PATH
+ "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}" "${CMAKE_INSTALL_PREFIX}"
+)
+
qt_get_tool_target_name(target_name qmake)
qt_internal_add_tool(${target_name}
TOOLS_TARGET Core # special case
@@ -65,6 +73,7 @@ qt_internal_add_tool(${target_name}
QT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} # special case
QT_VERSION_MINOR=${PROJECT_VERSION_MINOR} # special case
QT_VERSION_PATCH=${PROJECT_VERSION_PATCH} # special case
+ QT_CONFIGURE_RELATIVE_PREFIX_PATH="${QT_CONFIGURE_RELATIVE_PREFIX_PATH}"
INCLUDE_DIRECTORIES
generators
generators/mac
diff --git a/qmake/qmakelibraryinfo.cpp b/qmake/qmakelibraryinfo.cpp
index 273da190d4..ac8d191248 100644
--- a/qmake/qmakelibraryinfo.cpp
+++ b/qmake/qmakelibraryinfo.cpp
@@ -139,26 +139,11 @@ void QMakeLibraryInfo::sysrootify(QString &path)
}
}
-static QString getPrefixFromHostBinDir(const char *hostBinDirToPrefixPath)
+static QString getPrefix()
{
const QString canonicalQMakePath = QFileInfo(qmake_abslocation()).canonicalPath();
return QDir::cleanPath(canonicalQMakePath + QLatin1Char('/')
- + QLatin1String(hostBinDirToPrefixPath));
-}
-
-static QString getExtPrefixFromHostBinDir()
-{
- return getPrefixFromHostBinDir(QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH);
-}
-
-static QString getHostPrefixFromHostBinDir()
-{
- return getPrefixFromHostBinDir(QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH);
-}
-
-static QString getPrefix()
-{
- return getExtPrefixFromHostBinDir();
+ + QLatin1String(QT_CONFIGURE_RELATIVE_PREFIX_PATH));
}
QString QMakeLibraryInfo::path(int loc)
@@ -271,7 +256,7 @@ QString QMakeLibraryInfo::rawLocation(int loc, QMakeLibraryInfo::PathGroup group
path = QT_CONFIGURE_SETTINGS_PATH;
#endif
} else if (loc == HostPrefixPath) {
- static const QByteArray hostPrefixPath = getHostPrefixFromHostBinDir().toLatin1();
+ static const QByteArray hostPrefixPath = getPrefix().toLatin1();
path = hostPrefixPath.constData();
}