summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAndrew Fuller <afuller@teradici.com>2020-11-05 04:46:51 (GMT)
committerAndrew Fuller <afuller@teradici.com>2020-11-05 19:39:32 (GMT)
commit1134064e22828605ce1ea387b8f96e38e5705463 (patch)
tree0b9caf582aca776f95814fc2f4a2b79dc74752cb /Source
parentda0a7d28a4560c3e135936c91d97b104c01616ad (diff)
downloadCMake-1134064e22828605ce1ea387b8f96e38e5705463.zip
CMake-1134064e22828605ce1ea387b8f96e38e5705463.tar.gz
CMake-1134064e22828605ce1ea387b8f96e38e5705463.tar.bz2
clang-tidy: allow OBJC and OBJCXX
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx20
-rw-r--r--Source/cmNinjaTargetGenerator.cxx20
-rw-r--r--Source/cmTarget.cxx2
3 files changed, 28 insertions, 14 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index b160064..370608f 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -873,15 +873,21 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
}
// Maybe insert an include-what-you-use runner.
- if (!compileCommands.empty() && (lang == "C" || lang == "CXX")) {
- std::string const iwyu_prop = lang + "_INCLUDE_WHAT_YOU_USE";
- cmProp iwyu = this->GeneratorTarget->GetProperty(iwyu_prop);
+ if (!compileCommands.empty() &&
+ (lang == "C" || lang == "CXX" || lang == "OBJC" || lang == "OBJCXX")) {
std::string const tidy_prop = lang + "_CLANG_TIDY";
cmProp tidy = this->GeneratorTarget->GetProperty(tidy_prop);
- std::string const cpplint_prop = lang + "_CPPLINT";
- cmProp cpplint = this->GeneratorTarget->GetProperty(cpplint_prop);
- std::string const cppcheck_prop = lang + "_CPPCHECK";
- cmProp cppcheck = this->GeneratorTarget->GetProperty(cppcheck_prop);
+ cmProp iwyu = nullptr;
+ cmProp cpplint = nullptr;
+ cmProp cppcheck = nullptr;
+ if (lang == "C" || lang == "CXX") {
+ std::string const iwyu_prop = lang + "_INCLUDE_WHAT_YOU_USE";
+ iwyu = this->GeneratorTarget->GetProperty(iwyu_prop);
+ std::string const cpplint_prop = lang + "_CPPLINT";
+ cpplint = this->GeneratorTarget->GetProperty(cpplint_prop);
+ std::string const cppcheck_prop = lang + "_CPPCHECK";
+ cppcheck = this->GeneratorTarget->GetProperty(cppcheck_prop);
+ }
if (cmNonempty(iwyu) || cmNonempty(tidy) || cmNonempty(cpplint) ||
cmNonempty(cppcheck)) {
std::string run_iwyu = "$(CMAKE_COMMAND) -E __run_co_compile";
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 0566949..5e27356 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -824,15 +824,21 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
}
// Maybe insert an include-what-you-use runner.
- if (!compileCmds.empty() && (lang == "C" || lang == "CXX")) {
- std::string const iwyu_prop = cmStrCat(lang, "_INCLUDE_WHAT_YOU_USE");
- cmProp iwyu = this->GeneratorTarget->GetProperty(iwyu_prop);
+ if (!compileCmds.empty() &&
+ (lang == "C" || lang == "CXX" || lang == "OBJC" || lang == "OBJCXX")) {
std::string const tidy_prop = cmStrCat(lang, "_CLANG_TIDY");
cmProp tidy = this->GeneratorTarget->GetProperty(tidy_prop);
- std::string const cpplint_prop = cmStrCat(lang, "_CPPLINT");
- cmProp cpplint = this->GeneratorTarget->GetProperty(cpplint_prop);
- std::string const cppcheck_prop = cmStrCat(lang, "_CPPCHECK");
- cmProp cppcheck = this->GeneratorTarget->GetProperty(cppcheck_prop);
+ cmProp iwyu = nullptr;
+ cmProp cpplint = nullptr;
+ cmProp cppcheck = nullptr;
+ if (lang == "C" || lang == "CXX") {
+ std::string const iwyu_prop = cmStrCat(lang, "_INCLUDE_WHAT_YOU_USE");
+ iwyu = this->GeneratorTarget->GetProperty(iwyu_prop);
+ std::string const cpplint_prop = cmStrCat(lang, "_CPPLINT");
+ cpplint = this->GeneratorTarget->GetProperty(cpplint_prop);
+ std::string const cppcheck_prop = cmStrCat(lang, "_CPPCHECK");
+ cppcheck = this->GeneratorTarget->GetProperty(cppcheck_prop);
+ }
if (cmNonempty(iwyu) || cmNonempty(tidy) || cmNonempty(cpplint) ||
cmNonempty(cppcheck)) {
std::string run_iwyu = cmStrCat(cmakeCmd, " -E __run_co_compile");
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 0860b71..35224eb 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -372,6 +372,8 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("ISPC_INSTRUCTION_SETS");
initProp("LINK_SEARCH_START_STATIC");
initProp("LINK_SEARCH_END_STATIC");
+ initProp("OBJC_CLANG_TIDY");
+ initProp("OBJCXX_CLANG_TIDY");
initProp("Swift_LANGUAGE_VERSION");
initProp("Swift_MODULE_DIRECTORY");
initProp("VS_JUST_MY_CODE_DEBUGGING");