1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

cmGlobalXCodeGenerator: Simplify relative path conversion under project root

This commit is contained in:
Brad King
2021-05-12 15:42:14 -04:00
parent 169d998bb8
commit f69079577a
2 changed files with 5 additions and 12 deletions

View File

@@ -586,13 +586,7 @@ void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root)
{ {
this->CurrentProject = root->GetProjectName(); this->CurrentProject = root->GetProjectName();
this->SetCurrentLocalGenerator(root); this->SetCurrentLocalGenerator(root);
cmSystemTools::SplitPath( this->CurrentRootGenerator = root;
this->CurrentLocalGenerator->GetCurrentSourceDirectory(),
this->ProjectSourceDirectoryComponents);
cmSystemTools::SplitPath(
this->CurrentLocalGenerator->GetCurrentBinaryDirectory(),
this->ProjectOutputDirectoryComponents);
this->CurrentXCodeHackMakefile = this->CurrentXCodeHackMakefile =
cmStrCat(root->GetCurrentBinaryDirectory(), "/CMakeScripts"); cmStrCat(root->GetCurrentBinaryDirectory(), "/CMakeScripts");
cmSystemTools::MakeDirectory(this->CurrentXCodeHackMakefile); cmSystemTools::MakeDirectory(this->CurrentXCodeHackMakefile);
@@ -4704,13 +4698,13 @@ std::string cmGlobalXCodeGenerator::RelativeToSource(const std::string& p)
// We force conversion because Xcode breakpoints do not work unless // We force conversion because Xcode breakpoints do not work unless
// they are in a file named relative to the source tree. // they are in a file named relative to the source tree.
return cmSystemTools::ForceToRelativePath( return cmSystemTools::ForceToRelativePath(
cmSystemTools::JoinPath(this->ProjectSourceDirectoryComponents), p); this->CurrentRootGenerator->GetCurrentSourceDirectory(), p);
} }
std::string cmGlobalXCodeGenerator::RelativeToBinary(const std::string& p) std::string cmGlobalXCodeGenerator::RelativeToBinary(const std::string& p)
{ {
return this->CurrentLocalGenerator->MaybeConvertToRelativePath( return this->CurrentRootGenerator->MaybeConvertToRelativePath(
cmSystemTools::JoinPath(this->ProjectOutputDirectoryComponents), p); this->CurrentRootGenerator->GetCurrentBinaryDirectory(), p);
} }
std::string cmGlobalXCodeGenerator::XCodeEscapePath(const std::string& p) std::string cmGlobalXCodeGenerator::XCodeEscapePath(const std::string& p)

View File

@@ -348,13 +348,12 @@ private:
cmXCodeObject* FrameworkGroup; cmXCodeObject* FrameworkGroup;
cmMakefile* CurrentMakefile; cmMakefile* CurrentMakefile;
cmLocalGenerator* CurrentLocalGenerator; cmLocalGenerator* CurrentLocalGenerator;
cmLocalGenerator* CurrentRootGenerator = nullptr;
std::vector<std::string> CurrentConfigurationTypes; std::vector<std::string> CurrentConfigurationTypes;
std::string CurrentReRunCMakeMakefile; std::string CurrentReRunCMakeMakefile;
std::string CurrentXCodeHackMakefile; std::string CurrentXCodeHackMakefile;
std::string CurrentProject; std::string CurrentProject;
std::set<std::string> TargetDoneSet; std::set<std::string> TargetDoneSet;
std::vector<std::string> ProjectSourceDirectoryComponents;
std::vector<std::string> ProjectOutputDirectoryComponents;
std::map<std::string, cmXCodeObject*> GroupMap; std::map<std::string, cmXCodeObject*> GroupMap;
std::map<std::string, cmXCodeObject*> GroupNameMap; std::map<std::string, cmXCodeObject*> GroupNameMap;
std::map<std::string, cmXCodeObject*> TargetGroup; std::map<std::string, cmXCodeObject*> TargetGroup;