summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorAndy Shaw <qt-info@nokia.com>2009-10-20 18:24:44 (GMT)
committerAndy Shaw <qt-info@nokia.com>2009-10-20 18:24:44 (GMT)
commit1315bcdd1e2add0ce26f0cb9a4d2a95477434315 (patch)
tree20e6192aa231511944d319cc99108f0cc821c8f2 /qmake
parent613866eb719e35fa2459cb12d46315ca9dcefa62 (diff)
downloadQt-1315bcdd1e2add0ce26f0cb9a4d2a95477434315.zip
Qt-1315bcdd1e2add0ce26f0cb9a4d2a95477434315.tar.gz
Qt-1315bcdd1e2add0ce26f0cb9a4d2a95477434315.tar.bz2
Ensure qmake does not lose the error code when going over the subdirs
When qmake was ran with -r over a subdirs project then it would lose the error code if a later project succeeded. This is a refix of the previous revert which has been confirmed to work all over the place now. Reviewed-by: Marius Storm-Olsen
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");