diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-10-17 13:08:13 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-18 14:29:30 (GMT) |
commit | eb3be7d68851ce87354f6bd90e0be3a670d22d56 (patch) | |
tree | dbee37acd61d0d9eabf4f391368abbcdc8995e9c /Source | |
parent | d231c31b98eb80929d9aabf8e606abde39fc08f4 (diff) | |
download | CMake-eb3be7d68851ce87354f6bd90e0be3a670d22d56.zip CMake-eb3be7d68851ce87354f6bd90e0be3a670d22d56.tar.gz CMake-eb3be7d68851ce87354f6bd90e0be3a670d22d56.tar.bz2 |
cmGeneratorTarget: Move GetExportName from cmTarget.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmExportBuildFileGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/cmExportInstallFileGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 20 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 2 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 20 | ||||
-rw-r--r-- | Source/cmTarget.h | 1 |
7 files changed, 32 insertions, 32 deletions
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index d191e47..781220d 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -48,7 +48,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) { cmGeneratorTarget *te = this->LG ->FindGeneratorTargetToUse(*tei); - expectedTargets += sep + this->Namespace + te->Target->GetExportName(); + expectedTargets += sep + this->Namespace + te->GetExportName(); sep = " "; if(this->ExportedTargets.insert(te).second) { @@ -253,7 +253,7 @@ cmExportBuildFileGenerator::HandleMissingTarget( { std::string missingTarget = namespaces[0]; - missingTarget += dependee->Target->GetExportName(); + missingTarget += dependee->GetExportName(); link_libs += missingTarget; missingTargets.push_back(missingTarget); return; @@ -268,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->Target->GetExportName(); + link_libs += dependee->GetExportName(); } //---------------------------------------------------------------------------- diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 1c3e9fe..3e58400 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -18,7 +18,6 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSystemTools.h" -#include "cmTarget.h" #include "cmTargetExport.h" #include "cmVersion.h" #include "cmComputeLinkInformation.h" @@ -623,7 +622,7 @@ void cmExportFileGenerator::GenerateInterfaceProperties( if (!properties.empty()) { std::string targetName = this->Namespace; - targetName += target->Target->GetExportName(); + targetName += target->GetExportName(); os << "set_target_properties(" << targetName << " PROPERTIES\n"; for(ImportPropertyMap::const_iterator pi = properties.begin(); pi != properties.end(); ++pi) @@ -655,7 +654,7 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input, } if(this->ExportedTargets.find(tgt) != this->ExportedTargets.end()) { - input = this->Namespace + tgt->Target->GetExportName(); + input = this->Namespace + tgt->GetExportName(); } else { @@ -1047,7 +1046,7 @@ cmExportFileGenerator // Construct the imported target name. std::string targetName = this->Namespace; - targetName += target->Target->GetExportName(); + targetName += target->GetExportName(); // Create the imported target. os << "# Create imported target " << targetName << "\n"; @@ -1114,7 +1113,7 @@ cmExportFileGenerator // Construct the imported target name. std::string targetName = this->Namespace; - targetName += target->Target->GetExportName(); + targetName += target->GetExportName(); // Set the import properties. os << "# Import target \"" << targetName << "\" for configuration \"" @@ -1234,7 +1233,7 @@ cmExportFileGenerator { // Construct the imported target name. std::string targetName = this->Namespace; - targetName += target->Target->GetExportName(); + targetName += target->GetExportName(); os << "list(APPEND _IMPORT_CHECK_TARGETS " << targetName << " )\n" "list(APPEND _IMPORT_CHECK_FILES_FOR_" << targetName << " "; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index ea5badc..d57d67f 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -49,7 +49,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) { expectedTargets += - sep + this->Namespace + (*tei)->Target->Target->GetExportName(); + sep + this->Namespace + (*tei)->Target->GetExportName(); sep = " "; cmTargetExport * te = *tei; if(this->ExportedTargets.insert(te->Target).second) @@ -465,7 +465,7 @@ cmExportInstallFileGenerator::HandleMissingTarget(std::string& link_libs, { std::string missingTarget = namespaces[0]; - missingTarget += dependee->Target->GetExportName(); + missingTarget += dependee->GetExportName(); link_libs += missingTarget; missingTargets.push_back(missingTarget); } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 5e26aad..03c950e 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -335,6 +335,26 @@ std::string cmGeneratorTarget::GetName() const } //---------------------------------------------------------------------------- +std::string cmGeneratorTarget::GetExportName() const +{ + const char *exportName = this->GetProperty("EXPORT_NAME"); + + if (exportName && *exportName) + { + if (!cmGeneratorExpression::IsValidTargetName(exportName)) + { + std::ostringstream e; + e << "EXPORT_NAME property \"" << exportName << "\" for \"" + << this->GetName() << "\": is not valid."; + cmSystemTools::Error(e.str().c_str()); + return ""; + } + return exportName; + } + return this->GetName(); +} + +//---------------------------------------------------------------------------- const char *cmGeneratorTarget::GetProperty(const std::string& prop) const { return this->Target->GetProperty(prop); diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index f5a894b..1029158 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -43,6 +43,8 @@ public: cmState::TargetType GetType() const; std::string GetName() const; + std::string GetExportName() const; + const char *GetProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void GetSourceFiles(std::vector<cmSourceFile*>& files, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1c4faab..57a2d24 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1412,26 +1412,6 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, } //---------------------------------------------------------------------------- -std::string cmTarget::GetExportName() const -{ - const char *exportName = this->GetProperty("EXPORT_NAME"); - - if (exportName && *exportName) - { - if (!cmGeneratorExpression::IsValidTargetName(exportName)) - { - std::ostringstream e; - e << "EXPORT_NAME property \"" << exportName << "\" for \"" - << this->GetName() << "\": is not valid."; - cmSystemTools::Error(e.str().c_str()); - return ""; - } - return exportName; - } - return this->GetName(); -} - -//---------------------------------------------------------------------------- void cmTarget::AppendBuildInterfaceIncludes() { if(this->GetType() != cmState::SHARED_LIBRARY && diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 443a2d0..dafe86a 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -96,7 +96,6 @@ public: ///! Set/Get the name of the target const std::string& GetName() const {return this->Name;} - std::string GetExportName() const; ///! Set the cmMakefile that owns this target void SetMakefile(cmMakefile *mf); |