Add SYSTEM target property

If it is ON, treat INTERFACE_INCLUDE_DIRECTORIES as system include directories.

Issue: #18040

Signed-off-by: Da Quexian <daquexian566@gmail.com>
This commit is contained in:
Da Quexian
2022-06-01 16:36:59 +08:00
parent 85dc7c763a
commit 69beee5314
7 changed files with 92 additions and 4 deletions
+8 -3
View File
@@ -807,11 +807,16 @@ void handleSystemIncludesDep(cmLocalGenerator* lg,
dagChecker, depTgt, language),
result);
}
if (!depTgt->IsImported() || excludeImported) {
if (!depTgt->GetPropertyAsBool("SYSTEM")) {
return;
}
if (depTgt->GetPropertyAsBool("IMPORTED_NO_SYSTEM")) {
return;
if (depTgt->IsImported()) {
if (excludeImported) {
return;
}
if (depTgt->GetPropertyAsBool("IMPORTED_NO_SYSTEM")) {
return;
}
}
if (cmValue dirs = depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")) {
+4
View File
@@ -759,6 +759,10 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
}
}
if (this->IsImported()) {
this->SetProperty("SYSTEM", "ON");
}
for (auto const& prop : mf->GetState()->GetPropertyDefinitions().GetMap()) {
if (prop.first.second == cmProperty::TARGET &&
!prop.second.GetInitializeFromVariable().empty()) {