summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorAndy Shaw <qt-info@nokia.com>2009-10-08 07:15:20 (GMT)
committerMarius Storm-Olsen <marius.storm-olsen@nokia.com>2009-10-19 11:30:18 (GMT)
commite1f691d84dad17c5ee47c97c31ae743093ad8bc9 (patch)
tree44191509230f34997040582706bb24c678b738cd /qmake
parentf9e46cdb2d9a42d52f90fe50a53a76c03065b9ce (diff)
downloadQt-e1f691d84dad17c5ee47c97c31ae743093ad8bc9.zip
Qt-e1f691d84dad17c5ee47c97c31ae743093ad8bc9.tar.gz
Qt-e1f691d84dad17c5ee47c97c31ae743093ad8bc9.tar.bz2
Ensure that qmake doesn't lose the error code when processing subdirs
When processing a project in a subdirs template failed for whatever reason then qmake would lose the result of that and would return an error code of 0 if the subdirs project file itself was processed fine. So now it ensures that any errors arising from processing a project referenced in a subdirs project file are not lost so that the error code returned from qmake will indicate an error actually occured. Task-number: QTBUG-4065 Reviewed-by: mariusSO Original-commit: c15b370c9db16fdbfd9e7bec89ee9bf8c1110827
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/metamakefile.cpp17
-rw-r--r--qmake/generators/metamakefile.h2
-rw-r--r--qmake/main.cpp6
3 files changed, 18 insertions, 7 deletions
diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
index 5915fcf..819cdaf 100644
--- a/qmake/generators/metamakefile.cpp
+++ b/qmake/generators/metamakefile.cpp
@@ -291,6 +291,7 @@ SubdirsMetaMakefileGenerator::init()
if(init_flag)
return false;
init_flag = true;
+ bool hasError = false;
if(Option::recursive) {
QString old_output_dir = Option::output_dir;
@@ -336,14 +337,18 @@ SubdirsMetaMakefileGenerator::init()
}
qmake_setpwd(sub->input_dir);
Option::output_dir = sub->output_dir;
- sub_proj->read(subdir.fileName());
+ bool tmpError = !sub_proj->read(subdir.fileName());
if(!sub_proj->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
fprintf(stderr, "Project file(%s) not recursed because all requirements not met:\n\t%s\n",
subdir.fileName().toLatin1().constData(),
sub_proj->values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData());
delete sub;
delete sub_proj;
+ Option::output_dir = old_output_dir;
+ qmake_setpwd(oldpwd);
continue;
+ } else {
+ hasError |= tmpError;
}
sub->makefile = MetaMakefileGenerator::createMetaGenerator(sub_proj, sub_name);
if(0 && sub->makefile->type() == SUBDIRSMETATYPE) {
@@ -351,7 +356,7 @@ SubdirsMetaMakefileGenerator::init()
} else {
const QString output_name = Option::output.fileName();
Option::output.setFileName(sub->output_file);
- sub->makefile->write(sub->output_dir);
+ hasError |= !sub->makefile->write(sub->output_dir);
delete sub;
qmakeClearCaches();
sub = 0;
@@ -376,7 +381,7 @@ SubdirsMetaMakefileGenerator::init()
self->makefile->init();
subs.append(self);
- return true;
+ return !hasError;
}
bool
@@ -482,7 +487,7 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO)
}
MetaMakefileGenerator *
-MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op)
+MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op, bool *success)
{
MetaMakefileGenerator *ret = 0;
if ((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE ||
@@ -492,7 +497,9 @@ MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &na
}
if (!ret)
ret = new BuildsMetaMakefileGenerator(proj, name, op);
- ret->init();
+ bool res = ret->init();
+ if (success)
+ *success = res;
return ret;
}
diff --git a/qmake/generators/metamakefile.h b/qmake/generators/metamakefile.h
index e69304a..f74f4a2 100644
--- a/qmake/generators/metamakefile.h
+++ b/qmake/generators/metamakefile.h
@@ -62,7 +62,7 @@ public:
virtual ~MetaMakefileGenerator();
- static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true);
+ static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true, bool *success = 0);
static MakefileGenerator *createMakefileGenerator(QMakeProject *proj, bool noIO = false);
inline QMakeProject *projectFile() const { return project; }
diff --git a/qmake/main.cpp b/qmake/main.cpp
index 73fdda9..a0346c5 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -168,7 +168,11 @@ int runQMake(int argc, char **argv)
continue;
}
- MetaMakefileGenerator *mkfile = MetaMakefileGenerator::createMetaGenerator(&project, QString(), false);
+ bool success = true;
+ MetaMakefileGenerator *mkfile = MetaMakefileGenerator::createMetaGenerator(&project, QString(), false, &success);
+ if (!success)
+ exit_val = 3;
+
if(mkfile && !mkfile->write(oldpwd)) {
if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT)
fprintf(stderr, "Unable to generate project file.\n");