cmTargetPropCommandBase: Change the interface to return bool.

This is needed for the target_compile_features command, which
may fail at configure time if an invalid feature is specified.
This commit is contained in:
Stephen Kelly 2013-11-09 00:18:35 +01:00
parent 5412deded1
commit 4e6ca50445
10 changed files with 22 additions and 16 deletions

View File

@ -58,9 +58,10 @@ std::string cmTargetCompileDefinitionsCommand
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTargetCompileDefinitionsCommand bool cmTargetCompileDefinitionsCommand
::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content, ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
bool, bool) bool, bool)
{ {
tgt->AppendProperty("COMPILE_DEFINITIONS", this->Join(content).c_str()); tgt->AppendProperty("COMPILE_DEFINITIONS", this->Join(content).c_str());
return true;
} }

View File

@ -44,7 +44,7 @@ private:
virtual void HandleImportedTarget(const std::string &tgt); virtual void HandleImportedTarget(const std::string &tgt);
virtual void HandleMissingTarget(const std::string &name); virtual void HandleMissingTarget(const std::string &name);
virtual void HandleDirectContent(cmTarget *tgt, virtual bool HandleDirectContent(cmTarget *tgt,
const std::vector<std::string> &content, const std::vector<std::string> &content,
bool prepend, bool system); bool prepend, bool system);
virtual std::string Join(const std::vector<std::string> &content); virtual std::string Join(const std::vector<std::string> &content);

View File

@ -51,7 +51,7 @@ std::string cmTargetCompileOptionsCommand
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTargetCompileOptionsCommand bool cmTargetCompileOptionsCommand
::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content, ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
bool, bool) bool, bool)
{ {
@ -59,4 +59,5 @@ void cmTargetCompileOptionsCommand
this->Makefile->GetBacktrace(lfbt); this->Makefile->GetBacktrace(lfbt);
cmValueWithOrigin entry(this->Join(content), lfbt); cmValueWithOrigin entry(this->Join(content), lfbt);
tgt->InsertCompileOption(entry); tgt->InsertCompileOption(entry);
return true;
} }

View File

@ -44,7 +44,7 @@ private:
virtual void HandleImportedTarget(const std::string &tgt); virtual void HandleImportedTarget(const std::string &tgt);
virtual void HandleMissingTarget(const std::string &name); virtual void HandleMissingTarget(const std::string &name);
virtual void HandleDirectContent(cmTarget *tgt, virtual bool HandleDirectContent(cmTarget *tgt,
const std::vector<std::string> &content, const std::vector<std::string> &content,
bool prepend, bool system); bool prepend, bool system);
virtual std::string Join(const std::vector<std::string> &content); virtual std::string Join(const std::vector<std::string> &content);

View File

@ -66,7 +66,7 @@ std::string cmTargetIncludeDirectoriesCommand
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTargetIncludeDirectoriesCommand bool cmTargetIncludeDirectoriesCommand
::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content, ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
bool prepend, bool system) bool prepend, bool system)
{ {
@ -78,6 +78,7 @@ void cmTargetIncludeDirectoriesCommand
{ {
tgt->AddSystemIncludeDirectories(content); tgt->AddSystemIncludeDirectories(content);
} }
return true;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -45,7 +45,7 @@ private:
virtual void HandleImportedTarget(const std::string &tgt); virtual void HandleImportedTarget(const std::string &tgt);
virtual void HandleMissingTarget(const std::string &name); virtual void HandleMissingTarget(const std::string &name);
virtual void HandleDirectContent(cmTarget *tgt, virtual bool HandleDirectContent(cmTarget *tgt,
const std::vector<std::string> &content, const std::vector<std::string> &content,
bool prepend, bool system); bool prepend, bool system);
virtual void HandleInterfaceContent(cmTarget *tgt, virtual void HandleInterfaceContent(cmTarget *tgt,

View File

@ -132,29 +132,31 @@ bool cmTargetPropCommandBase
|| args[i] == "PRIVATE" || args[i] == "PRIVATE"
|| args[i] == "INTERFACE" ) || args[i] == "INTERFACE" )
{ {
this->PopulateTargetProperies(scope, content, prepend, system); return this->PopulateTargetProperies(scope, content, prepend, system);
return true;
} }
content.push_back(args[i]); content.push_back(args[i]);
} }
this->PopulateTargetProperies(scope, content, prepend, system); return this->PopulateTargetProperies(scope, content, prepend, system);
return true;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTargetPropCommandBase bool cmTargetPropCommandBase
::PopulateTargetProperies(const std::string &scope, ::PopulateTargetProperies(const std::string &scope,
const std::vector<std::string> &content, const std::vector<std::string> &content,
bool prepend, bool system) bool prepend, bool system)
{ {
if (scope == "PRIVATE" || scope == "PUBLIC") if (scope == "PRIVATE" || scope == "PUBLIC")
{ {
this->HandleDirectContent(this->Target, content, prepend, system); if (!this->HandleDirectContent(this->Target, content, prepend, system))
{
return false;
}
} }
if (scope == "INTERFACE" || scope == "PUBLIC") if (scope == "INTERFACE" || scope == "PUBLIC")
{ {
this->HandleInterfaceContent(this->Target, content, prepend, system); this->HandleInterfaceContent(this->Target, content, prepend, system);
} }
return true;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -44,7 +44,7 @@ private:
virtual void HandleImportedTarget(const std::string &tgt) = 0; virtual void HandleImportedTarget(const std::string &tgt) = 0;
virtual void HandleMissingTarget(const std::string &name) = 0; virtual void HandleMissingTarget(const std::string &name) = 0;
virtual void HandleDirectContent(cmTarget *tgt, virtual bool HandleDirectContent(cmTarget *tgt,
const std::vector<std::string> &content, const std::vector<std::string> &content,
bool prepend, bool system) = 0; bool prepend, bool system) = 0;
@ -52,7 +52,7 @@ private:
bool ProcessContentArgs(std::vector<std::string> const& args, bool ProcessContentArgs(std::vector<std::string> const& args,
unsigned int &argIndex, bool prepend, bool system); unsigned int &argIndex, bool prepend, bool system);
void PopulateTargetProperies(const std::string &scope, bool PopulateTargetProperies(const std::string &scope,
const std::vector<std::string> &content, const std::vector<std::string> &content,
bool prepend, bool system); bool prepend, bool system);
}; };

View File

@ -56,9 +56,10 @@ std::string cmTargetSourcesCommand
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTargetSourcesCommand bool cmTargetSourcesCommand
::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content, ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
bool, bool) bool, bool)
{ {
tgt->AppendProperty("SOURCES", this->Join(content).c_str()); tgt->AppendProperty("SOURCES", this->Join(content).c_str());
return true;
} }

View File

@ -45,7 +45,7 @@ private:
virtual void HandleImportedTarget(const std::string &tgt); virtual void HandleImportedTarget(const std::string &tgt);
virtual void HandleMissingTarget(const std::string &name); virtual void HandleMissingTarget(const std::string &name);
virtual void HandleDirectContent(cmTarget *tgt, virtual bool HandleDirectContent(cmTarget *tgt,
const std::vector<std::string> &content, const std::vector<std::string> &content,
bool prepend, bool system); bool prepend, bool system);