summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 753a5ae..fd1d16d 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -419,13 +419,25 @@ cmNinjaTargetGenerator
{
std::string const iwyu_prop = lang + "_INCLUDE_WHAT_YOU_USE";
const char *iwyu = this->GeneratorTarget->GetProperty(iwyu_prop);
- if (iwyu && *iwyu)
+ std::string const tidy_prop = lang + "_CLANG_TIDY";
+ const char *tidy = this->GeneratorTarget->GetProperty(tidy_prop);
+ if ((iwyu && *iwyu) || (tidy && *tidy))
{
std::string run_iwyu =
this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
- run_iwyu += " -E __run_iwyu --iwyu=";
- run_iwyu += this->GetLocalGenerator()->EscapeForShell(iwyu);
+ run_iwyu += " -E __run_iwyu";
+ if (iwyu && *iwyu)
+ {
+ run_iwyu += " --iwyu=";
+ run_iwyu += this->GetLocalGenerator()->EscapeForShell(iwyu);
+ }
+ if (tidy && *tidy)
+ {
+ run_iwyu += " --tidy=";
+ run_iwyu += this->GetLocalGenerator()->EscapeForShell(tidy);
+ run_iwyu += " --source=$in";
+ }
run_iwyu += " -- ";
compileCmds.front().insert(0, run_iwyu);
}