diff options
author | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2018-08-24 13:43:35 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-08-27 19:48:57 (GMT) |
commit | 50fbfee3a02e7099a3909d81597f4b8047847ece (patch) | |
tree | c8f6053448e3428b1d9f32c0c1141c41cd1d9f59 | |
parent | e33c6c357b61ed0cc5b9f7c01e4ea04deca26b39 (diff) | |
download | CMake-50fbfee3a02e7099a3909d81597f4b8047847ece.zip CMake-50fbfee3a02e7099a3909d81597f4b8047847ece.tar.gz CMake-50fbfee3a02e7099a3909d81597f4b8047847ece.tar.bz2 |
cmLocalGenerator: return directories as const std::string&
-rw-r--r-- | Source/cmExtraCodeLiteGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 5 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefileExecutableTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 7 |
11 files changed, 21 insertions, 22 deletions
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 582a2e7..fe5c7bb 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -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 + "/"; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 1548374..39f0c9e 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -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; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 8ba38df..d643f05 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -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 { diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index a5709d5..5ea323a 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -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; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 042ce41..5909ccc 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -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("")); } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 5e6ce1a..dd0f7d6 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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( diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 52f0396..e7b3ee6 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -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. diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index b35b116..73f4a8e 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -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()); } } diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index b9845ba..08bb2ce 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -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( diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 571e74b..6a3ffe5 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -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 diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 56d7243..a6396a5 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -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); |