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 a783c3d574
, 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>
This commit is contained in:
parent
b711690059
commit
98a3634299
@ -40,6 +40,7 @@ target_compile_definitions(QtLibraryInfo PUBLIC
|
|||||||
QT_BUILD_QMAKE
|
QT_BUILD_QMAKE
|
||||||
QT_USE_QSTRINGBUILDER
|
QT_USE_QSTRINGBUILDER
|
||||||
QT_NO_FOREACH
|
QT_NO_FOREACH
|
||||||
|
QT_VERSION_STR="${PROJECT_VERSION}"
|
||||||
QT_HOST_MKSPEC="${QT_QMAKE_HOST_MKSPEC}"
|
QT_HOST_MKSPEC="${QT_QMAKE_HOST_MKSPEC}"
|
||||||
QT_TARGET_MKSPEC="${QT_QMAKE_TARGET_MKSPEC}"
|
QT_TARGET_MKSPEC="${QT_QMAKE_TARGET_MKSPEC}"
|
||||||
QT_HOST_DATADIR="${hostdatadir}"
|
QT_HOST_DATADIR="${hostdatadir}"
|
||||||
|
@ -2298,7 +2298,7 @@ MakefileGenerator::writeHeader(QTextStream &t)
|
|||||||
{
|
{
|
||||||
t << "#############################################################################\n";
|
t << "#############################################################################\n";
|
||||||
t << "# Makefile for building: " << escapeFilePath(var("TARGET")) << Qt::endl;
|
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 << "# Project: " << fileFixify(project->projectFile()) << Qt::endl;
|
||||||
t << "# Template: " << var("TEMPLATE") << Qt::endl;
|
t << "# Template: " << var("TEMPLATE") << Qt::endl;
|
||||||
if(!project->isActiveConfig("build_pass"))
|
if(!project->isActiveConfig("build_pass"))
|
||||||
|
@ -1478,7 +1478,7 @@ UnixMakefileGenerator::writeLibtoolFile()
|
|||||||
QTextStream t(&ft);
|
QTextStream t(&ft);
|
||||||
t << "# " << lname << " - a libtool library file\n";
|
t << "# " << lname << " - a libtool library file\n";
|
||||||
t << "# Generated by qmake/libtool (" QMAKE_VERSION_STR ") (Qt "
|
t << "# Generated by qmake/libtool (" QMAKE_VERSION_STR ") (Qt "
|
||||||
<< qVersion() << ")";
|
<< QT_VERSION_STR << ")";
|
||||||
t << "\n";
|
t << "\n";
|
||||||
|
|
||||||
t << "# The name that we can dlopen(3).\n"
|
t << "# The name that we can dlopen(3).\n"
|
||||||
|
@ -200,7 +200,7 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state)
|
|||||||
fprintf(stdout,
|
fprintf(stdout,
|
||||||
"QMake version %s\n"
|
"QMake version %s\n"
|
||||||
"Using Qt version %s in %s\n",
|
"Using Qt version %s in %s\n",
|
||||||
QMAKE_VERSION_STR, qVersion(),
|
QMAKE_VERSION_STR, QT_VERSION_STR,
|
||||||
QMakeLibraryInfo::path(QLibraryInfo::LibrariesPath)
|
QMakeLibraryInfo::path(QLibraryInfo::LibrariesPath)
|
||||||
.toLatin1()
|
.toLatin1()
|
||||||
.constData());
|
.constData());
|
||||||
|
@ -76,7 +76,9 @@ void QMakeProperty::reload()
|
|||||||
#ifdef QMAKE_VERSION_STR
|
#ifdef QMAKE_VERSION_STR
|
||||||
m_values["QMAKE_VERSION"] = ProString(QMAKE_VERSION_STR);
|
m_values["QMAKE_VERSION"] = ProString(QMAKE_VERSION_STR);
|
||||||
#endif
|
#endif
|
||||||
m_values["QT_VERSION"] = ProString(qVersion());
|
#ifdef QT_VERSION_STR
|
||||||
|
m_values["QT_VERSION"] = ProString(QT_VERSION_STR);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QMakeProperty::~QMakeProperty()
|
QMakeProperty::~QMakeProperty()
|
||||||
@ -142,7 +144,9 @@ int QMakeProperty::queryProperty(const QStringList &optionProperties,
|
|||||||
#ifdef QMAKE_VERSION_STR
|
#ifdef QMAKE_VERSION_STR
|
||||||
specialProps.append("QMAKE_VERSION");
|
specialProps.append("QMAKE_VERSION");
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef QT_VERSION_STR
|
||||||
specialProps.append("QT_VERSION");
|
specialProps.append("QT_VERSION");
|
||||||
|
#endif
|
||||||
for (const QString &prop : std::as_const(specialProps)) {
|
for (const QString &prop : std::as_const(specialProps)) {
|
||||||
ProString val = value(ProKey(prop));
|
ProString val = value(ProKey(prop));
|
||||||
ProString pval = value(ProKey(prop + "/raw"));
|
ProString pval = value(ProKey(prop + "/raw"));
|
||||||
|
@ -17,6 +17,7 @@ qt_internal_add_tool(${target_name}
|
|||||||
DEFINES
|
DEFINES
|
||||||
QT_NO_FOREACH
|
QT_NO_FOREACH
|
||||||
QTPATHS_VERSION_STR="2.0"
|
QTPATHS_VERSION_STR="2.0"
|
||||||
|
QT_VERSION_STR="${PROJECT_VERSION}"
|
||||||
)
|
)
|
||||||
qt_internal_return_unless_building_tools()
|
qt_internal_return_unless_building_tools()
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
QStringList results;
|
QStringList results;
|
||||||
if (parser.isSet(qtversion)) {
|
if (parser.isSet(qtversion)) {
|
||||||
QString qtversionstring = QString::fromLatin1(qVersion());
|
QString qtversionstring = QString::fromLatin1(QT_VERSION_STR);
|
||||||
results << qtversionstring;
|
results << qtversionstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user