diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-05-04 21:08:19 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-05-16 06:12:01 (GMT) |
commit | 991f5e4968ce7b86aea12224b4cecc1be3ed92d9 (patch) | |
tree | ed86360fdaa42be85834ef9da62fdf23c3e15c7e /Source | |
parent | 57bdc1a2f7d416c106c4bef8f3543eec74c3c391 (diff) | |
download | CMake-991f5e4968ce7b86aea12224b4cecc1be3ed92d9.zip CMake-991f5e4968ce7b86aea12224b4cecc1be3ed92d9.tar.gz CMake-991f5e4968ce7b86aea12224b4cecc1be3ed92d9.tar.bz2 |
cmState::Snapshot: Store components for current directories.
Remove this responsibility from cmLocalGenerator.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 38 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmState.cxx | 26 | ||||
-rw-r--r-- | Source/cmState.h | 6 |
4 files changed, 38 insertions, 36 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a26a90f..4e4970d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -67,7 +67,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Configured = false; this->EmitUniversalBinaryFlags = true; this->RelativePathsConfigured = false; - this->PathConversionsSetup = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -196,22 +195,6 @@ void cmLocalGenerator::ReadInputFile() this->Makefile->ProcessBuildsystemFile(currentStart.c_str()); } -void cmLocalGenerator::SetupPathConversions() -{ - // Setup the current output directory components for use by - // Convert - std::string outdir; - - outdir = cmSystemTools::CollapseFullPath( - this->StateSnapshot.GetCurrentSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath - (this->StateSnapshot.GetCurrentBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->StartOutputDirectoryComponents); -} - void cmLocalGenerator::ConfigureFinalPass() { this->Makefile->ConfigureFinalPass(); @@ -2698,13 +2681,6 @@ std::string cmLocalGenerator::Convert(const std::string& source, OutputFormat output, bool optional) { - // Make sure the relative path conversion components are set. - if(!this->PathConversionsSetup) - { - this->SetupPathConversions(); - this->PathConversionsSetup = true; - } - // Convert the path to a relative path. std::string result = source; @@ -2719,20 +2695,18 @@ std::string cmLocalGenerator::Convert(const std::string& source, break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->StartDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); break; case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath( - this->GetState()->GetBinaryDirectoryComponents(), result); + result = this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath(this->StartOutputDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); break; case FULL: result = cmSystemTools::CollapseFullPath(result); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index f08c973..e4d4444 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -443,7 +443,6 @@ protected: void ConfigureRelativePaths(); std::string FindRelativePathTopSource(); std::string FindRelativePathTopBinary(); - void SetupPathConversions(); virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -458,8 +457,6 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; - std::vector<std::string> StartDirectoryComponents; - std::vector<std::string> StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector<cmLocalGenerator*> Children; std::map<std::string, std::string> UniqueObjectNamesMap; @@ -484,7 +481,6 @@ protected: std::string RelativePathTopSource; std::string RelativePathTopBinary; bool RelativePathsConfigured; - bool PathConversionsSetup; cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index aa690dc..27a36bc 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -197,6 +197,8 @@ void cmState::Initialize() this->Locations.clear(); this->OutputLocations.clear(); this->ParentPositions.clear(); + this->CurrentSourceDirectoryComponents.clear(); + this->CurrentBinaryDirectoryComponents.clear(); this->CreateSnapshot(Snapshot()); this->DefineProperty @@ -500,6 +502,10 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->ParentPositions.push_back(originSnapshot.Position); this->Locations.resize(this->Locations.size() + 1); this->OutputLocations.resize(this->OutputLocations.size() + 1); + this->CurrentSourceDirectoryComponents.resize( + this->CurrentSourceDirectoryComponents.size() + 1); + this->CurrentBinaryDirectoryComponents.resize( + this->CurrentBinaryDirectoryComponents.size() + 1); return cmState::Snapshot(this, pos); } @@ -523,6 +529,10 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) this->State->Locations[this->Position]); this->State->Locations[this->Position] = cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]); + + cmSystemTools::SplitPath( + this->State->Locations[this->Position], + this->State->CurrentSourceDirectoryComponents[this->Position]); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -539,6 +549,22 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) this->State->OutputLocations[this->Position] = cmSystemTools::CollapseFullPath( this->State->OutputLocations[this->Position]); + + cmSystemTools::SplitPath( + this->State->OutputLocations[this->Position], + this->State->CurrentBinaryDirectoryComponents[this->Position]); +} + +std::vector<std::string> const& +cmState::Snapshot::GetCurrentSourceDirectoryComponents() +{ + return this->State->CurrentSourceDirectoryComponents[this->Position]; +} + +std::vector<std::string> const& +cmState::Snapshot::GetCurrentBinaryDirectoryComponents() +{ + return this->State->CurrentBinaryDirectoryComponents[this->Position]; } bool cmState::Snapshot::IsValid() const diff --git a/Source/cmState.h b/Source/cmState.h index 956b4f4..faf0739 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -36,6 +36,9 @@ public: const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); + std::vector<std::string> const& GetCurrentSourceDirectoryComponents(); + std::vector<std::string> const& GetCurrentBinaryDirectoryComponents(); + bool IsValid() const; Snapshot GetParent() const; @@ -136,6 +139,9 @@ private: std::vector<std::string> OutputLocations; std::vector<PositionType> ParentPositions; + std::vector<std::vector<std::string> > CurrentSourceDirectoryComponents; + std::vector<std::vector<std::string> > CurrentBinaryDirectoryComponents; + std::vector<std::string> SourceDirectoryComponents; std::vector<std::string> BinaryDirectoryComponents; std::string SourceDirectory; |