summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorOrkun Tokdemir <ilhanorkuntokdemir@gmail.com>2023-05-12 14:49:03 (GMT)
committerBrad King <brad.king@kitware.com>2023-05-16 14:47:56 (GMT)
commitb480315e0c229454c335290b19cc689930d7849f (patch)
treefd6c95e7d53d4a9c095947ba7cd718e0ce1ae60f /Source/cmNinjaTargetGenerator.cxx
parent993dde925f208d98c68edcd451b0d6979e0abdd4 (diff)
downloadCMake-b480315e0c229454c335290b19cc689930d7849f.zip
CMake-b480315e0c229454c335290b19cc689930d7849f.tar.gz
CMake-b480315e0c229454c335290b19cc689930d7849f.tar.bz2
TargetGenerator: Add SKIP_LINTING source property
The `SKIP_LINTING` source property was added to disable code check for desired source files. The `SKIP_LINTING`includes `cpplint`, `clang-tidy`, \ `cppcheck` and `include-what-you-use`. If `SKIP_LINTING` is set on a source file, the tools mentioned above will not be run on that source file.
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index cad4bf4..25e00d3 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1219,15 +1219,19 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
vars["FLAGS"] = this->ComputeFlagsForObject(source, language, config);
vars["DEFINES"] = this->ComputeDefines(source, language, config);
vars["INCLUDES"] = this->ComputeIncludes(source, language, config);
- auto const cmakeCmd = this->GetLocalGenerator()->ConvertToOutputFormat(
- cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
auto compilerLauncher = this->GetCompilerLauncher(language, config);
- vars["CODE_CHECK"] =
- this->GenerateCodeCheckRules(*source, compilerLauncher, cmakeCmd, config,
- [this](std::string const& path) {
- return this->ConvertToNinjaPath(path);
- });
+
+ cmValue const skipCodeCheck = source->GetProperty("SKIP_LINTING");
+ if (!skipCodeCheck.IsOn()) {
+ auto const cmakeCmd = this->GetLocalGenerator()->ConvertToOutputFormat(
+ cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
+ vars["CODE_CHECK"] =
+ this->GenerateCodeCheckRules(*source, compilerLauncher, cmakeCmd, config,
+ [this](const std::string& path) {
+ return this->ConvertToNinjaPath(path);
+ });
+ }
// If compiler launcher was specified and not consumed above, it
// goes to the beginning of the command line.