Merge topic 'target-SKIP_LINTING'

f100769d72 Add `SKIP_LINTING` target property and `CMAKE_SKIP_LINTING` variable
0d6b5d54b2 Tests/RunCMake/MultiLint: Extract test preparation code into separate file
3a21092d75 Tests/RunCMake/MultiLint: Refactor test runs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11139
This commit is contained in:
Brad King
2025-09-10 13:53:11 +00:00
committed by Kitware Robot
17 changed files with 163 additions and 49 deletions

View File

@@ -1011,14 +1011,18 @@ void cmFastbuildNormalTargetGenerator::CollapseAllExecsIntoOneScriptfile(
std::string cmFastbuildNormalTargetGenerator::ComputeCodeCheckOptions(
cmSourceFile const& srcFile)
{
cmValue const skipCodeCheck = srcFile.GetProperty("SKIP_LINTING");
std::string staticCheckRule;
if (!skipCodeCheck.IsOn()) {
std::string compilerLauncher;
staticCheckRule = this->GenerateCodeCheckRules(srcFile, compilerLauncher,
"", Config, nullptr);
LogMessage(cmStrCat("CodeCheck: ", staticCheckRule));
cmValue const srcSkipCodeCheckVal = srcFile.GetProperty("SKIP_LINTING");
bool const skipCodeCheck = srcSkipCodeCheckVal.IsSet()
? srcSkipCodeCheckVal.IsOn()
: this->GetGeneratorTarget()->GetPropertyAsBool("SKIP_LINTING");
if (skipCodeCheck) {
return {};
}
std::string compilerLauncher;
std::string staticCheckRule = this->GenerateCodeCheckRules(
srcFile, compilerLauncher, "", Config, nullptr);
LogMessage(cmStrCat("CodeCheck: ", staticCheckRule));
return staticCheckRule;
}

View File

@@ -1091,8 +1091,12 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
compilerLauncher = GetCompilerLauncher(lang, config);
}
cmValue const skipCodeCheck = source.GetProperty("SKIP_LINTING");
if (!skipCodeCheck.IsOn()) {
cmValue const srcSkipCodeCheckVal = source.GetProperty("SKIP_LINTING");
bool const skipCodeCheck = srcSkipCodeCheckVal.IsSet()
? srcSkipCodeCheckVal.IsOn()
: this->GetGeneratorTarget()->GetPropertyAsBool("SKIP_LINTING");
if (!skipCodeCheck) {
std::string const codeCheck = this->GenerateCodeCheckRules(
source, compilerLauncher, "$(CMAKE_COMMAND)", config, nullptr);
if (!codeCheck.empty()) {

View File

@@ -1423,8 +1423,12 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
auto compilerLauncher = this->GetCompilerLauncher(language, config);
cmValue const skipCodeCheck = source->GetProperty("SKIP_LINTING");
if (!skipCodeCheck.IsOn()) {
cmValue const srcSkipCodeCheckVal = source->GetProperty("SKIP_LINTING");
bool const skipCodeCheck = srcSkipCodeCheckVal.IsSet()
? srcSkipCodeCheckVal.IsOn()
: this->GetGeneratorTarget()->GetPropertyAsBool("SKIP_LINTING");
if (!skipCodeCheck) {
auto const cmakeCmd = this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
vars["CODE_CHECK"] =

View File

@@ -465,6 +465,7 @@ TargetProperty const StaticTargetProperties[] = {
{ "Fortran_LINKER_LAUNCHER"_s, IC::CanCompileSources },
// Static analysis
{ "SKIP_LINTING"_s, IC::CanCompileSources },
// -- C
{ "C_CLANG_TIDY"_s, IC::CanCompileSources },
{ "C_CLANG_TIDY_EXPORT_FIXES_DIR"_s, IC::CanCompileSources },
@@ -1805,6 +1806,7 @@ void cmTarget::CopyImportedCxxModulesProperties(cmTarget const* tgt)
"CXX_CPPCHECK",
"CXX_ICSTAT",
"CXX_INCLUDE_WHAT_YOU_USE",
"SKIP_LINTING",
// Build graph properties
"EXCLUDE_FROM_ALL",