diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2023-01-13 10:53:43 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2023-01-18 13:21:05 +0100 |
commit | 98a3634299e29104dee391145728dbad9797d7b3 (patch) | |
tree | 37f18ec26b5440148f2f9910ae016d86996adf26 /qmake | |
parent | b71169005983f6eb9ac2e6eeb25533bf72a715d7 (diff) |
Make qmake and qtpaths report Qt version baked into the binaries
QMake and qtpaths used qVersion() to report Qt's version number. This is
problematic if those tools are run in an environment where a different
Qt version is loaded (e.g. by setting LD_LIBRARY_PATH).
This reverts commit a783c3d574a1400c4dfdd32975fc511f095df8b2, which
changed the use of the QT_VERSION define to a qVersion() call in qmake.
Additionally, we use QT_VERSION in qtpaths too for consistency.
Pick-to: 6.5
Change-Id: I6c8a1aa6ee6169becd7c685a98ce23c22c3864c7
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | qmake/generators/makefile.cpp | 2 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 2 | ||||
-rw-r--r-- | qmake/option.cpp | 2 | ||||
-rw-r--r-- | qmake/property.cpp | 6 |
5 files changed, 9 insertions, 4 deletions
diff --git a/qmake/CMakeLists.txt b/qmake/CMakeLists.txt index 8b74b85c49..9be6b92d68 100644 --- a/qmake/CMakeLists.txt +++ b/qmake/CMakeLists.txt @@ -40,6 +40,7 @@ target_compile_definitions(QtLibraryInfo PUBLIC QT_BUILD_QMAKE QT_USE_QSTRINGBUILDER QT_NO_FOREACH + QT_VERSION_STR="${PROJECT_VERSION}" QT_HOST_MKSPEC="${QT_QMAKE_HOST_MKSPEC}" QT_TARGET_MKSPEC="${QT_QMAKE_TARGET_MKSPEC}" QT_HOST_DATADIR="${hostdatadir}" diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 257601eaf7..cc985a878b 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2298,7 +2298,7 @@ MakefileGenerator::writeHeader(QTextStream &t) { t << "#############################################################################\n"; t << "# Makefile for building: " << escapeFilePath(var("TARGET")) << Qt::endl; - t << "# Generated by qmake (" QMAKE_VERSION_STR ") (Qt " << qVersion() << ")\n"; + t << "# Generated by qmake (" QMAKE_VERSION_STR ") (Qt " QT_VERSION_STR ")\n"; t << "# Project: " << fileFixify(project->projectFile()) << Qt::endl; t << "# Template: " << var("TEMPLATE") << Qt::endl; if(!project->isActiveConfig("build_pass")) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 20ba642e9d..19e0b73ab4 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1478,7 +1478,7 @@ UnixMakefileGenerator::writeLibtoolFile() QTextStream t(&ft); t << "# " << lname << " - a libtool library file\n"; t << "# Generated by qmake/libtool (" QMAKE_VERSION_STR ") (Qt " - << qVersion() << ")"; + << QT_VERSION_STR << ")"; t << "\n"; t << "# The name that we can dlopen(3).\n" diff --git a/qmake/option.cpp b/qmake/option.cpp index 885022b673..584161818f 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -200,7 +200,7 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state) fprintf(stdout, "QMake version %s\n" "Using Qt version %s in %s\n", - QMAKE_VERSION_STR, qVersion(), + QMAKE_VERSION_STR, QT_VERSION_STR, QMakeLibraryInfo::path(QLibraryInfo::LibrariesPath) .toLatin1() .constData()); diff --git a/qmake/property.cpp b/qmake/property.cpp index af4ed0e9ee..32b6729c13 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -76,7 +76,9 @@ void QMakeProperty::reload() #ifdef QMAKE_VERSION_STR m_values["QMAKE_VERSION"] = ProString(QMAKE_VERSION_STR); #endif - m_values["QT_VERSION"] = ProString(qVersion()); +#ifdef QT_VERSION_STR + m_values["QT_VERSION"] = ProString(QT_VERSION_STR); +#endif } QMakeProperty::~QMakeProperty() @@ -142,7 +144,9 @@ int QMakeProperty::queryProperty(const QStringList &optionProperties, #ifdef QMAKE_VERSION_STR specialProps.append("QMAKE_VERSION"); #endif +#ifdef QT_VERSION_STR specialProps.append("QT_VERSION"); +#endif for (const QString &prop : std::as_const(specialProps)) { ProString val = value(ProKey(prop)); ProString pval = value(ProKey(prop + "/raw")); |