Export: Port internal utility to cmGeneratorTarget.

This commit is contained in:
Stephen Kelly 2015-10-17 15:05:46 +02:00
parent 2b9cc1e248
commit e666128243
7 changed files with 28 additions and 27 deletions

View File

@ -237,14 +237,15 @@ void
cmExportBuildFileGenerator::HandleMissingTarget(
std::string& link_libs,
std::vector<std::string>& missingTargets,
cmTarget* depender,
cmTarget* dependee)
cmGeneratorTarget* depender,
cmGeneratorTarget* dependee)
{
// The target is not in the export.
if(!this->AppendMode)
{
const std::string name = dependee->GetName();
cmGlobalGenerator* gg = dependee->GetMakefile()->GetGlobalGenerator();
cmGlobalGenerator* gg =
dependee->GetLocalGenerator()->GetGlobalGenerator();
std::vector<std::string> namespaces = this->FindNamespaces(gg, name);
int targetOccurrences = (int)namespaces.size();
@ -252,7 +253,7 @@ cmExportBuildFileGenerator::HandleMissingTarget(
{
std::string missingTarget = namespaces[0];
missingTarget += dependee->GetExportName();
missingTarget += dependee->Target->GetExportName();
link_libs += missingTarget;
missingTargets.push_back(missingTarget);
return;
@ -267,7 +268,7 @@ cmExportBuildFileGenerator::HandleMissingTarget(
// Assume the target will be exported by another command.
// Append it with the export namespace.
link_libs += this->Namespace;
link_libs += dependee->GetExportName();
link_libs += dependee->Target->GetExportName();
}
//----------------------------------------------------------------------------
@ -315,8 +316,8 @@ cmExportBuildFileGenerator
//----------------------------------------------------------------------------
void
cmExportBuildFileGenerator
::ComplainAboutMissingTarget(cmTarget* depender,
cmTarget* dependee,
::ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
int occurrences)
{
if(cmSystemTools::GetErrorOccuredFlag())

View File

@ -54,11 +54,11 @@ protected:
std::vector<std::string> &missingTargets);
virtual void HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets,
cmTarget* depender,
cmTarget* dependee);
cmGeneratorTarget* depender,
cmGeneratorTarget* dependee);
void ComplainAboutMissingTarget(cmTarget* depender,
cmTarget* dependee,
void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
int occurrences);
/** Fill in properties indicating built file locations. */

View File

@ -661,7 +661,7 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input,
{
std::string namespacedTarget;
this->HandleMissingTarget(namespacedTarget, missingTargets,
target->Target, tgt->Target);
target, tgt);
if (!namespacedTarget.empty())
{
input = namespacedTarget;

View File

@ -119,8 +119,8 @@ protected:
* export set. */
virtual void HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets,
cmTarget* depender,
cmTarget* dependee) = 0;
cmGeneratorTarget* depender,
cmGeneratorTarget* dependee) = 0;
void PopulateInterfaceProperty(const std::string&,
cmGeneratorTarget *target,
cmGeneratorExpression::PreprocessContext,

View File

@ -453,19 +453,19 @@ cmExportInstallFileGenerator
//----------------------------------------------------------------------------
void
cmExportInstallFileGenerator::HandleMissingTarget(
std::string& link_libs, std::vector<std::string>& missingTargets,
cmTarget* depender, cmTarget* dependee)
cmExportInstallFileGenerator::HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets,
cmGeneratorTarget* depender, cmGeneratorTarget* dependee)
{
const std::string name = dependee->GetName();
cmGlobalGenerator* gg = dependee->GetMakefile()->GetGlobalGenerator();
cmGlobalGenerator* gg = dependee->GetLocalGenerator()->GetGlobalGenerator();
std::vector<std::string> namespaces = this->FindNamespaces(gg, name);
int targetOccurrences = (int)namespaces.size();
if (targetOccurrences == 1)
{
std::string missingTarget = namespaces[0];
missingTarget += dependee->GetExportName();
missingTarget += dependee->Target->GetExportName();
link_libs += missingTarget;
missingTargets.push_back(missingTarget);
}
@ -520,8 +520,8 @@ cmExportInstallFileGenerator
//----------------------------------------------------------------------------
void
cmExportInstallFileGenerator
::ComplainAboutMissingTarget(cmTarget* depender,
cmTarget* dependee,
::ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
int occurrences)
{
std::ostringstream e;

View File

@ -57,13 +57,13 @@ protected:
std::vector<std::string> &missingTargets);
virtual void HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets,
cmTarget* depender,
cmTarget* dependee);
cmGeneratorTarget* depender,
cmGeneratorTarget* dependee);
virtual void ReplaceInstallPrefix(std::string &input);
void ComplainAboutMissingTarget(cmTarget* depender,
cmTarget* dependee,
void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
int occurrences);
std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg,

View File

@ -37,8 +37,8 @@ protected:
std::vector<std::string>&) {}
virtual void HandleMissingTarget(std::string&,
std::vector<std::string>&,
cmTarget*,
cmTarget*) {}
cmGeneratorTarget*,
cmGeneratorTarget*) {}
void PopulateProperties(cmGeneratorTarget const* target,
ImportPropertyMap& properties,