Add a SYSTEM parameter to target_include_directories (#14180)

This is similar to the include_directories(SYSTEM) signature
in that it allows telling the compiler to ignore warnings from
such headers.
This commit is contained in:
Stephen Kelly
2013-01-20 14:04:13 +01:00
parent 286f227709
commit 1925cffa08
8 changed files with 58 additions and 21 deletions
+20 -8
View File
@@ -48,8 +48,20 @@ bool cmTargetPropCommandBase
return false;
}
bool system = false;
unsigned int argIndex = 1;
if ((flags & PROCESS_SYSTEM) && args[argIndex] == "SYSTEM")
{
if (args.size() < 4)
{
this->SetError("called with incorrect number of arguments");
return false;
}
system = true;
++argIndex;
}
bool prepend = false;
if ((flags & PROCESS_BEFORE) && args[argIndex] == "BEFORE")
{
@@ -66,7 +78,7 @@ bool cmTargetPropCommandBase
while (argIndex < args.size())
{
if (!this->ProcessContentArgs(args, argIndex, prepend))
if (!this->ProcessContentArgs(args, argIndex, prepend, system))
{
return false;
}
@@ -77,7 +89,7 @@ bool cmTargetPropCommandBase
//----------------------------------------------------------------------------
bool cmTargetPropCommandBase
::ProcessContentArgs(std::vector<std::string> const& args,
unsigned int &argIndex, bool prepend)
unsigned int &argIndex, bool prepend, bool system)
{
const std::string scope = args[argIndex];
@@ -105,12 +117,12 @@ bool cmTargetPropCommandBase
|| args[i] == "PRIVATE"
|| args[i] == "INTERFACE" )
{
this->PopulateTargetProperies(scope, content, prepend);
this->PopulateTargetProperies(scope, content, prepend, system);
return true;
}
content.push_back(args[i]);
}
this->PopulateTargetProperies(scope, content, prepend);
this->PopulateTargetProperies(scope, content, prepend, system);
return true;
}
@@ -118,22 +130,22 @@ bool cmTargetPropCommandBase
void cmTargetPropCommandBase
::PopulateTargetProperies(const std::string &scope,
const std::vector<std::string> &content,
bool prepend)
bool prepend, bool system)
{
if (scope == "PRIVATE" || scope == "PUBLIC")
{
this->HandleDirectContent(this->Target, content, prepend);
this->HandleDirectContent(this->Target, content, prepend, system);
}
if (scope == "INTERFACE" || scope == "PUBLIC")
{
this->HandleInterfaceContent(this->Target, content, prepend);
this->HandleInterfaceContent(this->Target, content, prepend, system);
}
}
//----------------------------------------------------------------------------
void cmTargetPropCommandBase::HandleInterfaceContent(cmTarget *tgt,
const std::vector<std::string> &content,
bool prepend)
bool prepend, bool)
{
if (prepend)
{