summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmDependsFortran.cxx16
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx16
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmLocalGenerator.cxx8
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx10
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx14
-rw-r--r--Source/cmMakefileTargetGenerator.cxx11
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx4
8 files changed, 42 insertions, 41 deletions
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index eed31fa..44592bb 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -189,6 +189,8 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
cmGeneratedFileStream fcStream(fcName.c_str());
fcStream << "# Remove fortran modules provided by this target.\n";
fcStream << "FILE(REMOVE";
+ std::string currentBinDir =
+ this->LocalGenerator->GetCurrentBinaryDirectory();
for (std::set<std::string>::const_iterator i = provides.begin();
i != provides.end(); ++i) {
std::string mod_upper = mod_dir;
@@ -205,18 +207,16 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
stamp += ".mod.stamp";
fcStream << "\n";
fcStream << " \""
- << this->LocalGenerator->ConvertToRelativePath(
- this->LocalGenerator->GetCurrentBinaryDirectory(),
- mod_lower)
+ << this->LocalGenerator->ConvertToRelativePath(currentBinDir,
+ mod_lower)
<< "\"\n";
fcStream << " \""
- << this->LocalGenerator->ConvertToRelativePath(
- this->LocalGenerator->GetCurrentBinaryDirectory(),
- mod_upper)
+ << this->LocalGenerator->ConvertToRelativePath(currentBinDir,
+ mod_upper)
<< "\"\n";
fcStream << " \""
- << this->LocalGenerator->ConvertToRelativePath(
- this->LocalGenerator->GetCurrentBinaryDirectory(), stamp)
+ << this->LocalGenerator->ConvertToRelativePath(currentBinDir,
+ stamp)
<< "\"\n";
}
fcStream << " )\n";
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 9443b0a..caf71fd 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -319,18 +319,15 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
std::string cache = this->GetCMakeInstance()->GetHomeOutputDirectory();
cache += "/CMakeCache.txt";
+ std::string currentBinDir = lg->GetCurrentBinaryDirectory();
// Save the list to the cmake file.
cmakefileStream
<< "# The top level Makefile was generated from the following files:\n"
<< "set(CMAKE_MAKEFILE_DEPENDS\n"
- << " \""
- << lg->ConvertToRelativePath(lg->GetCurrentBinaryDirectory(), cache)
- << "\"\n";
+ << " \"" << lg->ConvertToRelativePath(currentBinDir, cache) << "\"\n";
for (std::vector<std::string>::const_iterator i = lfiles.begin();
i != lfiles.end(); ++i) {
- cmakefileStream << " \""
- << lg->ConvertToRelativePath(
- lg->GetCurrentBinaryDirectory(), *i)
+ cmakefileStream << " \"" << lg->ConvertToRelativePath(currentBinDir, *i)
<< "\"\n";
}
cmakefileStream << " )\n\n";
@@ -344,12 +341,9 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
cmakefileStream << "# The corresponding makefile is:\n"
<< "set(CMAKE_MAKEFILE_OUTPUTS\n"
<< " \""
- << lg->ConvertToRelativePath(lg->GetCurrentBinaryDirectory(),
- makefileName)
+ << lg->ConvertToRelativePath(currentBinDir, makefileName)
<< "\"\n"
- << " \""
- << lg->ConvertToRelativePath(lg->GetCurrentBinaryDirectory(),
- check)
+ << " \"" << lg->ConvertToRelativePath(currentBinDir, check)
<< "\"\n";
cmakefileStream << " )\n\n";
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index ed41e60..7664b02 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -382,6 +382,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
{
VisualStudioFolders.clear();
+ std::string rootBinaryDir = root->GetCurrentBinaryDirectory();
for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin();
tt != projectTargets.end(); ++tt) {
cmGeneratorTarget const* target = *tt;
@@ -405,8 +406,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
if (vcprojName) {
cmLocalGenerator* lg = target->GetLocalGenerator();
std::string dir = lg->GetCurrentBinaryDirectory();
- dir = root->ConvertToRelativePath(root->GetCurrentBinaryDirectory(),
- dir.c_str());
+ dir = root->ConvertToRelativePath(rootBinaryDir, dir.c_str());
if (dir == ".") {
dir = ""; // msbuild cannot handle ".\" prefix
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index d909011..6d3ce1c 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -177,11 +177,11 @@ void cmLocalGenerator::GenerateTestFiles()
}
typedef std::vector<cmState::Snapshot> vec_t;
vec_t const& children = this->Makefile->GetStateSnapshot().GetChildren();
+ std::string parentBinDir = this->GetCurrentBinaryDirectory();
for (vec_t::const_iterator i = children.begin(); i != children.end(); ++i) {
// TODO: Use add_subdirectory instead?
std::string outP = i->GetDirectory().GetCurrentBinary();
- outP =
- this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), outP);
+ outP = this->ConvertToRelativePath(parentBinDir, outP);
outP = cmOutputConverter::EscapeForCMake(outP);
fout << "subdirs(" << outP << ")" << std::endl;
}
@@ -2243,11 +2243,11 @@ std::string cmLocalGenerator::ConstructComment(
std::string comment;
comment = "Generating ";
const char* sep = "";
+ std::string currentBinaryDir = this->GetCurrentBinaryDirectory();
for (std::vector<std::string>::const_iterator o = ccg.GetOutputs().begin();
o != ccg.GetOutputs().end(); ++o) {
comment += sep;
- comment +=
- this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), *o);
+ comment += this->ConvertToRelativePath(currentBinaryDir, *o);
sep = ", ";
}
return comment;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 2b22f49..9d3567e 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -952,6 +952,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// Add each command line to the set of commands.
std::vector<std::string> commands1;
+ std::string currentBinDir = this->GetCurrentBinaryDirectory();
for (unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c) {
// Build the command line in a single string.
std::string cmd = ccg.GetCommand(c);
@@ -976,8 +977,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// working directory will be the start-output directory.
bool had_slash = cmd.find('/') != cmd.npos;
if (workingDir.empty()) {
- cmd =
- this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), cmd);
+ cmd = this->ConvertToRelativePath(currentBinDir, cmd);
}
bool has_slash = cmd.find('/') != cmd.npos;
if (had_slash && !has_slash) {
@@ -1069,7 +1069,8 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
std::vector<std::string>& commands, const std::vector<std::string>& files,
cmGeneratorTarget* target, const char* filename)
{
- std::string cleanfile = this->GetCurrentBinaryDirectory();
+ std::string currentBinDir = this->GetCurrentBinaryDirectory();
+ std::string cleanfile = currentBinDir;
cleanfile += "/";
cleanfile += this->GetTargetDirectory(target);
cleanfile += "/cmake_clean";
@@ -1087,8 +1088,7 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
fout << "file(REMOVE_RECURSE\n";
for (std::vector<std::string>::const_iterator f = files.begin();
f != files.end(); ++f) {
- std::string fc =
- this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), *f);
+ std::string fc = this->ConvertToRelativePath(currentBinDir, *f);
fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n";
}
fout << ")\n";
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 459203a..f477a0e 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1298,10 +1298,11 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries(
std::ostream& fout, ItemVector const& libs)
{
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
+ std::string currentBinDir = lg->GetCurrentBinaryDirectory();
for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) {
if (l->IsPath) {
- std::string rel = lg->ConvertToRelativePath(
- lg->GetCurrentBinaryDirectory(), l->Value.c_str());
+ std::string rel =
+ lg->ConvertToRelativePath(currentBinDir, l->Value.c_str());
fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " ";
} else if (!l->Target ||
l->Target->GetType() != cmState::INTERFACE_LIBRARY) {
@@ -1316,13 +1317,13 @@ void cmLocalVisualStudio7GeneratorInternals::OutputObjects(
// VS < 8 does not support per-config source locations so we
// list object library content on the link line instead.
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
+ std::string currentBinDir = lg->GetCurrentBinaryDirectory();
std::vector<std::string> objs;
gt->UseObjectLibraries(objs, "");
const char* sep = isep ? isep : "";
for (std::vector<std::string>::const_iterator oi = objs.begin();
oi != objs.end(); ++oi) {
- std::string rel =
- lg->ConvertToRelativePath(lg->GetCurrentBinaryDirectory(), oi->c_str());
+ std::string rel = lg->ConvertToRelativePath(currentBinDir, oi->c_str());
fout << sep << lg->ConvertToXMLOutputPath(rel.c_str());
sep = " ";
}
@@ -1332,6 +1333,7 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(
std::ostream& fout, std::vector<std::string> const& dirs)
{
const char* comma = "";
+ std::string currentBinDir = this->GetCurrentBinaryDirectory();
for (std::vector<std::string>::const_iterator d = dirs.begin();
d != dirs.end(); ++d) {
// Remove any trailing slash and skip empty paths.
@@ -1345,8 +1347,8 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(
// Switch to a relative path specification if it is shorter.
if (cmSystemTools::FileIsFullPath(dir.c_str())) {
- std::string rel = this->ConvertToRelativePath(
- this->GetCurrentBinaryDirectory(), dir.c_str());
+ std::string rel =
+ this->ConvertToRelativePath(currentBinDir, dir.c_str());
if (rel.size() < dir.size()) {
dir = rel;
}
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 215952a..df06dc1 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -162,6 +162,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
// files for this target.
std::vector<cmSourceFile const*> customCommands;
this->GeneratorTarget->GetCustomCommands(customCommands, config);
+ std::string currentBinDir =
+ this->LocalGenerator->GetCurrentBinaryDirectory();
for (std::vector<cmSourceFile const*>::const_iterator si =
customCommands.begin();
si != customCommands.end(); ++si) {
@@ -172,8 +174,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
const std::vector<std::string>& outputs = ccg.GetOutputs();
for (std::vector<std::string>::const_iterator o = outputs.begin();
o != outputs.end(); ++o) {
- this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
- this->LocalGenerator->GetCurrentBinaryDirectory(), *o));
+ this->CleanFiles.push_back(
+ this->LocalGenerator->ConvertToRelativePath(currentBinDir, *o));
}
}
}
@@ -1180,11 +1182,12 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
<< this->GeneratorTarget->GetName() << "\n"
<< variableNameExternal << " =";
/* clang-format on */
+ std::string currentBinDir =
+ this->LocalGenerator->GetCurrentBinaryDirectory();
for (std::vector<std::string>::const_iterator i =
this->ExternalObjects.begin();
i != this->ExternalObjects.end(); ++i) {
- object = this->LocalGenerator->ConvertToRelativePath(
- this->LocalGenerator->GetCurrentBinaryDirectory(), *i);
+ object = this->LocalGenerator->ConvertToRelativePath(currentBinDir, *i);
*this->BuildFileStream << " " << lineContinue << "\n"
<< this->Makefile->GetSafeDefinition(
"CMAKE_OBJECT_NAME");
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index a4065ca..85084eb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2415,10 +2415,12 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
{
typedef cmComputeLinkInformation::ItemVector ItemVector;
ItemVector libs = cli.GetItems();
+ std::string currentBinDir =
+ this->LocalGenerator->GetCurrentBinaryDirectory();
for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) {
if (l->IsPath) {
std::string path = this->LocalGenerator->ConvertToRelativePath(
- this->LocalGenerator->GetCurrentBinaryDirectory(), l->Value.c_str());
+ currentBinDir, l->Value.c_str());
this->ConvertToWindowsSlash(path);
libVec.push_back(path);
} else if (!l->Target ||