diff options
authorJoerg Bornemann <>2018-12-07 10:36:08 +0100
committerJoerg Bornemann <>2018-12-10 06:46:15 +0000
commit6a221f3d05b6d0e902d86d75428364747268c6c9 (patch)
parented90c306f2033eec4a6ac3aa356b2ea41e601160 (diff)
Fix qmake's detection for conflicting source files for nmake
Consider the following source tree: foo/narf.cpp bar/narf.c bar/gnampf.cpp The .pro file has SOURCES += foo/narf.cpp bar/gnampf.cpp The file bar/narf.c is not supposed to be built for whatever reason. QMake's nmake Makefile generator generates inference rules of the form {.\foo}.cpp{debug\}.obj:: ... for every source subdirectory and every source file extension. Thus, we have {.\foo}.cpp{debug\}.obj:: {.\bar}.cpp{debug\}.obj:: {.\bar}.c{debug\}.obj:: Depending on the exact execution order of the inference rules (which depends on the names of the files) the latter rule might get picked, and we're erronously compiling bar/narf.c even though it's not referenced in the .pro file. Conclusion: QMake's detection of conflicting source files must consider the base names of source files, and not the exact file names. Fixes: QTBUG-72059 Change-Id: I50c2725ae2a7421053369a10680230f571af00ea Reviewed-by: Oliver Wolff <> Reviewed-by: Oswald Buddenhagen <>
1 files changed, 4 insertions, 3 deletions
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 306ae57871..780f6bd4d8 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -553,12 +553,13 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
QDirIterator dit(sourceDir, sourceFilesFilter, QDir::Files | QDir::NoDotAndDotDot);
while (dit.hasNext()) {;
- QString &duplicate = fileNames[dit.fileName()];
+ const QFileInfo fi = dit.fileInfo();
+ QString &duplicate = fileNames[fi.completeBaseName()];
if (duplicate.isNull()) {
- duplicate = dit.filePath();
+ duplicate = fi.filePath();
} else {
warn_msg(WarnLogic, "%s conflicts with %s", qPrintable(duplicate),
- qPrintable(dit.filePath()));
+ qPrintable(fi.filePath()));
duplicatesFound = true;