summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorPeter Kuemmel <syntheticpp@gmx.net>2012-06-28 11:46:43 (GMT)
committerPeter Kuemmel <syntheticpp@gmx.net>2012-06-28 11:48:10 (GMT)
commit24a35cef25a939a555360528e95c1f434c7ffc8b (patch)
treecf848dbe25bc2b6dc5823d5f21f415e6cf9a7ca5 /Source
parent5f12424ebc9f810ef279d09f1e660e20558dd535 (diff)
downloadCMake-24a35cef25a939a555360528e95c1f434c7ffc8b.zip
CMake-24a35cef25a939a555360528e95c1f434c7ffc8b.tar.gz
CMake-24a35cef25a939a555360528e95c1f434c7ffc8b.tar.bz2
Ninja: print error message when command failed
Diffstat (limited to 'Source')
-rw-r--r--Source/cmcldeps.cxx25
1 files changed, 8 insertions, 17 deletions
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index 39f696f..ce64132 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -178,11 +178,9 @@ static int process( const std::string& srcfilename,
bool quiet = false)
{
std::string output;
- int ret = 0;
// break up command line into a vector
std::vector<std::string> args;
- cmSystemTools::ParseWindowsCommandLine(cmd.c_str(),
- args);
+ cmSystemTools::ParseWindowsCommandLine(cmd.c_str(), args);
// convert to correct vector type for RunSingleCommand
std::vector<cmStdString> command;
for(std::vector<std::string>::iterator i = args.begin();
@@ -191,14 +189,10 @@ static int process( const std::string& srcfilename,
command.push_back(i->c_str());
}
// run the command
- bool success =
- cmSystemTools::RunSingleCommand(command, &output, &ret, dir.c_str(),
- cmSystemTools::OUTPUT_NONE);
- if(ret!= 0)
- {
- return 2;
- }
- int exit_code = ret;
+ int exit_code = 0;
+ bool run = cmSystemTools::RunSingleCommand(command, &output, &exit_code,
+ dir.c_str(), cmSystemTools::OUTPUT_NONE);
+
// process the include directives and output everything else
std::stringstream ss(output);
std::string line;
@@ -221,14 +215,11 @@ static int process( const std::string& srcfilename,
}
}
- if (!success) {
- return exit_code;
- }
-
// don't update .d until/unless we succeed compilation
- outputDepFile(dfile, objfile, includes);
+ if (run && exit_code == 0)
+ outputDepFile(dfile, objfile, includes);
- return 0;
+ return exit_code;
}