qmake: Delete static library before calling ar on MinGW
This was already done on unix, but not for MinGW. If the archive already exists, it is appended rather than replaced. This can cause invalid references when whole-archive linking is used and some object file that was already linked was deleted. Change-Id: Ie265371f197d996d57002b248043736544ee641e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
parent
9ac4a9ef26
commit
f5f772849c
@ -36,6 +36,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define NULL_DEVICE "NUL"
|
||||
#else
|
||||
#define NULL_DEVICE "/dev/null"
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator()
|
||||
@ -318,6 +324,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
|
||||
if(!project->isEmpty("QMAKE_PRE_LINK"))
|
||||
t << "\n\t" <<var("QMAKE_PRE_LINK");
|
||||
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
|
||||
t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" NULL_DEVICE;
|
||||
if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) {
|
||||
t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user