summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx8
-rw-r--r--Source/cmNinjaTargetGenerator.cxx8
2 files changed, 14 insertions, 2 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 714d01e..a2fa3b1 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -782,7 +782,13 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
}
if (tidy && *tidy) {
run_iwyu += " --tidy=";
- run_iwyu += this->LocalGenerator->EscapeForShell(tidy);
+ const char* driverMode = this->Makefile->GetDefinition(
+ "CMAKE_" + lang + "_CLANG_TIDY_DRIVER_MODE");
+ if (!(driverMode && *driverMode)) {
+ driverMode = lang == "C" ? "gcc" : "g++";
+ }
+ run_iwyu += this->LocalGenerator->EscapeForShell(
+ cmStrCat(tidy, ";--driver-mode=", driverMode));
}
if (cpplint && *cpplint) {
run_iwyu += " --cpplint=";
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 455d809..5a9f74c 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -759,7 +759,13 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
}
if (tidy && *tidy) {
run_iwyu += " --tidy=";
- run_iwyu += this->GetLocalGenerator()->EscapeForShell(tidy);
+ const char* driverMode = this->Makefile->GetDefinition(
+ "CMAKE_" + lang + "_CLANG_TIDY_DRIVER_MODE");
+ if (!(driverMode && *driverMode)) {
+ driverMode = lang == "C" ? "gcc" : "g++";
+ }
+ run_iwyu += this->GetLocalGenerator()->EscapeForShell(
+ cmStrCat(tidy, ";--driver-mode=", driverMode));
}
if (cpplint && *cpplint) {
run_iwyu += " --cpplint=";