summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
diff options
context:
space:
mode:
authorHarald Brinkmann <Harald.Brinkmann@detectomat.com>2018-10-09 06:18:29 (GMT)
committerBrad King <brad.king@kitware.com>2018-10-11 11:56:05 (GMT)
commit3b80cd77fb3e1d0ee6a77a590830e7dc620df1a5 (patch)
treec558af62c709189bd3714e346029dbcc42293c66 /Source/cmcmd.cxx
parent0ab5db035ed47182fb8551f9872045eeae1f9cec (diff)
downloadCMake-3b80cd77fb3e1d0ee6a77a590830e7dc620df1a5.zip
CMake-3b80cd77fb3e1d0ee6a77a590830e7dc620df1a5.tar.gz
CMake-3b80cd77fb3e1d0ee6a77a590830e7dc620df1a5.tar.bz2
Fail the build if cppcheck returns a non-zero exit code
This allows the build failure to be tuned with cppcheck's options --error-exitcode=<n> and --exitcode-suppressions=<file>.
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r--Source/cmcmd.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 1d2f741..e2225ff 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -323,11 +323,15 @@ static int HandleCppCheck(const std::string& runCmd,
stdErr.find("(performance)") != std::string::npos ||
stdErr.find("(portability)") != std::string::npos ||
stdErr.find("(information)") != std::string::npos) {
- std::cerr << "Warning: cppcheck reported diagnostics:\n";
+ if (ret == 0) {
+ std::cerr << "Warning: cppcheck reported diagnostics:\n";
+ } else {
+ std::cerr << "Error: cppcheck reported failure:\n";
+ }
}
std::cerr << stdErr;
- // ignore errors so build continues
- return 0;
+
+ return ret;
}
typedef int (*CoCompileHandler)(const std::string&, const std::string&,