diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2017-08-16 16:24:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-08-30 14:23:46 (GMT) |
commit | 311b7b1a7095ec460fab950a6767571eb3b9652c (patch) | |
tree | 23843c9cd26d9d150e76fadda88a8fbf47d5f12c /Source/cmMakefileTargetGenerator.cxx | |
parent | fff28e30cd01a88b2e5f67db2aaf4c068f1bfc89 (diff) | |
download | CMake-311b7b1a7095ec460fab950a6767571eb3b9652c.zip CMake-311b7b1a7095ec460fab950a6767571eb3b9652c.tar.gz CMake-311b7b1a7095ec460fab950a6767571eb3b9652c.tar.bz2 |
Add properties to run cppcheck along with the compiler
Create a `<LANG>_CPPCHECK` target property (initialized by a
`CMAKE_<LANG>_CPPCHECK` variable) to specify a `cppcheck` command line
to be run along with the compiler.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index b9bcdef..c1cf103 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -633,7 +633,10 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( const char* tidy = this->GeneratorTarget->GetProperty(tidy_prop); std::string const cpplint_prop = lang + "_CPPLINT"; const char* cpplint = this->GeneratorTarget->GetProperty(cpplint_prop); - if ((iwyu && *iwyu) || (tidy && *tidy) || (cpplint && *cpplint)) { + std::string const cppcheck_prop = lang + "_CPPCHECK"; + const char* cppcheck = this->GeneratorTarget->GetProperty(cppcheck_prop); + if ((iwyu && *iwyu) || (tidy && *tidy) || (cpplint && *cpplint) || + (cppcheck && *cppcheck)) { std::string run_iwyu = "$(CMAKE_COMMAND) -E __run_iwyu"; if (iwyu && *iwyu) { run_iwyu += " --iwyu="; @@ -647,7 +650,12 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( run_iwyu += " --cpplint="; run_iwyu += this->LocalGenerator->EscapeForShell(cpplint); } - if ((tidy && *tidy) || (cpplint && *cpplint)) { + if (cppcheck && *cppcheck) { + run_iwyu += " --cppcheck="; + run_iwyu += this->LocalGenerator->EscapeForShell(cppcheck); + } + if ((tidy && *tidy) || (cpplint && *cpplint) || + (cppcheck && *cppcheck)) { run_iwyu += " --source="; run_iwyu += sourceFile; } |