Fix installation of .pdb files for applications that have VERSION set

For applications that set VERSION the installation targets of pdb
files were wrong in qmake's nmake Makefile generator.

Replace code that tries to reconstruct that target's versioned
extension with TARGET_EXT which already contains the fully resolved
target extension.

Fixes: QTBUG-74265
Change-Id: I9553a5f70170e077a59c866079ae51647ae80bef
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Joerg Bornemann 2019-03-12 11:59:58 +01:00
parent 3cdf46059a
commit 9e97d64ccd
2 changed files with 12 additions and 12 deletions

View File

@ -95,7 +95,9 @@ QString NmakeMakefileGenerator::defaultInstall(const QString &t)
if (project->isActiveConfig("debug_info")) {
if (t == "dlltarget" || project->values(ProKey(t + ".CONFIG")).indexOf("no_dll") == -1) {
QString pdb_target = project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".pdb";
const QFileInfo targetFileInfo = project->first("DESTDIR") + project->first("TARGET")
+ project->first("TARGET_EXT");
const QString pdb_target = targetFileInfo.completeBaseName() + ".pdb";
QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + pdb_target;
QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + pdb_target, FileFixifyAbsolute));
if(!ret.isEmpty())
@ -252,15 +254,16 @@ void NmakeMakefileGenerator::init()
project->values("PRECOMPILED_PCH_C") = ProStringList(precompPchC);
}
ProString tgt = project->first("DESTDIR")
+ project->first("TARGET") + project->first("TARGET_VERSION_EXT");
const QFileInfo targetFileInfo = project->first("DESTDIR") + project->first("TARGET")
+ project->first("TARGET_EXT");
const ProString targetBase = targetFileInfo.path() + '/' + targetFileInfo.completeBaseName();
if (project->first("TEMPLATE") == "lib" && project->isActiveConfig("shared")) {
project->values("QMAKE_CLEAN").append(tgt + ".exp");
project->values("QMAKE_DISTCLEAN").append(tgt + ".lib");
project->values("QMAKE_CLEAN").append(targetBase + ".exp");
project->values("QMAKE_DISTCLEAN").append(targetBase + ".lib");
}
if (project->isActiveConfig("debug_info")) {
QString pdbfile;
QString distPdbFile = tgt + ".pdb";
QString distPdbFile = targetBase + ".pdb";
if (project->isActiveConfig("staticlib")) {
// For static libraries, the compiler's pdb file and the dist pdb file are the same.
pdbfile = distPdbFile;
@ -276,8 +279,8 @@ void NmakeMakefileGenerator::init()
project->values("QMAKE_DISTCLEAN").append(distPdbFile);
}
if (project->isActiveConfig("debug")) {
project->values("QMAKE_CLEAN").append(tgt + ".ilk");
project->values("QMAKE_CLEAN").append(tgt + ".idb");
project->values("QMAKE_CLEAN").append(targetBase + ".ilk");
project->values("QMAKE_CLEAN").append(targetBase + ".idb");
} else {
ProStringList &defines = project->values("DEFINES");
if (!defines.contains("NDEBUG"))

View File

@ -244,7 +244,6 @@ void tst_qmake::simple_app_versioned()
QVERIFY2(QFile::exists(pdbFilePath), qPrintable(pdbFilePath));
QVERIFY(test_compiler.make(buildDir, "install"));
QString installedPdbFilePath = installDir + '/' + targetBase + ".pdb";
QEXPECT_FAIL("", "QTBUG-74265", Continue);
QVERIFY2(QFile::exists(installedPdbFilePath), qPrintable(installedPdbFilePath));
}
@ -252,10 +251,8 @@ void tst_qmake::simple_app_versioned()
QVERIFY(test_compiler.exists(destDir, "simple app", Exe, version));
QVERIFY(test_compiler.makeDistClean(buildDir));
QVERIFY(!test_compiler.exists(destDir, "simple app", Exe, version));
if (checkPdb) {
QEXPECT_FAIL("", "QTBUG-74265", Continue);
if (checkPdb)
QVERIFY(!QFile::exists(pdbFilePath));
}
QVERIFY(test_compiler.removeMakefile(buildDir));
}