summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-01-20 13:04:13 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-07-02 14:40:03 (GMT)
commit1925cffa083bcbe3c54b8a0f2c63dc96f5168db0 (patch)
tree98415042edafb89d47f002719ed0fed0dad9c679
parent286f22770907fad3453eadf34e641ad736237292 (diff)
downloadCMake-1925cffa083bcbe3c54b8a0f2c63dc96f5168db0.zip
CMake-1925cffa083bcbe3c54b8a0f2c63dc96f5168db0.tar.gz
CMake-1925cffa083bcbe3c54b8a0f2c63dc96f5168db0.tar.bz2
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.
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.cxx2
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.h2
-rw-r--r--Source/cmTargetCompileOptionsCommand.cxx2
-rw-r--r--Source/cmTargetCompileOptionsCommand.h2
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.cxx23
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.h8
-rw-r--r--Source/cmTargetPropCommandBase.cxx28
-rw-r--r--Source/cmTargetPropCommandBase.h12
8 files changed, 58 insertions, 21 deletions
diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx
index ba0ad59..46c9666 100644
--- a/Source/cmTargetCompileDefinitionsCommand.cxx
+++ b/Source/cmTargetCompileDefinitionsCommand.cxx
@@ -60,7 +60,7 @@ std::string cmTargetCompileDefinitionsCommand
//----------------------------------------------------------------------------
void cmTargetCompileDefinitionsCommand
::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
- bool)
+ bool, bool)
{
tgt->AppendProperty("COMPILE_DEFINITIONS", this->Join(content).c_str());
}
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index 22d8fa8..bc58b31 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -82,7 +82,7 @@ private:
virtual void HandleDirectContent(cmTarget *tgt,
const std::vector<std::string> &content,
- bool prepend);
+ bool prepend, bool system);
virtual std::string Join(const std::vector<std::string> &content);
};
diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx
index e80c845..254acc7 100644
--- a/Source/cmTargetCompileOptionsCommand.cxx
+++ b/Source/cmTargetCompileOptionsCommand.cxx
@@ -53,7 +53,7 @@ std::string cmTargetCompileOptionsCommand
//----------------------------------------------------------------------------
void cmTargetCompileOptionsCommand
::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
- bool)
+ bool, bool)
{
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h
index 87fa1a7..b9afd71 100644
--- a/Source/cmTargetCompileOptionsCommand.h
+++ b/Source/cmTargetCompileOptionsCommand.h
@@ -83,7 +83,7 @@ private:
virtual void HandleDirectContent(cmTarget *tgt,
const std::vector<std::string> &content,
- bool prepend);
+ bool prepend, bool system);
virtual std::string Join(const std::vector<std::string> &content);
};
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index 12d0a51..ee91521 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -15,7 +15,8 @@
bool cmTargetIncludeDirectoriesCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
- return this->HandleArguments(args, "INCLUDE_DIRECTORIES", PROCESS_BEFORE);
+ return this->HandleArguments(args, "INCLUDE_DIRECTORIES",
+ ArgumentFlags(PROCESS_BEFORE | PROCESS_SYSTEM));
}
//----------------------------------------------------------------------------
@@ -65,10 +66,28 @@ std::string cmTargetIncludeDirectoriesCommand
//----------------------------------------------------------------------------
void cmTargetIncludeDirectoriesCommand
::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
- bool prepend)
+ bool prepend, bool system)
{
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
cmValueWithOrigin entry(this->Join(content), lfbt);
tgt->InsertInclude(entry, prepend);
+ if (system)
+ {
+ tgt->AddSystemIncludeDirectories(content);
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmTargetIncludeDirectoriesCommand
+::HandleInterfaceContent(cmTarget *tgt,
+ const std::vector<std::string> &content,
+ bool prepend, bool system)
+{
+ if (system)
+ {
+ // Error.
+ }
+ cmTargetPropCommandBase::HandleInterfaceContent(tgt, content,
+ prepend, system);
}
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index 4a1a4df..a84ddd0 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -54,7 +54,7 @@ public:
virtual const char* GetFullDocumentation() const
{
return
- " target_include_directories(<target> [BEFORE] "
+ " target_include_directories(<target> [SYSTEM] [BEFORE] "
"<INTERFACE|PUBLIC|PRIVATE> [items1...]\n"
" [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])\n"
"Specify include directories or targets to use when compiling a given "
@@ -87,7 +87,11 @@ private:
virtual void HandleDirectContent(cmTarget *tgt,
const std::vector<std::string> &content,
- bool prepend);
+ bool prepend, bool system);
+ virtual void HandleInterfaceContent(cmTarget *tgt,
+ const std::vector<std::string> &content,
+ bool prepend, bool system);
+
virtual std::string Join(const std::vector<std::string> &content);
};
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index 64f40d6..287ce46 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -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)
{
diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h
index 9db7581..690582f 100644
--- a/Source/cmTargetPropCommandBase.h
+++ b/Source/cmTargetPropCommandBase.h
@@ -25,7 +25,8 @@ public:
enum ArgumentFlags {
NO_FLAGS = 0,
- PROCESS_BEFORE = 1
+ PROCESS_BEFORE = 1,
+ PROCESS_SYSTEM = 2
};
bool HandleArguments(std::vector<std::string> const& args,
@@ -38,21 +39,22 @@ protected:
virtual void HandleInterfaceContent(cmTarget *tgt,
const std::vector<std::string> &content,
- bool prepend);
+ bool prepend, bool system);
private:
virtual void HandleImportedTarget(const std::string &tgt) = 0;
virtual void HandleMissingTarget(const std::string &name) = 0;
virtual void HandleDirectContent(cmTarget *tgt,
const std::vector<std::string> &content,
- bool prepend) = 0;
+ bool prepend, bool system) = 0;
+
virtual std::string Join(const std::vector<std::string> &content) = 0;
bool ProcessContentArgs(std::vector<std::string> const& args,
- unsigned int &argIndex, bool prepend);
+ unsigned int &argIndex, bool prepend, bool system);
void PopulateTargetProperies(const std::string &scope,
const std::vector<std::string> &content,
- bool prepend);
+ bool prepend, bool system);
};
#endif