Commit 50fbfee3 authored by Vitaly Stakhovsky's avatar Vitaly Stakhovsky Committed by Brad King
Browse files

cmLocalGenerator: return directories as const std::string&

parent e33c6c35
......@@ -122,7 +122,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByTarget(
for (cmLocalGenerator* lg : lgs) {
for (cmGeneratorTarget* lt : lg->GetGeneratorTargets()) {
cmStateEnums::TargetType type = lt->GetType();
std::string outputDir = lg->GetCurrentBinaryDirectory();
std::string const& outputDir = lg->GetCurrentBinaryDirectory();
std::string targetName = lt->GetName();
std::string filename = outputDir + "/" + targetName + ".project";
retval.push_back(targetName);
......@@ -161,7 +161,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByProjectMaps(
// for each sub project in the workspace create a codelite project
for (auto const& it : this->GlobalGenerator->GetProjectMap()) {
std::string outputDir = it.second[0]->GetCurrentBinaryDirectory();
std::string const& outputDir = it.second[0]->GetCurrentBinaryDirectory();
std::string projectName = it.second[0]->GetProjectName();
retval.push_back(projectName);
std::string filename = outputDir + "/" + projectName + ".project";
......@@ -184,7 +184,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByProjectMaps(
void cmExtraCodeLiteGenerator::CreateProjectFile(
const std::vector<cmLocalGenerator*>& lgs)
{
std::string outputDir = lgs[0]->GetCurrentBinaryDirectory();
std::string const& outputDir = lgs[0]->GetCurrentBinaryDirectory();
std::string projectName = lgs[0]->GetProjectName();
std::string filename = outputDir + "/";
......
......@@ -3565,8 +3565,9 @@ bool cmGeneratorTarget::StrictTargetComparison::operator()(
{
int nameResult = strcmp(t1->GetName().c_str(), t2->GetName().c_str());
if (nameResult == 0) {
return strcmp(t1->GetLocalGenerator()->GetCurrentBinaryDirectory(),
t2->GetLocalGenerator()->GetCurrentBinaryDirectory()) < 0;
return strcmp(
t1->GetLocalGenerator()->GetCurrentBinaryDirectory().c_str(),
t2->GetLocalGenerator()->GetCurrentBinaryDirectory().c_str()) < 0;
}
return nameResult < 0;
}
......
......@@ -1011,8 +1011,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
std::set<std::string> const& utils = target->GetUtilities();
for (std::string const& util : utils) {
std::string d =
target->GetLocalGenerator()->GetCurrentBinaryDirectory() +
std::string("/") + util;
target->GetLocalGenerator()->GetCurrentBinaryDirectory() + "/" + util;
outputs.push_back(this->ConvertToNinjaPath(d));
}
} else {
......
......@@ -1014,7 +1014,7 @@ void cmGlobalVisualStudio10Generator::PathTooLong(cmGeneratorTarget* target,
std::string const& sfRel)
{
size_t len =
(strlen(target->GetLocalGenerator()->GetCurrentBinaryDirectory()) + 1 +
(target->GetLocalGenerator()->GetCurrentBinaryDirectory().length() + 1 +
sfRel.length());
if (len > this->LongestSource.Length) {
this->LongestSource.Length = len;
......
......@@ -3040,7 +3040,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
// Point Xcode at the top of the source tree.
{
std::string pdir =
this->RelativeToBinary(root->GetCurrentSourceDirectory());
this->RelativeToBinary(root->GetCurrentSourceDirectory().c_str());
this->RootObject->AddAttribute("projectDirPath", this->CreateString(pdir));
this->RootObject->AddAttribute("projectRoot", this->CreateString(""));
}
......
......@@ -2522,14 +2522,14 @@ std::string const& cmLocalGenerator::GetBinaryDirectory() const
return this->GetCMakeInstance()->GetHomeOutputDirectory();
}
const char* cmLocalGenerator::GetCurrentBinaryDirectory() const
std::string const& cmLocalGenerator::GetCurrentBinaryDirectory() const
{
return this->StateSnapshot.GetDirectory().GetCurrentBinary().c_str();
return this->StateSnapshot.GetDirectory().GetCurrentBinary();
}
const char* cmLocalGenerator::GetCurrentSourceDirectory() const
std::string const& cmLocalGenerator::GetCurrentSourceDirectory() const
{
return this->StateSnapshot.GetDirectory().GetCurrentSource().c_str();
return this->StateSnapshot.GetDirectory().GetCurrentSource();
}
std::string cmLocalGenerator::GetTargetDirectory(
......
......@@ -296,8 +296,8 @@ public:
std::string const& GetSourceDirectory() const;
std::string const& GetBinaryDirectory() const;
const char* GetCurrentBinaryDirectory() const;
const char* GetCurrentSourceDirectory() const;
std::string const& GetCurrentBinaryDirectory() const;
std::string const& GetCurrentSourceDirectory() const;
/**
* Generate a Mac OS X application bundle Info.plist file.
......
......@@ -118,7 +118,7 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles()
if (this->GetCurrentBinaryDirectory() != this->GetSourceDirectory()) {
if (!cmSystemTools::MakeDirectory(this->GetCurrentBinaryDirectory())) {
cmSystemTools::Error("Error creating directory ",
this->GetCurrentBinaryDirectory());
this->GetCurrentBinaryDirectory().c_str());
}
}
......
......@@ -456,7 +456,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// clean set just in case.
exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
(targetFullPath + ".manifest").c_str()));
targetFullPath + ".manifest"));
#endif
if (targetNameReal != targetName) {
exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
......
......@@ -635,7 +635,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) {
libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
(targetFullPath + ".manifest").c_str()));
targetFullPath + ".manifest"));
}
#endif
......
......@@ -250,7 +250,7 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
this->TargetCompileAsWinRT = false;
this->IsMissingFiles = false;
this->DefaultArtifactDir =
this->LocalGenerator->GetCurrentBinaryDirectory() + std::string("/") +
this->LocalGenerator->GetCurrentBinaryDirectory() + "/" +
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->InSourceBuild =
(strcmp(this->Makefile->GetCurrentSourceDirectory(),
......@@ -1877,7 +1877,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2,
std::string sourceRel = this->ConvertPath(sf->GetFullPath(), true);
size_t const maxLen = 250;
if (sf->GetCustomCommand() ||
((strlen(this->LocalGenerator->GetCurrentBinaryDirectory()) + 1 +
((this->LocalGenerator->GetCurrentBinaryDirectory().length() + 1 +
sourceRel.length()) <= maxLen)) {
forceRelative = true;
sourceFile = sourceRel;
......@@ -4131,8 +4131,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80(Elem& e1)
// this can cause an overwrite problem if projects aren't organized in
// folders
std::string manifestFile =
this->LocalGenerator->GetCurrentBinaryDirectory() +
std::string("/WMAppManifest.xml");
this->LocalGenerator->GetCurrentBinaryDirectory() + "/WMAppManifest.xml";
std::string artifactDir =
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
ConvertToWindowsSlash(artifactDir);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment