From 08be47cf939c3adfe653809c46c7b23b7a912a39 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 27 Aug 2016 13:44:56 +0200 Subject: [PATCH] Convert: Replace UNCHANGED conversions with new API call --- Source/cmLocalUnixMakefileGenerator3.cxx | 4 +-- Source/cmLocalVisualStudio7Generator.cxx | 18 +++++----- .../cmMakefileExecutableTargetGenerator.cxx | 30 +++++++--------- Source/cmMakefileLibraryTargetGenerator.cxx | 36 ++++++++----------- Source/cmMakefileTargetGenerator.cxx | 9 +++-- Source/cmVisualStudio10TargetGenerator.cxx | 5 ++- 6 files changed, 43 insertions(+), 59 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 756db2e0d..33b010261 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1076,8 +1076,8 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand( fout << "file(REMOVE_RECURSE\n"; for (std::vector::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"; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 497defb7c..1beaa87ac 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -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::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; } diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index a14df7949..66e1ca2a2 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -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 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) { diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index c8ee05fbc..c31c469be 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -367,46 +367,40 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // Clean files associated with this library. std::vector 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 diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index dd4333d18..2d53669b1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -172,8 +172,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() const std::vector& outputs = ccg.GetOutputs(); for (std::vector::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 depends; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 1b1d04b18..216de03d9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -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 ||