Port some of the cmExportFileGenerator API to cmGeneratorTarget.

Enough to make it more possible to move GetLinkInterface
to cmGeneratorTarget.
This commit is contained in:
Stephen Kelly 2012-10-06 17:51:07 +02:00
parent 57ab0f70b5
commit 57f03e59ba
4 changed files with 32 additions and 23 deletions

View File

@ -148,11 +148,11 @@ cmExportBuildFileGenerator
if (target->GetType() != cmTarget::INTERFACE_LIBRARY) if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
{ {
this->SetImportDetailProperties(config, suffix, this->SetImportDetailProperties(config, suffix,
target->Target, target,
properties, missingTargets); properties, missingTargets);
this->SetImportLinkInterface(config, suffix, this->SetImportLinkInterface(config, suffix,
cmGeneratorExpression::BuildInterface, cmGeneratorExpression::BuildInterface,
target->Target, target,
properties, missingTargets); properties, missingTargets);
} }

View File

@ -791,12 +791,13 @@ void
cmExportFileGenerator cmExportFileGenerator
::SetImportLinkInterface(const std::string& config, std::string const& suffix, ::SetImportLinkInterface(const std::string& config, std::string const& suffix,
cmGeneratorExpression::PreprocessContext preprocessRule, cmGeneratorExpression::PreprocessContext preprocessRule,
cmTarget* target, ImportPropertyMap& properties, cmGeneratorTarget* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets) std::vector<std::string>& missingTargets)
{ {
// Add the transitive link dependencies for this configuration. // Add the transitive link dependencies for this configuration.
cmTarget::LinkInterface const* iface = target->GetLinkInterface(config, cmTarget::LinkInterface const* iface = target->Target->GetLinkInterface(
target); config,
target->Target);
if (!iface) if (!iface)
{ {
return; return;
@ -829,12 +830,14 @@ cmExportFileGenerator
} }
const bool newCMP0022Behavior = const bool newCMP0022Behavior =
target->GetPolicyStatusCMP0022() != cmPolicies::WARN target->Target
&& target->GetPolicyStatusCMP0022() != cmPolicies::OLD; ->GetPolicyStatusCMP0022() != cmPolicies::WARN
&& target->Target
->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if(newCMP0022Behavior && !this->ExportOld) if(newCMP0022Behavior && !this->ExportOld)
{ {
cmMakefile *mf = target->GetMakefile(); cmMakefile *mf = target->Target->GetMakefile();
std::ostringstream e; std::ostringstream e;
e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, " e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, "
"but also has old-style LINK_INTERFACE_LIBRARIES properties " "but also has old-style LINK_INTERFACE_LIBRARIES properties "
@ -854,7 +857,7 @@ cmExportFileGenerator
preprocessRule); preprocessRule);
if (!prepro.empty()) if (!prepro.empty())
{ {
this->ResolveTargetsInGeneratorExpressions(prepro, target, this->ResolveTargetsInGeneratorExpressions(prepro, target->Target,
missingTargets, missingTargets,
ReplaceFreeTargets); ReplaceFreeTargets);
properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro; properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro;
@ -866,12 +869,13 @@ void
cmExportFileGenerator cmExportFileGenerator
::SetImportDetailProperties(const std::string& config, ::SetImportDetailProperties(const std::string& config,
std::string const& suffix, std::string const& suffix,
cmTarget* target, ImportPropertyMap& properties, cmGeneratorTarget* target,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets std::vector<std::string>& missingTargets
) )
{ {
// Get the makefile in which to lookup target information. // Get the makefile in which to lookup target information.
cmMakefile* mf = target->GetMakefile(); cmMakefile* mf = target->Makefile;
// Add the soname for unix shared libraries. // Add the soname for unix shared libraries.
if(target->GetType() == cmTarget::SHARED_LIBRARY || if(target->GetType() == cmTarget::SHARED_LIBRARY ||
@ -884,14 +888,14 @@ cmExportFileGenerator
{ {
std::string prop; std::string prop;
std::string value; std::string value;
if(target->HasSOName(config)) if(target->Target->HasSOName(config))
{ {
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{ {
value = this->InstallNameDir(target, config); value = this->InstallNameDir(target->Target, config);
} }
prop = "IMPORTED_SONAME"; prop = "IMPORTED_SONAME";
value += target->GetSOName(config); value += target->Target->GetSOName(config);
} }
else else
{ {
@ -904,8 +908,9 @@ cmExportFileGenerator
} }
// Add the transitive link dependencies for this configuration. // Add the transitive link dependencies for this configuration.
if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(config, if(cmTarget::LinkInterface const* iface =
target)) target->Target
->GetLinkInterface(config, target->Target))
{ {
this->SetImportLinkProperty(suffix, target, this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_INTERFACE_LANGUAGES", "IMPORTED_LINK_INTERFACE_LANGUAGES",
@ -931,7 +936,7 @@ template <typename T>
void void
cmExportFileGenerator cmExportFileGenerator
::SetImportLinkProperty(std::string const& suffix, ::SetImportLinkProperty(std::string const& suffix,
cmTarget* target, cmGeneratorTarget* target,
const std::string& propName, const std::string& propName,
std::vector<T> const& entries, std::vector<T> const& entries,
ImportPropertyMap& properties, ImportPropertyMap& properties,
@ -955,7 +960,7 @@ cmExportFileGenerator
sep = ";"; sep = ";";
std::string temp = *li; std::string temp = *li;
this->AddTargetNamespace(temp, target, missingTargets); this->AddTargetNamespace(temp, target->Target, missingTargets);
link_entries += temp; link_entries += temp;
} }

View File

@ -92,13 +92,15 @@ protected:
// Collect properties with detailed information about targets beyond // Collect properties with detailed information about targets beyond
// their location on disk. // their location on disk.
void SetImportDetailProperties(const std::string& config, void SetImportDetailProperties(const std::string& config,
std::string const& suffix, cmTarget* target, std::string const& suffix,
cmGeneratorTarget* target,
ImportPropertyMap& properties, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets); std::vector<std::string>& missingTargets);
template <typename T> template <typename T>
void SetImportLinkProperty(std::string const& suffix, void SetImportLinkProperty(std::string const& suffix,
cmTarget* target, const std::string& propName, cmGeneratorTarget* target,
const std::string& propName,
std::vector<T> const& entries, std::vector<T> const& entries,
ImportPropertyMap& properties, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets); std::vector<std::string>& missingTargets);
@ -148,7 +150,7 @@ protected:
void SetImportLinkInterface(const std::string& config, void SetImportLinkInterface(const std::string& config,
std::string const& suffix, std::string const& suffix,
cmGeneratorExpression::PreprocessContext preprocessRule, cmGeneratorExpression::PreprocessContext preprocessRule,
cmTarget* target, ImportPropertyMap& properties, cmGeneratorTarget* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets); std::vector<std::string>& missingTargets);
enum FreeTargetsReplace { enum FreeTargetsReplace {

View File

@ -358,12 +358,14 @@ cmExportInstallFileGenerator
if(!properties.empty()) if(!properties.empty())
{ {
// Get the rest of the target details. // Get the rest of the target details.
cmGeneratorTarget *gtgt = te->Target->GetMakefile()->GetLocalGenerator()
->GetGlobalGenerator()->GetGeneratorTarget(te->Target);
this->SetImportDetailProperties(config, suffix, this->SetImportDetailProperties(config, suffix,
te->Target, properties, missingTargets); gtgt, properties, missingTargets);
this->SetImportLinkInterface(config, suffix, this->SetImportLinkInterface(config, suffix,
cmGeneratorExpression::InstallInterface, cmGeneratorExpression::InstallInterface,
te->Target, properties, missingTargets); gtgt, properties, missingTargets);
// TOOD: PUBLIC_HEADER_LOCATION // TOOD: PUBLIC_HEADER_LOCATION
// This should wait until the build feature propagation stuff // This should wait until the build feature propagation stuff