Convert: Replace UNCHANGED conversions with new API call

This commit is contained in:
Stephen Kelly 2016-08-27 13:44:56 +02:00
parent 564d3a1dc8
commit 08be47cf93
6 changed files with 43 additions and 59 deletions

View File

@ -1076,8 +1076,8 @@ 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->Convert(*f, cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED);
std::string fc =
this->ConvertToRelativePath(*f, cmOutputConverter::START_OUTPUT);
fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n";
}
fout << ")\n";

View File

@ -788,8 +788,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
target->GetProperty("Fortran_MODULE_DIRECTORY");
std::string modDir;
if (target_mod_dir) {
modDir = this->Convert(target_mod_dir, cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED);
modDir = this->ConvertToRelativePath(target_mod_dir,
cmOutputConverter::START_OUTPUT);
} else {
modDir = ".";
}
@ -1300,9 +1300,8 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries(
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) {
if (l->IsPath) {
std::string rel =
lg->Convert(l->Value.c_str(), cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED);
std::string rel = lg->ConvertToRelativePath(
l->Value.c_str(), cmOutputConverter::START_OUTPUT);
fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " ";
} else if (!l->Target ||
l->Target->GetType() != cmState::INTERFACE_LIBRARY) {
@ -1322,8 +1321,8 @@ void cmLocalVisualStudio7GeneratorInternals::OutputObjects(
const char* sep = isep ? isep : "";
for (std::vector<std::string>::const_iterator oi = objs.begin();
oi != objs.end(); ++oi) {
std::string rel = lg->Convert(oi->c_str(), cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED);
std::string rel =
lg->ConvertToRelativePath(oi->c_str(), cmOutputConverter::START_OUTPUT);
fout << sep << lg->ConvertToXMLOutputPath(rel.c_str());
sep = " ";
}
@ -1346,9 +1345,8 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(
// Switch to a relative path specification if it is shorter.
if (cmSystemTools::FileIsFullPath(dir.c_str())) {
std::string rel =
this->Convert(dir.c_str(), cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED);
std::string rel = this->ConvertToRelativePath(
dir.c_str(), cmOutputConverter::START_OUTPUT);
if (rel.size() < dir.size()) {
dir = rel;
}

View File

@ -218,40 +218,34 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Construct a list of files associated with this executable that
// may need to be cleaned.
std::vector<std::string> exeCleanFiles;
exeCleanFiles.push_back(this->Convert(targetFullPath,
cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED));
exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
targetFullPath, cmOutputConverter::START_OUTPUT));
#ifdef _WIN32
// There may be a manifest file for this target. Add it to the
// clean set just in case.
exeCleanFiles.push_back(this->Convert((targetFullPath + ".manifest").c_str(),
cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED));
exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
(targetFullPath + ".manifest").c_str(), cmOutputConverter::START_OUTPUT));
#endif
if (targetNameReal != targetName) {
exeCleanFiles.push_back(this->Convert(targetFullPathReal,
cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED));
exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
targetFullPathReal, cmOutputConverter::START_OUTPUT));
}
if (!targetNameImport.empty()) {
exeCleanFiles.push_back(this->Convert(targetFullPathImport,
cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED));
exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
targetFullPathImport, cmOutputConverter::START_OUTPUT));
std::string implib;
if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport,
implib)) {
exeCleanFiles.push_back(this->Convert(implib,
cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED));
exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
implib, cmOutputConverter::START_OUTPUT));
}
}
// List the PDB for cleaning only when the whole target is
// cleaned. We do not want to delete the .pdb file just before
// linking the target.
this->CleanFiles.push_back(this->Convert(targetFullPathPDB,
cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED));
this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
targetFullPathPDB, cmOutputConverter::START_OUTPUT));
// Add the pre-build and pre-link rules building but not when relinking.
if (!relink) {

View File

@ -367,46 +367,40 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Clean files associated with this library.
std::vector<std::string> libCleanFiles;
libCleanFiles.push_back(this->Convert(targetFullPath,
cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED));
libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
targetFullPath, cmOutputConverter::START_OUTPUT));
if (targetNameReal != targetName) {
libCleanFiles.push_back(this->Convert(targetFullPathReal,
cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED));
libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
targetFullPathReal, cmOutputConverter::START_OUTPUT));
}
if (targetNameSO != targetName && targetNameSO != targetNameReal) {
libCleanFiles.push_back(this->Convert(targetFullPathSO,
cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED));
libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
targetFullPathSO, cmOutputConverter::START_OUTPUT));
}
if (!targetNameImport.empty()) {
libCleanFiles.push_back(this->Convert(targetFullPathImport,
cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED));
libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
targetFullPathImport, cmOutputConverter::START_OUTPUT));
std::string implib;
if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport,
implib)) {
libCleanFiles.push_back(this->Convert(implib,
cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED));
libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
implib, cmOutputConverter::START_OUTPUT));
}
}
// List the PDB for cleaning only when the whole target is
// cleaned. We do not want to delete the .pdb file just before
// linking the target.
this->CleanFiles.push_back(this->Convert(targetFullPathPDB,
cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED));
this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
targetFullPathPDB, cmOutputConverter::START_OUTPUT));
#ifdef _WIN32
// There may be a manifest file for this target. Add it to the
// clean set just in case.
if (this->GeneratorTarget->GetType() != cmState::STATIC_LIBRARY) {
libCleanFiles.push_back(this->Convert(
(targetFullPath + ".manifest").c_str(), cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED));
libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
(targetFullPath + ".manifest").c_str(),
cmOutputConverter::START_OUTPUT));
}
#endif

View File

@ -172,8 +172,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->Convert(
*o, cmOutputConverter::START_OUTPUT, cmOutputConverter::UNCHANGED));
this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
*o, cmOutputConverter::START_OUTPUT));
}
}
}
@ -1258,9 +1258,8 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
this->LocalGenerator->GetRelativeTargetDirectory(this->GeneratorTarget);
std::string buildTargetRuleName = dir;
buildTargetRuleName += relink ? "/preinstall" : "/build";
buildTargetRuleName =
this->Convert(buildTargetRuleName, cmOutputConverter::HOME_OUTPUT,
cmOutputConverter::UNCHANGED);
buildTargetRuleName = this->LocalGenerator->ConvertToRelativePath(
buildTargetRuleName, cmOutputConverter::HOME_OUTPUT);
// Build the list of target outputs to drive.
std::vector<std::string> depends;

View File

@ -2416,9 +2416,8 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
ItemVector libs = cli.GetItems();
for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) {
if (l->IsPath) {
std::string path = this->LocalGenerator->Convert(
l->Value.c_str(), cmOutputConverter::START_OUTPUT,
cmOutputConverter::UNCHANGED);
std::string path = this->LocalGenerator->ConvertToRelativePath(
l->Value.c_str(), cmOutputConverter::START_OUTPUT);
this->ConvertToWindowsSlash(path);
libVec.push_back(path);
} else if (!l->Target ||