This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via 98220cb3c9dc8a01db12ecfb224ffbd45052fc7b (commit) via b5fa39ca3bdbcae327a04d4efb1cbe2477acc413 (commit) from 27d1525298d909d3272f287e479ec401d78cf29a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98220cb3c9dc8a01db12ecfb224ffbd45052fc7b commit 98220cb3c9dc8a01db12ecfb224ffbd45052fc7b Merge: 27d1525 b5fa39c Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Mon Sep 19 16:04:32 2016 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Mon Sep 19 16:04:32 2016 -0400 Merge topic 'cleanup-Convert' into next b5fa39ca Partial revert https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b5fa39ca3bdbcae327a04d4efb1cbe2477acc413 commit b5fa39ca3bdbcae327a04d4efb1cbe2477acc413 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Mon Sep 19 22:03:34 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Mon Sep 19 22:03:41 2016 +0200 Partial revert Avoid conflicting with other branch. diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index fdf0b0e..6167e2c 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -47,6 +47,13 @@ std::string const& cmCommonTargetGenerator::GetConfigName() const return this->ConfigName; } +std::string cmCommonTargetGenerator::Convert( + std::string const& source, cmOutputConverter::RelativeRoot relative, + cmOutputConverter::OutputFormat output) +{ + return this->LocalGenerator->Convert(source, relative, output); +} + const char* cmCommonTargetGenerator::GetFeature(const std::string& feature) { return this->GeneratorTarget->GetFeature(feature, this->ConfigName); @@ -197,9 +204,8 @@ std::string cmCommonTargetGenerator::GetManifests() std::vector<std::string> manifests; for (std::vector<cmSourceFile const*>::iterator mi = manifest_srcs.begin(); mi != manifest_srcs.end(); ++mi) { - manifests.push_back(this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetWorkingDirectory(), (*mi)->GetFullPath()), + manifests.push_back(this->Convert( + (*mi)->GetFullPath(), this->LocalGenerator->GetWorkingDirectory(), cmOutputConverter::SHELL)); } diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 4c52fe5..b433c18 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -57,6 +57,10 @@ protected: // The windows module definition source file (.def), if any. cmSourceFile const* ModuleDefinitionFile; + std::string Convert(std::string const& source, + cmOutputConverter::RelativeRoot relative, + cmOutputConverter::OutputFormat output); + void AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source); diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index ba0617f..d7e2c33 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -428,16 +428,14 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, std::string modFile = mod_dir; modFile += "/"; modFile += *i; - modFile = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath(binDir, modFile), - cmOutputConverter::SHELL); + modFile = this->LocalGenerator->Convert( + modFile, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::SHELL); std::string stampFile = stamp_dir; stampFile += "/"; stampFile += m; stampFile += ".mod.stamp"; - stampFile = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath(binDir, stampFile), - cmOutputConverter::SHELL); + stampFile = this->LocalGenerator->Convert( + stampFile, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::SHELL); makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod " << modFile << " " << stampFile; cmMakefile* mf = this->LocalGenerator->GetMakefile(); diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index 97323c9..0e79293 100644 --- a/Source/cmLocalCommonGenerator.cxx +++ b/Source/cmLocalCommonGenerator.cxx @@ -18,9 +18,8 @@ class cmGlobalGenerator; -cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg, - cmMakefile* mf, - std::string const& wd) +cmLocalCommonGenerator::cmLocalCommonGenerator( + cmGlobalGenerator* gg, cmMakefile* mf, cmOutputConverter::RelativeRoot wd) : cmLocalGenerator(gg, mf) , WorkingDirectory(wd) { @@ -56,9 +55,8 @@ std::string cmLocalCommonGenerator::GetTargetFortranFlags( // Add a module output directory flag if necessary. std::string mod_dir = target->GetFortranModuleDirectory(); if (!mod_dir.empty()) { - mod_dir = this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->WorkingDirectory, mod_dir), - cmOutputConverter::SHELL); + mod_dir = + this->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL); } else { mod_dir = this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index 9454739..9012afd 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -30,18 +30,21 @@ class cmLocalCommonGenerator : public cmLocalGenerator { public: cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf, - std::string const& wd); + cmOutputConverter::RelativeRoot wd); ~cmLocalCommonGenerator() CM_OVERRIDE; std::string const& GetConfigName() { return this->ConfigName; } - std::string GetWorkingDirectory() const { return this->WorkingDirectory; } + cmOutputConverter::RelativeRoot GetWorkingDirectory() const + { + return this->WorkingDirectory; + } std::string GetTargetFortranFlags(cmGeneratorTarget const* target, std::string const& config) CM_OVERRIDE; protected: - std::string WorkingDirectory; + cmOutputConverter::RelativeRoot WorkingDirectory; void SetConfigName(); std::string ConfigName; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 5dbe57c..40f3e81 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1410,9 +1410,7 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, #endif // Normal behavior. - return this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), lib), - format); + return this->Convert(lib, START_OUTPUT, format); } /** diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 82e4d2c..f651c6e 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -34,7 +34,7 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmMakefile* mf) - : cmLocalCommonGenerator(gg, mf, mf->GetState()->GetBinaryDirectory()) + : cmLocalCommonGenerator(gg, mf, cmOutputConverter::HOME_OUTPUT) , HomeRelativeOutputPath("") { this->TargetImplib = "$TARGET_IMPLIB"; @@ -145,8 +145,7 @@ std::string cmLocalNinjaGenerator::ConvertToIncludeReference( return this->ConvertToOutputFormat(cmSystemTools::CollapseFullPath(path), format); } - return this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->GetBinaryDirectory(), path), format); + return this->Convert(path, cmOutputConverter::HOME_OUTPUT, format); } // Private methods. @@ -500,10 +499,8 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher( const std::vector<std::string>& outputs = ccg.GetOutputs(); if (!outputs.empty()) { if (ccg.GetWorkingDirectory().empty()) { - output = this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), - outputs[0]), - cmOutputConverter::SHELL); + output = this->Convert(outputs[0], cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); } else { output = this->ConvertToOutputFormat(outputs[0], cmOutputConverter::SHELL); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 23d1571..6fd319e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -94,7 +94,7 @@ static std::string cmSplitExtension(std::string const& in, std::string& base) cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3( cmGlobalGenerator* gg, cmMakefile* mf) - : cmLocalCommonGenerator(gg, mf, mf->GetCurrentBinaryDirectory()) + : cmLocalCommonGenerator(gg, mf, cmOutputConverter::START_OUTPUT) { this->MakefileVariableSize = 0; this->ColorMakefile = false; @@ -1002,10 +1002,8 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( const std::vector<std::string>& outputs = ccg.GetOutputs(); if (!outputs.empty()) { if (workingDir.empty()) { - output = this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), - outputs[0]), - cmOutputConverter::SHELL); + output = this->Convert(outputs[0], cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); } else { output = this->ConvertToOutputFormat(outputs[0], @@ -1097,9 +1095,8 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand( fout << ")\n"; } std::string remove = "$(CMAKE_COMMAND) -P "; - remove += this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), cleanfile), - cmOutputConverter::SHELL); + remove += this->Convert(cleanfile, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); commands.push_back(remove); // For the main clean rule add per-language cleaning. diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 77ec6f7..d344dc5 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -205,9 +205,7 @@ std::string cmLocalVisualStudioGenerator::ConstructScript( } if (workingDirectory.empty()) { - script += this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), cmd), - cmOutputConverter::SHELL); + script += this->Convert(cmd.c_str(), START_OUTPUT, SHELL); } else { script += this->ConvertToOutputFormat(cmd.c_str(), SHELL); } diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 82bd1a3..c1079a2 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -138,20 +138,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat( targetFullPathPDB, cmOutputConverter::SHELL); // Convert to the output path to use in constructing commands. - std::string targetOutPath = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath), - cmOutputConverter::SHELL); - std::string targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal), - cmOutputConverter::SHELL); + std::string targetOutPath = this->Convert( + targetFullPath, cmOutputConverter::START_OUTPUT, cmOutputConverter::SHELL); + std::string targetOutPathReal = + this->Convert(targetFullPathReal, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); std::string targetOutPathImport = - this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), - targetFullPathImport), - cmOutputConverter::SHELL); + this->Convert(targetFullPathImport, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); // Get the language to use for linking this executable. std::string linkLanguage = @@ -325,19 +319,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); - - objectDir = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir), - cmOutputConverter::SHELL); + objectDir = this->Convert(objectDir, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); vars.ObjectDir = objectDir.c_str(); cmOutputConverter::OutputFormat output = (useWatcomQuote) ? cmOutputConverter::WATCOMQUOTE : cmOutputConverter::SHELL; - std::string target = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal), - output); + std::string target = this->Convert( + targetFullPathReal, cmOutputConverter::START_OUTPUT, output); vars.Target = target.c_str(); vars.TargetPDB = targetOutPathPDB.c_str(); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 1d66d52..8d90089 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -312,25 +312,17 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // arguments. std::string targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat( targetFullPathPDB, cmOutputConverter::SHELL); - - std::string targetOutPath = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath), - cmOutputConverter::SHELL); - std::string targetOutPathSO = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathSO), - cmOutputConverter::SHELL); - std::string targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal), - cmOutputConverter::SHELL); + std::string targetOutPath = this->Convert( + targetFullPath, cmOutputConverter::START_OUTPUT, cmOutputConverter::SHELL); + std::string targetOutPathSO = + this->Convert(targetFullPathSO, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); + std::string targetOutPathReal = + this->Convert(targetFullPathReal, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); std::string targetOutPathImport = - this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), - targetFullPathImport), - cmOutputConverter::SHELL); + this->Convert(targetFullPathImport, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); this->NumberOfProgressActions++; if (!this->NoRuleMessages) { @@ -544,20 +536,14 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); - - objectDir = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir), - cmOutputConverter::SHELL); - + objectDir = this->Convert(objectDir, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); vars.ObjectDir = objectDir.c_str(); cmOutputConverter::OutputFormat output = (useWatcomQuote) ? cmOutputConverter::WATCOMQUOTE : cmOutputConverter::SHELL; - std::string target = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal), - output); + std::string target = this->Convert( + targetFullPathReal, cmOutputConverter::START_OUTPUT, output); vars.Target = target.c_str(); vars.LinkLibraries = linkLibs.c_str(); vars.ObjectsQuoted = buildObjs.c_str(); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 014feb9..9809be6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -526,17 +526,14 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( } } - targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal), - cmOutputConverter::SHELL); + targetOutPathReal = + this->Convert(targetFullPathReal, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat( targetFullPathPDB, cmOutputConverter::SHELL); - targetOutPathCompilePDB = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), - targetFullPathCompilePDB), - cmOutputConverter::SHELL); + targetOutPathCompilePDB = + this->Convert(targetFullPathCompilePDB, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); if (this->LocalGenerator->IsMinGWMake() && cmHasLiteralSuffix(targetOutPathCompilePDB, "\\")) { @@ -558,16 +555,12 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( this->LocalGenerator->ConvertToOutputFormat(obj, cmOutputConverter::SHELL); vars.Object = shellObj.c_str(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); - objectDir = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir), - cmOutputConverter::SHELL); + objectDir = this->Convert(objectDir, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); vars.ObjectDir = objectDir.c_str(); std::string objectFileDir = cmSystemTools::GetFilenamePath(obj); - objectFileDir = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), objectFileDir), - cmOutputConverter::SHELL); + objectFileDir = this->Convert(objectFileDir, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); vars.ObjectFileDir = objectFileDir.c_str(); vars.Flags = flags.c_str(); @@ -907,14 +900,12 @@ bool cmMakefileTargetGenerator::WriteMakeRule( // For multiple outputs, make the extra ones depend on the first one. std::vector<std::string> const output_depends(1, outputs[0]); - std::string binDir = this->LocalGenerator->GetBinaryDirectory(); for (std::vector<std::string>::const_iterator o = outputs.begin() + 1; o != outputs.end(); ++o) { // 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), - cmOutputConverter::SHELL); + std::string const out = this->Convert(*o, cmOutputConverter::HOME_OUTPUT, + cmOutputConverter::SHELL); std::vector<std::string> output_commands; bool o_symbolic = false; @@ -1238,10 +1229,8 @@ public: void Feed(std::string const& obj) { // Construct the name of the next object. - this->NextObject = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), obj), - cmOutputConverter::RESPONSE); + this->NextObject = this->LocalGenerator->Convert( + obj, cmOutputConverter::START_OUTPUT, cmOutputConverter::RESPONSE); // Roll over to next string if the limit will be exceeded. if (this->LengthLimit != std::string::npos && @@ -1483,10 +1472,8 @@ 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->GetCurrentBinaryDirectory(), linkScriptName), - cmOutputConverter::SHELL); + link_command += this->Convert( + linkScriptName, cmOutputConverter::START_OUTPUT, cmOutputConverter::SHELL); link_command += " --verbose=$(VERBOSE)"; makefile_commands.push_back(link_command); makefile_depends.push_back(linkScriptName); @@ -1517,9 +1504,9 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForObjects( if (size_t const limit = calculateCommandLineLengthLimit()) { // Compute the total length of our list of object files with room // for argument separation and quoting. This does not convert paths - // relative to CMAKE_CURRENT_BINARY_DIR like the final list will be, so the - // actual list will likely be much shorter than this. However, in the - // worst case all objects will remain as absolute paths. + // relative to START_OUTPUT like the final list will be, so the actual + // list will likely be much shorter than this. However, in the worst + // case all objects will remain as absolute paths. size_t length = 0; for (std::vector<std::string>::const_iterator i = this->Objects.begin(); i != this->Objects.end(); ++i) { @@ -1720,17 +1707,13 @@ void cmMakefileTargetGenerator::GenDefFile( cmd = this->LocalGenerator->ConvertToOutputFormat( cmd, cmOutputConverter::SHELL); cmd += " -E __create_def "; - cmd += this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file), - cmOutputConverter::SHELL); + cmd += this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); cmd += " "; std::string objlist_file = name_of_def_file; objlist_file += ".objs"; - cmd += this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), objlist_file), - cmOutputConverter::SHELL); + cmd += this->Convert(objlist_file, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); real_link_commands.insert(real_link_commands.begin(), cmd); // create a list of obj files for the -E __create_def to read cmGeneratedFileStream fout(objlist_file.c_str()); @@ -1748,10 +1731,9 @@ void cmMakefileTargetGenerator::GenDefFile( // now add the def file link flag linkFlags += " "; linkFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); - linkFlags += this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file), - cmOutputConverter::SHELL); + linkFlags += + this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); linkFlags += " "; } } diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index f87a788..b2384b0 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -642,8 +642,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } } } - // If we have any PRE_LINK commands, we need to go back to CMAKE_BINARY_DIR - // for + // If we have any PRE_LINK commands, we need to go back to HOME_OUTPUT for // the link commands. if (!preLinkCmdLines.empty()) { const std::string homeOutDir = localGen.ConvertToOutputFormat( diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 7f6edf2..4f12ae0 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -46,6 +46,32 @@ std::string cmOutputConverter::ConvertToOutputForExisting( return this->ConvertToOutputFormat(remote, format); } +std::string cmOutputConverter::ConvertToRelativePath( + const std::string& source, RelativeRoot relative) const +{ + std::string result; + + switch (relative) { + case HOME_OUTPUT: + result = this->GetState()->GetBinaryDirectory(); + break; + case START_OUTPUT: + result = this->StateSnapshot.GetDirectory().GetCurrentBinary(); + break; + } + + return this->ConvertToRelativePath(result, source); +} + +std::string cmOutputConverter::Convert(const std::string& source, + RelativeRoot relative, + OutputFormat output) const +{ + // Convert the path to a relative path. + std::string result = this->ConvertToRelativePath(source, relative); + return this->ConvertToOutputFormat(result, output); +} + std::string cmOutputConverter::ConvertToOutputFormat(const std::string& source, OutputFormat output) const { diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index cc24e53..f4eedcf 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -24,6 +24,25 @@ class cmOutputConverter public: cmOutputConverter(cmState::Snapshot snapshot); + /** + * Convert something to something else. This is a centralized conversion + * routine used by the generators to handle relative paths and the like. + * The flags determine what is actually done. + * + * relative: treat the argument as a directory and convert it to make it + * relative or full or unchanged. If relative (HOME, START etc) then that + * specifies what it should be relative to. + * + * output: make the result suitable for output to a... + * + * optional: should any relative path operation be controlled by the rel + * path setting + */ + enum RelativeRoot + { + HOME_OUTPUT, + START_OUTPUT + }; enum OutputFormat { SHELL, @@ -32,6 +51,10 @@ public: }; std::string ConvertToOutputFormat(const std::string& source, OutputFormat output) const; + std::string Convert(const std::string& remote, RelativeRoot local, + OutputFormat output) const; + std::string ConvertToRelativePath(const std::string& remote, + RelativeRoot local) const; std::string ConvertDirectorySeparatorsForShell( const std::string& source) const; ----------------------------------------------------------------------- Summary of changes: Source/cmCommonTargetGenerator.cxx | 12 +++- Source/cmCommonTargetGenerator.h | 4 ++ Source/cmDependsFortran.cxx | 10 ++-- Source/cmLocalCommonGenerator.cxx | 10 ++-- Source/cmLocalCommonGenerator.h | 9 ++- Source/cmLocalGenerator.cxx | 4 +- Source/cmLocalNinjaGenerator.cxx | 11 ++-- Source/cmLocalUnixMakefileGenerator3.cxx | 13 ++--- Source/cmLocalVisualStudioGenerator.cxx | 4 +- Source/cmMakefileExecutableTargetGenerator.cxx | 33 ++++------- Source/cmMakefileLibraryTargetGenerator.cxx | 42 +++++--------- Source/cmMakefileTargetGenerator.cxx | 70 +++++++++--------------- Source/cmNinjaNormalTargetGenerator.cxx | 3 +- Source/cmOutputConverter.cxx | 26 +++++++++ Source/cmOutputConverter.h | 23 ++++++++ 15 files changed, 139 insertions(+), 135 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits