diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-10-17 13:31:33 +0200 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-18 16:29:29 +0200 |
commit | 381e7afd363d64c72b83e69fd6c6cad5fc3eefb4 (patch) | |
tree | 4622b0de4d39a55ec71ca7562f18783137da3087 /Source | |
parent | 65911cae4dd5a81f23a59bf9187b95bda3168fe9 (diff) | |
download | cmake-381e7afd363d64c72b83e69fd6c6cad5fc3eefb4.tar.gz |
cmExportSet: Store a cmGeneratorTarget.
Set the member at compute time from the stored name.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmExportBuildFileGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/cmExportInstallFileGenerator.cxx | 22 | ||||
-rw-r--r-- | Source/cmExportSet.cxx | 10 | ||||
-rw-r--r-- | Source/cmExportSet.h | 3 | ||||
-rw-r--r-- | Source/cmInstallCommand.cxx | 9 | ||||
-rw-r--r-- | Source/cmInstallExportGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmTargetExport.h | 5 |
8 files changed, 41 insertions, 27 deletions
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 72b101f2b5..30a8bf230e 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -27,6 +27,10 @@ cmExportBuildFileGenerator::cmExportBuildFileGenerator() void cmExportBuildFileGenerator::Compute(cmLocalGenerator* lg) { this->LG = lg; + if (this->ExportSet) + { + this->ExportSet->Compute(lg); + } } //---------------------------------------------------------------------------- @@ -274,7 +278,7 @@ void cmExportBuildFileGenerator tei = this->ExportSet->GetTargetExports()->begin(); tei != this->ExportSet->GetTargetExports()->end(); ++tei) { - targets.push_back((*tei)->GetName()); + targets.push_back((*tei)->TargetName); } return; } diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 61276269aa..4e8bc868c2 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -398,11 +398,11 @@ void cmExportFileGenerator::PopulateSourcesInterface( ImportPropertyMap &properties, std::vector<std::string> &missingTargets) { - cmTarget *target = tei->Target; + cmGeneratorTarget* gt = tei->Target; assert(preprocessRule == cmGeneratorExpression::InstallInterface); const char *propName = "INTERFACE_SOURCES"; - const char *input = target->GetProperty(propName); + const char *input = gt->GetProperty(propName); if (!input) { @@ -420,11 +420,9 @@ void cmExportFileGenerator::PopulateSourcesInterface( true); if (!prepro.empty()) { - this->ResolveTargetsInGeneratorExpressions(prepro, target, + this->ResolveTargetsInGeneratorExpressions(prepro, gt->Target, missingTargets); - cmGeneratorTarget* gt = target->GetMakefile() - ->GetGlobalGenerator()->GetGeneratorTarget(target); if (!checkInterfaceDirs(prepro, gt, propName)) { return; @@ -440,9 +438,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( ImportPropertyMap &properties, std::vector<std::string> &missingTargets) { - cmGeneratorTarget *target = tei->Target->GetMakefile() - ->GetGlobalGenerator() - ->GetGeneratorTarget(tei->Target); + cmGeneratorTarget *target = tei->Target; assert(preprocessRule == cmGeneratorExpression::InstallInterface); const char *propName = "INTERFACE_INCLUDE_DIRECTORIES"; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 5a514420ee..d7ca6d5294 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -48,10 +48,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) tei = this->IEGen->GetExportSet()->GetTargetExports()->begin(); tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) { - expectedTargets += sep + this->Namespace + (*tei)->Target->GetExportName(); + expectedTargets += + sep + this->Namespace + (*tei)->Target->Target->GetExportName(); sep = " "; cmTargetExport * te = *tei; - if(this->ExportedTargets.insert(te->Target).second) + if(this->ExportedTargets.insert(te->Target->Target).second) { allTargets.push_back(te); } @@ -131,7 +132,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) tei = allTargets.begin(); tei != allTargets.end(); ++tei) { - cmTarget* te = (*tei)->Target; + cmGeneratorTarget* gt = (*tei)->Target; + cmTarget* te = gt->Target; requiresConfigFiles = requiresConfigFiles || te->GetType() != cmState::INTERFACE_LIBRARY; @@ -193,13 +195,10 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", te, properties); - cmGeneratorTarget *gtgt = te->GetMakefile() - ->GetGlobalGenerator() - ->GetGeneratorTarget(te); - this->PopulateCompatibleInterfaceProperties(gtgt, properties); + this->PopulateCompatibleInterfaceProperties(gt, properties); - this->GenerateInterfaceProperties(te, os, properties); + this->GenerateInterfaceProperties(gt->Target, os, properties); } if (require3_1_0) @@ -362,8 +361,7 @@ cmExportInstallFileGenerator if(!properties.empty()) { // Get the rest of the target details. - cmGeneratorTarget *gtgt = te->Target->GetMakefile() - ->GetGlobalGenerator()->GetGeneratorTarget(te->Target); + cmGeneratorTarget *gtgt = te->Target; this->SetImportDetailProperties(config, suffix, gtgt, properties, missingTargets); @@ -378,8 +376,8 @@ cmExportInstallFileGenerator // properties); // Generate code in the export file. - this->GenerateImportPropertyCode(os, config, te->Target, properties); - this->GenerateImportedFileChecksCode(os, te->Target, properties, + this->GenerateImportPropertyCode(os, config, gtgt->Target, properties); + this->GenerateImportedFileChecksCode(os, gtgt->Target, properties, importedLocations); } } diff --git a/Source/cmExportSet.cxx b/Source/cmExportSet.cxx index 4148fb50b0..0059b64007 100644 --- a/Source/cmExportSet.cxx +++ b/Source/cmExportSet.cxx @@ -13,12 +13,22 @@ #include "cmExportSet.h" #include "cmTargetExport.h" #include "cmAlgorithms.h" +#include "cmLocalGenerator.h" cmExportSet::~cmExportSet() { cmDeleteAll(this->TargetExports); } +void cmExportSet::Compute(cmLocalGenerator* lg) +{ + for (std::vector<cmTargetExport*>::iterator it = this->TargetExports.begin(); + it != this->TargetExports.end(); ++it) + { + (*it)->Target = lg->FindGeneratorTargetToUse((*it)->TargetName); + } +} + void cmExportSet::AddTargetExport(cmTargetExport* te) { this->TargetExports.push_back(te); diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h index a57aa12044..d780a228c1 100644 --- a/Source/cmExportSet.h +++ b/Source/cmExportSet.h @@ -15,6 +15,7 @@ #include "cmSystemTools.h" class cmTargetExport; class cmInstallExportGenerator; +class cmLocalGenerator; /// A set of targets that were installed with the same EXPORT parameter. class cmExportSet @@ -25,6 +26,8 @@ public: /// Destructor ~cmExportSet(); + void Compute(cmLocalGenerator* lg); + void AddTargetExport(cmTargetExport* tgt); void AddInstallation(cmInstallExportGenerator const* installation); diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index c22edf3365..6b06fce2a6 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -773,7 +773,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) if(!exports.GetString().empty() && !namelinkOnly) { cmTargetExport *te = new cmTargetExport; - te->Target = ⌖ + te->TargetName = target.GetName(); te->ArchiveGenerator = archiveGenerator; te->BundleGenerator = bundleGenerator; te->FrameworkGenerator = frameworkGenerator; @@ -1379,16 +1379,17 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) tei != exportSet->GetTargetExports()->end(); ++tei) { cmTargetExport const* te = *tei; + cmTarget* tgt = this->Makefile->FindTarget(te->TargetName); const bool newCMP0022Behavior = - te->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN - && te->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD; + tgt->GetPolicyStatusCMP0022() != cmPolicies::WARN + && tgt->GetPolicyStatusCMP0022() != cmPolicies::OLD; if(!newCMP0022Behavior) { std::ostringstream e; e << "INSTALL(EXPORT) given keyword \"" << "EXPORT_LINK_INTERFACE_LIBRARIES" << "\", but target \"" - << te->Target->GetName() + << te->TargetName << "\" does not have policy CMP0022 set to NEW."; this->SetError(e.str()); return false; diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index f7c9cc28c8..9570ba3d8e 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -56,6 +56,7 @@ cmInstallExportGenerator::~cmInstallExportGenerator() void cmInstallExportGenerator::Compute(cmLocalGenerator* lg) { this->LocalGenerator = lg; + this->ExportSet->Compute(lg); } //---------------------------------------------------------------------------- diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h index 76658887d4..2781337fe7 100644 --- a/Source/cmTargetExport.h +++ b/Source/cmTargetExport.h @@ -14,7 +14,7 @@ #include "cmStandardIncludes.h" -class cmTarget; +class cmGeneratorTarget; class cmInstallTargetGenerator; class cmInstallFilesGenerator; @@ -25,7 +25,8 @@ class cmInstallFilesGenerator; class cmTargetExport { public: - cmTarget* Target; ///< The target + std::string TargetName; + cmGeneratorTarget* Target; ///@name Generators ///@{ |