summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorJamie Snape <jamie.snape@kitware.com>2017-01-23 19:47:13 (GMT)
committerJamie Snape <jamie.snape@kitware.com>2017-01-23 19:47:13 (GMT)
commit0618ddf6b1da3a886f12b6ad2b19da49b2f87e28 (patch)
treeadb7c502f13bd571ff192e644de923f195b8fc81 /Source/cmNinjaTargetGenerator.cxx
parent7b4514fb33cf256ef165b2b28ba4affd1930a957 (diff)
downloadCMake-0618ddf6b1da3a886f12b6ad2b19da49b2f87e28.zip
CMake-0618ddf6b1da3a886f12b6ad2b19da49b2f87e28.tar.gz
CMake-0618ddf6b1da3a886f12b6ad2b19da49b2f87e28.tar.bz2
Add properties to run the cpplint style checker with the compiler
Create a `<LANG>_CPPLINT` target property (initialized by a `CMAKE_<LANG>_CPPLINT` variable) to specify a `cpplint` style checker command line to be run along with the compiler.
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 8ad2efe..0b33b19 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -600,7 +600,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
const char* iwyu = this->GeneratorTarget->GetProperty(iwyu_prop);
std::string const tidy_prop = lang + "_CLANG_TIDY";
const char* tidy = this->GeneratorTarget->GetProperty(tidy_prop);
- if ((iwyu && *iwyu) || (tidy && *tidy)) {
+ std::string const cpplint_prop = lang + "_CPPLINT";
+ const char* cpplint = this->GeneratorTarget->GetProperty(cpplint_prop);
+ if ((iwyu && *iwyu) || (tidy && *tidy) || (cpplint && *cpplint)) {
std::string run_iwyu = this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
run_iwyu += " -E __run_iwyu";
@@ -611,6 +613,12 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
if (tidy && *tidy) {
run_iwyu += " --tidy=";
run_iwyu += this->GetLocalGenerator()->EscapeForShell(tidy);
+ }
+ if (cpplint && *cpplint) {
+ run_iwyu += " --cpplint=";
+ run_iwyu += this->GetLocalGenerator()->EscapeForShell(cpplint);
+ }
+ if ((tidy && *tidy) || (cpplint && *cpplint)) {
run_iwyu += " --source=$in";
}
run_iwyu += " -- ";