summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2016-10-04 20:56:31 (GMT)
committerStephen Kelly <steveire@gmail.com>2016-10-06 18:02:08 (GMT)
commit1ed5f6b39b80ab337551f1fa9601b3257ddd4be7 (patch)
tree1af60419ab2297157ab5b06ae85de09b9fcb74c5 /Source/cmMakefileTargetGenerator.cxx
parent8377d9e00b7a00f1687b947aaf3c9e10b6779df4 (diff)
downloadCMake-1ed5f6b39b80ab337551f1fa9601b3257ddd4be7.zip
CMake-1ed5f6b39b80ab337551f1fa9601b3257ddd4be7.tar.gz
CMake-1ed5f6b39b80ab337551f1fa9601b3257ddd4be7.tar.bz2
Makefiles: Introduce local RelativePath method
This makes it easier to remove directory-specific state from cmOutputConverter where it doesn't belong. Of course, this just relocates the problem to the makefiles generator for now, but that's better than affecting the core.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx42
1 files changed, 22 insertions, 20 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index e70f09e..a9b2f4e 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -166,7 +166,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
for (std::vector<std::string>::const_iterator o = outputs.begin();
o != outputs.end(); ++o) {
this->CleanFiles.push_back(
- this->LocalGenerator->ConvertToRelativePath(currentBinDir, *o));
+ this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, *o));
}
}
}
@@ -209,8 +209,8 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< this->GlobalGenerator->IncludeDirective << " " << root
<< cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
- ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
- dependFileNameFull)
+ ->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetBinaryDirectory(), dependFileNameFull)
.c_str())
<< "\n\n";
@@ -221,7 +221,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< this->GlobalGenerator->IncludeDirective << " " << root
<< cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
- ->ConvertToRelativePath(
+ ->MaybeConvertToRelativePath(
this->LocalGenerator->GetBinaryDirectory(),
this->ProgressFileNameFull)
.c_str())
@@ -256,8 +256,9 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< this->GlobalGenerator->IncludeDirective << " " << root
<< cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
- ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
- this->FlagFileNameFull)
+ ->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetBinaryDirectory(),
+ this->FlagFileNameFull)
.c_str())
<< "\n\n";
}
@@ -314,9 +315,9 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()(
output += "/";
output += cmSystemTools::GetFilenameName(input);
this->Generator->CleanFiles.push_back(
- this->Generator->LocalGenerator->ConvertToRelativePath(
+ this->Generator->LocalGenerator->MaybeConvertToRelativePath(
this->Generator->LocalGenerator->GetCurrentBinaryDirectory(), output));
- output = this->Generator->LocalGenerator->ConvertToRelativePath(
+ output = this->Generator->LocalGenerator->MaybeConvertToRelativePath(
this->Generator->LocalGenerator->GetBinaryDirectory(), output);
// Create a rule to copy the content into the bundle.
@@ -518,13 +519,13 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
}
targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
cmOutputConverter::SHELL);
targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat(
targetFullPathPDB, cmOutputConverter::SHELL);
targetOutPathCompilePDB = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
targetFullPathCompilePDB),
cmOutputConverter::SHELL);
@@ -550,13 +551,13 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
vars.Object = shellObj.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
objectDir = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir),
cmOutputConverter::SHELL);
vars.ObjectDir = objectDir.c_str();
std::string objectFileDir = cmSystemTools::GetFilenamePath(obj);
objectFileDir = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), objectFileDir),
cmOutputConverter::SHELL);
vars.ObjectFileDir = objectFileDir.c_str();
@@ -904,7 +905,7 @@ bool cmMakefileTargetGenerator::WriteMakeRule(
// Touch the extra output so "make" knows that it was updated,
// but only if the output was acually created.
std::string const out = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(binDir, *o),
+ this->LocalGenerator->MaybeConvertToRelativePath(binDir, *o),
cmOutputConverter::SHELL);
std::vector<std::string> output_commands;
@@ -1200,7 +1201,8 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
for (std::vector<std::string>::const_iterator i =
this->ExternalObjects.begin();
i != this->ExternalObjects.end(); ++i) {
- object = this->LocalGenerator->ConvertToRelativePath(currentBinDir, *i);
+ object =
+ this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, *i);
*this->BuildFileStream << " " << lineContinue << "\n"
<< this->Makefile->GetSafeDefinition(
"CMAKE_OBJECT_NAME");
@@ -1234,7 +1236,7 @@ public:
{
// Construct the name of the next object.
this->NextObject = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), obj),
cmOutputConverter::RESPONSE);
@@ -1289,7 +1291,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
this->LocalGenerator->GetRelativeTargetDirectory(this->GeneratorTarget);
std::string buildTargetRuleName = dir;
buildTargetRuleName += relink ? "/preinstall" : "/build";
- buildTargetRuleName = this->LocalGenerator->ConvertToRelativePath(
+ buildTargetRuleName = this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetBinaryDirectory(), buildTargetRuleName);
// Build the list of target outputs to drive.
@@ -1479,7 +1481,7 @@ void cmMakefileTargetGenerator::CreateLinkScript(
// Create the makefile command to invoke the link script.
std::string link_command = "$(CMAKE_COMMAND) -E cmake_link_script ";
link_command += this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), linkScriptName),
cmOutputConverter::SHELL);
link_command += " --verbose=$(VERBOSE)";
@@ -1716,14 +1718,14 @@ void cmMakefileTargetGenerator::GenDefFile(
cmd, cmOutputConverter::SHELL);
cmd += " -E __create_def ";
cmd += this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file),
cmOutputConverter::SHELL);
cmd += " ";
std::string objlist_file = name_of_def_file;
objlist_file += ".objs";
cmd += this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), objlist_file),
cmOutputConverter::SHELL);
real_link_commands.insert(real_link_commands.begin(), cmd);
@@ -1744,7 +1746,7 @@ void cmMakefileTargetGenerator::GenDefFile(
linkFlags += " ";
linkFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
linkFlags += this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->ConvertToRelativePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file),
cmOutputConverter::SHELL);
linkFlags += " ";