Port cmExportBuildFileGenerator to cmGeneratorTarget.
This commit is contained in:
parent
570938cbfd
commit
57ab0f70b5
@ -36,10 +36,11 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
|
|||||||
tei = targets.begin();
|
tei = targets.begin();
|
||||||
tei != targets.end(); ++tei)
|
tei != targets.end(); ++tei)
|
||||||
{
|
{
|
||||||
cmTarget *te = this->Makefile->FindTargetToUse(*tei);
|
cmGeneratorTarget *te = this->Makefile
|
||||||
expectedTargets += sep + this->Namespace + te->GetExportName();
|
->FindGeneratorTargetToUse(*tei);
|
||||||
|
expectedTargets += sep + this->Namespace + te->Target->GetExportName();
|
||||||
sep = " ";
|
sep = " ";
|
||||||
if(this->ExportedTargets.insert(te).second)
|
if(this->ExportedTargets.insert(te->Target).second)
|
||||||
{
|
{
|
||||||
this->Exports.push_back(te);
|
this->Exports.push_back(te);
|
||||||
}
|
}
|
||||||
@ -63,11 +64,11 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
|
|||||||
std::vector<std::string> missingTargets;
|
std::vector<std::string> missingTargets;
|
||||||
|
|
||||||
// Create all the imported targets.
|
// Create all the imported targets.
|
||||||
for(std::vector<cmTarget*>::const_iterator
|
for(std::vector<cmGeneratorTarget*>::const_iterator
|
||||||
tei = this->Exports.begin();
|
tei = this->Exports.begin();
|
||||||
tei != this->Exports.end(); ++tei)
|
tei != this->Exports.end(); ++tei)
|
||||||
{
|
{
|
||||||
cmTarget* te = *tei;
|
cmTarget* te = (*tei)->Target;
|
||||||
this->GenerateImportTargetCode(os, te);
|
this->GenerateImportTargetCode(os, te);
|
||||||
|
|
||||||
te->AppendBuildInterfaceIncludes();
|
te->AppendBuildInterfaceIncludes();
|
||||||
@ -129,12 +130,12 @@ cmExportBuildFileGenerator
|
|||||||
std::string const& suffix,
|
std::string const& suffix,
|
||||||
std::vector<std::string> &missingTargets)
|
std::vector<std::string> &missingTargets)
|
||||||
{
|
{
|
||||||
for(std::vector<cmTarget*>::const_iterator
|
for(std::vector<cmGeneratorTarget*>::const_iterator
|
||||||
tei = this->Exports.begin();
|
tei = this->Exports.begin();
|
||||||
tei != this->Exports.end(); ++tei)
|
tei != this->Exports.end(); ++tei)
|
||||||
{
|
{
|
||||||
// Collect import properties for this target.
|
// Collect import properties for this target.
|
||||||
cmTarget* target = *tei;
|
cmGeneratorTarget* target = *tei;
|
||||||
ImportPropertyMap properties;
|
ImportPropertyMap properties;
|
||||||
|
|
||||||
if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
|
if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
|
||||||
@ -147,10 +148,12 @@ cmExportBuildFileGenerator
|
|||||||
if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
|
if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
|
||||||
{
|
{
|
||||||
this->SetImportDetailProperties(config, suffix,
|
this->SetImportDetailProperties(config, suffix,
|
||||||
target, properties, missingTargets);
|
target->Target,
|
||||||
|
properties, missingTargets);
|
||||||
this->SetImportLinkInterface(config, suffix,
|
this->SetImportLinkInterface(config, suffix,
|
||||||
cmGeneratorExpression::BuildInterface,
|
cmGeneratorExpression::BuildInterface,
|
||||||
target, properties, missingTargets);
|
target->Target,
|
||||||
|
properties, missingTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TOOD: PUBLIC_HEADER_LOCATION
|
// TOOD: PUBLIC_HEADER_LOCATION
|
||||||
@ -160,7 +163,8 @@ cmExportBuildFileGenerator
|
|||||||
// properties);
|
// properties);
|
||||||
|
|
||||||
// Generate code in the export file.
|
// Generate code in the export file.
|
||||||
this->GenerateImportPropertyCode(os, config, target, properties);
|
this->GenerateImportPropertyCode(os, config, target->Target,
|
||||||
|
properties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,26 +180,24 @@ void
|
|||||||
cmExportBuildFileGenerator
|
cmExportBuildFileGenerator
|
||||||
::SetImportLocationProperty(const std::string& config,
|
::SetImportLocationProperty(const std::string& config,
|
||||||
std::string const& suffix,
|
std::string const& suffix,
|
||||||
cmTarget* target, ImportPropertyMap& properties)
|
cmGeneratorTarget* target,
|
||||||
|
ImportPropertyMap& properties)
|
||||||
{
|
{
|
||||||
// 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;
|
||||||
|
|
||||||
cmGeneratorTarget* gtgt =
|
|
||||||
mf->GetGlobalGenerator()->GetGeneratorTarget(target);
|
|
||||||
|
|
||||||
// Add the main target file.
|
// Add the main target file.
|
||||||
{
|
{
|
||||||
std::string prop = "IMPORTED_LOCATION";
|
std::string prop = "IMPORTED_LOCATION";
|
||||||
prop += suffix;
|
prop += suffix;
|
||||||
std::string value;
|
std::string value;
|
||||||
if(target->IsAppBundleOnApple())
|
if(target->Target->IsAppBundleOnApple())
|
||||||
{
|
{
|
||||||
value = gtgt->GetFullPath(config, false);
|
value = target->GetFullPath(config, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value = gtgt->GetFullPath(config, false, true);
|
value = target->GetFullPath(config, false, true);
|
||||||
}
|
}
|
||||||
properties[prop] = value;
|
properties[prop] = value;
|
||||||
}
|
}
|
||||||
@ -207,13 +209,13 @@ cmExportBuildFileGenerator
|
|||||||
// Add the import library for windows DLLs.
|
// Add the import library for windows DLLs.
|
||||||
if(dll_platform &&
|
if(dll_platform &&
|
||||||
(target->GetType() == cmTarget::SHARED_LIBRARY ||
|
(target->GetType() == cmTarget::SHARED_LIBRARY ||
|
||||||
target->IsExecutableWithExports()) &&
|
target->Target->IsExecutableWithExports()) &&
|
||||||
mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"))
|
mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"))
|
||||||
{
|
{
|
||||||
std::string prop = "IMPORTED_IMPLIB";
|
std::string prop = "IMPORTED_IMPLIB";
|
||||||
prop += suffix;
|
prop += suffix;
|
||||||
std::string value = gtgt->GetFullPath(config, true);
|
std::string value = target->GetFullPath(config, true);
|
||||||
target->GetImplibGNUtoMS(value, value,
|
target->Target->GetImplibGNUtoMS(value, value,
|
||||||
"${CMAKE_IMPORT_LIBRARY_SUFFIX}");
|
"${CMAKE_IMPORT_LIBRARY_SUFFIX}");
|
||||||
properties[prop] = value;
|
properties[prop] = value;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ protected:
|
|||||||
/** Fill in properties indicating built file locations. */
|
/** Fill in properties indicating built file locations. */
|
||||||
void SetImportLocationProperty(const std::string& config,
|
void SetImportLocationProperty(const std::string& config,
|
||||||
std::string const& suffix,
|
std::string const& suffix,
|
||||||
cmTarget* target,
|
cmGeneratorTarget* target,
|
||||||
ImportPropertyMap& properties);
|
ImportPropertyMap& properties);
|
||||||
|
|
||||||
std::string InstallNameDir(cmTarget* target, const std::string& config);
|
std::string InstallNameDir(cmTarget* target, const std::string& config);
|
||||||
@ -78,7 +78,7 @@ protected:
|
|||||||
|
|
||||||
std::vector<std::string> Targets;
|
std::vector<std::string> Targets;
|
||||||
cmExportSet *ExportSet;
|
cmExportSet *ExportSet;
|
||||||
std::vector<cmTarget*> Exports;
|
std::vector<cmGeneratorTarget*> Exports;
|
||||||
cmMakefile* Makefile;
|
cmMakefile* Makefile;
|
||||||
cmListFileBacktrace Backtrace;
|
cmListFileBacktrace Backtrace;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user