|
|
@@ -761,7 +761,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=";
|