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 c8a45332313cac5acc6661f8bcf4993d1fb81b49 (commit) via 20e62f74c5a030a25fe1c3a6c835d67eea152d8f (commit) via fd93b3605bc931b5ce2386816973e106fa1ec646 (commit) via 1365e18b9b5ddfb5bc13da5bcdefeb566be12f08 (commit) via 1ed5f6b39b80ab337551f1fa9601b3257ddd4be7 (commit) via 8377d9e00b7a00f1687b947aaf3c9e10b6779df4 (commit) via 00173b71d97f81cc9db9b573998bd4359aa2c25b (commit) via d5911ef014fcffd14d397759ca638519733a48ad (commit) via c3264f48c2960325b9141d3ec58c6b49afe120c9 (commit) via 52168f3210ca07a8d80991958d588789c2693d63 (commit) via 5213f8936fd5a70e1f38939e5d1894e7fabb9e02 (commit) via b61c268bd04425597e2e9c5f213dea3cdad3cb19 (commit) via e278f5a84806a2b228182dc4a2cc98a1eaa19f8c (commit) from 78a3604d252b6f42d192807b9bac84f46e6ec76f (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=c8a45332313cac5acc6661f8bcf4993d1fb81b49 commit c8a45332313cac5acc6661f8bcf4993d1fb81b49 Merge: 78a3604 20e62f7 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Thu Oct 6 15:00:27 2016 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Thu Oct 6 15:00:27 2016 -0400 Merge topic 'cleanup-Convert' into next 20e62f74 cmLocalGenerator: Simplify ConvertToLinkReference fd93b360 cmOutputConverter: Add a flag for IsUnix 1365e18b Convert: Inline platform-specific methods 1ed5f6b3 Makefiles: Introduce local RelativePath method 8377d9e0 Fortran: Inline conversion to relative path 00173b71 Fortran: Wrap path convert in a call with a more-suitable name d5911ef0 Makefiles: Hardcode the relative location of the CMakeCache file c3264f48 Convert: Extract method to determine if paths are in directory 52168f32 Convert: Remove asserts which are duplicated in delegate method 5213f893 Convert: Remove early return check b61c268b Convert: Extract local variables for readability e278f5a8 Convert: Extract local variables https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20e62f74c5a030a25fe1c3a6c835d67eea152d8f commit 20e62f74c5a030a25fe1c3a6c835d67eea152d8f Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 4 22:56:32 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 20:02:10 2016 +0200 cmLocalGenerator: Simplify ConvertToLinkReference Make conversion to output format the caller responsibility, so that the method only 'converts to a link reference'. diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 6887a31..14ea1a9 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -75,8 +75,10 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags) // Append the flag and value. Use ConvertToLinkReference to help // vs6's "cl -link" pass it to the linker. std::string flag = defFileFlag; - flag += (this->LocalGenerator->ConvertToLinkReference( - this->ModuleDefinitionFile->GetFullPath())); + flag += this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToLinkReference( + this->ModuleDefinitionFile->GetFullPath()), + cmOutputConverter::SHELL); this->LocalGenerator->AppendFlags(flags, flag); } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f24b717..b2569a2 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1374,8 +1374,7 @@ std::string cmLocalGenerator::GetTargetFortranFlags( return std::string(); } -std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, - OutputFormat format) +std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib) { #if defined(_WIN32) && !defined(__CYGWIN__) // Work-ardound command line parsing limitations in MSVC 6.0 @@ -1392,17 +1391,14 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, // Append the rest of the path with no space. sp += lib.substr(pos); - // Convert to an output path. - return this->ConvertToOutputFormat(sp.c_str(), format); + return sp; } } } #endif // Normal behavior. - return this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), lib), - format); + return this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), lib); } /** @@ -1517,7 +1513,8 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, continue; } if (li->IsPath) { - linkLibs += this->ConvertToLinkReference(li->Value, shellFormat); + linkLibs += this->ConvertToOutputFormat( + this->ConvertToLinkReference(li->Value), shellFormat); } else { linkLibs += li->Value; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 19469be..703a507 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -367,9 +367,7 @@ protected: std::string& CreateSafeUniqueObjectFileName(const std::string& sin, std::string const& dir_max); - virtual std::string ConvertToLinkReference( - std::string const& lib, - cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL); + virtual std::string ConvertToLinkReference(std::string const& lib); /** Check whether the native build system supports the given definition. Issues a warning. */ diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 11b87e3..5736581 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -121,10 +121,9 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator() // Virtual protected methods. std::string cmLocalNinjaGenerator::ConvertToLinkReference( - std::string const& lib, cmOutputConverter::OutputFormat format) + std::string const& lib) { - std::string path = this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(lib); - return this->ConvertToOutputFormat(path, format); + return this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(lib); } std::string cmLocalNinjaGenerator::ConvertToIncludeReference( diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 875f8c6..3061b57 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -76,9 +76,7 @@ public: void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg, cmNinjaDeps& ninjaDeps); - std::string ConvertToLinkReference(std::string const& lib, - cmOutputConverter::OutputFormat format = - cmOutputConverter::SHELL) CM_OVERRIDE; + std::string ConvertToLinkReference(std::string const& lib) CM_OVERRIDE; void ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd93b3605bc931b5ce2386816973e106fa1ec646 commit fd93b3605bc931b5ce2386816973e106fa1ec646 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 4 22:56:32 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 20:02:10 2016 +0200 cmOutputConverter: Add a flag for IsUnix Remove the need for method parameters to represent the distinction. diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 8ae9058..84a433c 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -239,9 +239,11 @@ std::string cmOutputConverter::EscapeForShell(const std::string& str, if (this->GetState()->UseNMake()) { flags |= Shell_Flag_NMake; } + if (!this->GetState()->UseWindowsShell()) { + flags |= Shell_Flag_IsUnix; + } - return Shell__GetArgument(str.c_str(), !this->GetState()->UseWindowsShell(), - flags); + return Shell__GetArgument(str.c_str(), flags); } std::string cmOutputConverter::EscapeForCMake(const std::string& str) @@ -270,7 +272,7 @@ std::string cmOutputConverter::EscapeForCMake(const std::string& str) std::string cmOutputConverter::EscapeWindowsShellArgument(const char* arg, int shell_flags) { - return Shell__GetArgument(arg, 0, shell_flags); + return Shell__GetArgument(arg, shell_flags); } cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat( @@ -356,10 +358,10 @@ int cmOutputConverter::Shell__CharNeedsQuotesOnWindows(char c) (c == '>') || (c == '|') || (c == '^')); } -int cmOutputConverter::Shell__CharNeedsQuotes(char c, int isUnix, int flags) +int cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags) { /* On Windows the built-in command shell echo never needs quotes. */ - if (!isUnix && (flags & Shell_Flag_EchoWindows)) { + if (!(flags & Shell_Flag_IsUnix) && (flags & Shell_Flag_EchoWindows)) { return 0; } @@ -368,7 +370,7 @@ int cmOutputConverter::Shell__CharNeedsQuotes(char c, int isUnix, int flags) return 1; } - if (isUnix) { + if (flags & Shell_Flag_IsUnix) { /* On UNIX several special characters need quotes to preserve them. */ if (Shell__CharNeedsQuotesOnUnix(c)) { return 1; @@ -426,8 +428,7 @@ flag later when we understand applications of this better. */ #define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0 -int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int isUnix, - int flags) +int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int flags) { /* The empty string needs quotes. */ if (!*in) { @@ -459,14 +460,14 @@ int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int isUnix, } /* Check whether this character needs quotes. */ - if (Shell__CharNeedsQuotes(*c, isUnix, flags)) { + if (Shell__CharNeedsQuotes(*c, flags)) { return 1; } } } /* On Windows some single character arguments need quotes. */ - if (!isUnix && *in && !*(in + 1)) { + if (flags & Shell_Flag_IsUnix && *in && !*(in + 1)) { char c = *in; if ((c == '?') || (c == '&') || (c == '^') || (c == '|') || (c == '#')) { return 1; @@ -476,8 +477,7 @@ int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int isUnix, return 0; } -std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix, - int flags) +std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags) { std::ostringstream out; @@ -488,11 +488,11 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix, int windows_backslashes = 0; /* Whether the argument must be quoted. */ - int needQuotes = Shell__ArgumentNeedsQuotes(in, isUnix, flags); + int needQuotes = Shell__ArgumentNeedsQuotes(in, flags); if (needQuotes) { /* Add the opening quote for this argument. */ if (flags & Shell_Flag_WatcomQuote) { - if (isUnix) { + if (flags & Shell_Flag_IsUnix) { out << '"'; } out << '\''; @@ -524,7 +524,7 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix, } /* Check whether this character needs escaping for the shell. */ - if (isUnix) { + if (flags & Shell_Flag_IsUnix) { /* On Unix a few special characters need escaping even inside a quoted argument. */ if (*c == '\\' || *c == '"' || *c == '`' || *c == '$') { @@ -621,7 +621,7 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix, /* Add the closing quote for this argument. */ if (flags & Shell_Flag_WatcomQuote) { out << '\''; - if (isUnix) { + if (flags & Shell_Flag_IsUnix) { out << '"'; } } else { diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 787075e..71cacab 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -66,7 +66,9 @@ public: Shell_Flag_AllowMakeVariables = (1 << 6), /** The target shell quoting uses extra single Quotes for Watcom tools. */ - Shell_Flag_WatcomQuote = (1 << 7) + Shell_Flag_WatcomQuote = (1 << 7), + + Shell_Flag_IsUnix = (1 << 8) }; std::string EscapeForShell(const std::string& str, bool makeVars = false, @@ -116,11 +118,11 @@ private: static int Shell__CharIsWhitespace(char c); static int Shell__CharNeedsQuotesOnUnix(char c); static int Shell__CharNeedsQuotesOnWindows(char c); - static int Shell__CharNeedsQuotes(char c, int isUnix, int flags); + static int Shell__CharNeedsQuotes(char c, int flags); static int Shell__CharIsMakeVariableName(char c); static const char* Shell__SkipMakeVariables(const char* c); - static int Shell__ArgumentNeedsQuotes(const char* in, int isUnix, int flags); - static std::string Shell__GetArgument(const char* in, int isUnix, int flags); + static int Shell__ArgumentNeedsQuotes(const char* in, int flags); + static std::string Shell__GetArgument(const char* in, int flags); private: cmState::Snapshot StateSnapshot; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1365e18b9b5ddfb5bc13da5bcdefeb566be12f08 commit 1365e18b9b5ddfb5bc13da5bcdefeb566be12f08 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 4 22:56:32 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 20:02:09 2016 +0200 Convert: Inline platform-specific methods They don't provide real value. diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index dfc1610..8ae9058 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -240,9 +240,8 @@ std::string cmOutputConverter::EscapeForShell(const std::string& str, flags |= Shell_Flag_NMake; } - return this->GetState()->UseWindowsShell() - ? Shell_GetArgumentForWindows(str.c_str(), flags) - : Shell_GetArgumentForUnix(str.c_str(), flags); + return Shell__GetArgument(str.c_str(), !this->GetState()->UseWindowsShell(), + flags); } std::string cmOutputConverter::EscapeForCMake(const std::string& str) @@ -271,7 +270,7 @@ std::string cmOutputConverter::EscapeForCMake(const std::string& str) std::string cmOutputConverter::EscapeWindowsShellArgument(const char* arg, int shell_flags) { - return Shell_GetArgumentForWindows(arg, shell_flags); + return Shell__GetArgument(arg, 0, shell_flags); } cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat( @@ -632,15 +631,3 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix, return out.str(); } - -std::string cmOutputConverter::Shell_GetArgumentForWindows(const char* in, - int flags) -{ - return Shell__GetArgument(in, 0, flags); -} - -std::string cmOutputConverter::Shell_GetArgumentForUnix(const char* in, - int flags) -{ - return Shell__GetArgument(in, 1, flags); -} diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 745686b..787075e 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -33,8 +33,7 @@ public: void SetLinkScriptShell(bool linkScriptShell); /** - * Flags to pass to Shell_GetArgumentForWindows or - * Shell_GetArgumentForUnix. These modify the generated + * Flags to pass to Shell_GetArgument. These modify the generated * quoting and escape sequences to work under alternative * environments. */ @@ -70,16 +69,6 @@ public: Shell_Flag_WatcomQuote = (1 << 7) }; - /** - * Transform the given command line argument for use in a Windows or - * Unix shell. Returns a pointer to the end of the command line - * argument in the provided output buffer. Flags may be passed to - * modify the generated quoting and escape sequences to work under - * alternative environments. - */ - static std::string Shell_GetArgumentForWindows(const char* in, int flags); - static std::string Shell_GetArgumentForUnix(const char* in, int flags); - std::string EscapeForShell(const std::string& str, bool makeVars = false, bool forEcho = false, bool useWatcomQuote = false) const; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ed5f6b39b80ab337551f1fa9601b3257ddd4be7 commit 1ed5f6b39b80ab337551f1fa9601b3257ddd4be7 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 4 22:56:31 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 20:02:08 2016 +0200 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. diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 8825b46..915119c 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -141,7 +141,7 @@ void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath() { // Compute the path to use when referencing the current output // directory from the top output directory. - this->HomeRelativeOutputPath = this->ConvertToRelativePath( + this->HomeRelativeOutputPath = this->MaybeConvertToRelativePath( this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); if (this->HomeRelativeOutputPath == ".") { this->HomeRelativeOutputPath = ""; @@ -548,7 +548,8 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule( // Construct the left hand side of the rule. std::string tgt = cmSystemTools::ConvertToOutputPath( - this->ConvertToRelativePath(this->GetBinaryDirectory(), target).c_str()); + this->MaybeConvertToRelativePath(this->GetBinaryDirectory(), target) + .c_str()); const char* space = ""; if (tgt.size() == 1) { @@ -577,7 +578,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule( dep != depends.end(); ++dep) { replace = *dep; replace = cmSystemTools::ConvertToOutputPath( - this->ConvertToRelativePath(binDir, replace).c_str()); + this->MaybeConvertToRelativePath(binDir, replace).c_str()); os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n"; } } @@ -969,7 +970,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(currentBinDir, cmd); + cmd = this->MaybeConvertToRelativePath(currentBinDir, cmd); } bool has_slash = cmd.find('/') != cmd.npos; if (had_slash && !has_slash) { @@ -994,8 +995,8 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( if (!outputs.empty()) { if (workingDir.empty()) { output = this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), - outputs[0]), + this->MaybeConvertToRelativePath( + this->GetCurrentBinaryDirectory(), outputs[0]), cmOutputConverter::SHELL); } else { @@ -1082,14 +1083,15 @@ 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(currentBinDir, *f); + std::string fc = this->MaybeConvertToRelativePath(currentBinDir, *f); fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n"; } fout << ")\n"; } std::string remove = "$(CMAKE_COMMAND) -P "; remove += this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), cleanfile), + this->MaybeConvertToRelativePath(this->GetCurrentBinaryDirectory(), + cleanfile), cmOutputConverter::SHELL); commands.push_back(remove); @@ -1858,7 +1860,8 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo( } for (std::vector<std::string>::iterator i = includes.begin(); i != includes.end(); ++i) { - cmakefileStream << " \"" << this->ConvertToRelativePath(binaryDir, *i) + cmakefileStream << " \"" + << this->MaybeConvertToRelativePath(binaryDir, *i) << "\"\n"; } cmakefileStream << " )\n"; @@ -1923,7 +1926,7 @@ std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall( if (!tgt.empty()) { // The make target is always relative to the top of the build tree. std::string tgt2 = - this->ConvertToRelativePath(this->GetBinaryDirectory(), tgt); + this->MaybeConvertToRelativePath(this->GetBinaryDirectory(), tgt); // The target may have been written with windows paths. cmSystemTools::ConvertToOutputSlashes(tgt2); @@ -2095,3 +2098,13 @@ void cmLocalUnixMakefileGenerator3::CreateCDCommand( std::bind1st(std::plus<std::string>(), prefix)); } } + +std::string cmLocalUnixMakefileGenerator3::MaybeConvertToRelativePath( + std::string const& base, std::string const& path) +{ + if (!cmOutputConverter::ContainedInDirectory( + base, path, this->GetStateSnapshot().GetDirectory())) { + return path; + } + return cmOutputConverter::ForceToRelativePath(base, path); +} diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index fc5c8e7..c3ecda4 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -184,6 +184,9 @@ public: // Eclipse generator. void GetIndividualFileTargets(std::vector<std::string>& targets); + std::string MaybeConvertToRelativePath(std::string const& base, + std::string const& path); + protected: void WriteLocalMakefile(); diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index cb20117..ff97696 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -130,16 +130,16 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) targetFullPathPDB, cmOutputConverter::SHELL); // Convert to the output path to use in constructing commands. std::string targetOutPath = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath), cmOutputConverter::SHELL); std::string targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal), cmOutputConverter::SHELL); std::string targetOutPathImport = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathImport), cmOutputConverter::SHELL); @@ -215,27 +215,27 @@ 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->LocalGenerator->ConvertToRelativePath( + exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath)); #ifdef _WIN32 // There may be a manifest file for this target. Add it to the // clean set just in case. - exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( + exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), (targetFullPath + ".manifest").c_str())); #endif if (targetNameReal != targetName) { - exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( + exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal)); } if (!targetNameImport.empty()) { - exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( + exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathImport)); std::string implib; if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport, implib)) { - exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( + exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), implib)); } } @@ -243,7 +243,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // 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->LocalGenerator->ConvertToRelativePath( + this->CleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathPDB)); // Add the pre-build and pre-link rules building but not when relinking. @@ -318,7 +318,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) 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(); @@ -326,7 +326,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) ? cmOutputConverter::WATCOMQUOTE : cmOutputConverter::SHELL; std::string target = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal), output); vars.Target = target.c_str(); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index b969bfb..8e25f43 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -305,20 +305,20 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( targetFullPathPDB, cmOutputConverter::SHELL); std::string targetOutPath = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath), cmOutputConverter::SHELL); std::string targetOutPathSO = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathSO), cmOutputConverter::SHELL); std::string targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal), cmOutputConverter::SHELL); std::string targetOutPathImport = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathImport), cmOutputConverter::SHELL); @@ -366,24 +366,24 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // Clean files associated with this library. std::vector<std::string> libCleanFiles; - libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( + libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath)); if (targetNameReal != targetName) { - libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( + libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal)); } if (targetNameSO != targetName && targetNameSO != targetNameReal) { - libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( + libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathSO)); } if (!targetNameImport.empty()) { - libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( + libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathImport)); std::string implib; if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport, implib)) { - libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( + libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), implib)); } } @@ -391,14 +391,14 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // 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->LocalGenerator->ConvertToRelativePath( + this->CleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathPDB)); #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->LocalGenerator->ConvertToRelativePath( + libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), (targetFullPath + ".manifest").c_str())); } @@ -537,7 +537,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); objectDir = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir), cmOutputConverter::SHELL); @@ -546,7 +546,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( ? cmOutputConverter::WATCOMQUOTE : cmOutputConverter::SHELL; std::string target = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal), output); vars.Target = target.c_str(); 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 += " "; diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index f40c8fa..ecb29cb 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -46,7 +46,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() << this->GlobalGenerator->IncludeDirective << " " << root << cmSystemTools::ConvertToOutputPath( this->LocalGenerator - ->ConvertToRelativePath( + ->MaybeConvertToRelativePath( this->LocalGenerator->GetBinaryDirectory(), this->ProgressFileNameFull) .c_str()) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8377d9e00b7a00f1687b947aaf3c9e10b6779df4 commit 8377d9e00b7a00f1687b947aaf3c9e10b6779df4 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 4 22:56:31 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 20:02:08 2016 +0200 Fortran: Inline conversion to relative path Don't use cmOutputConverter method which relies on directory-specific state. diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 4c0f688..aaa9d3a 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -707,5 +707,9 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, std::string cmDependsFortran::MaybeConvertToRelativePath( std::string const& base, std::string const& path) { - return this->LocalGenerator->ConvertToRelativePath(base, path); + if (!cmOutputConverter::ContainedInDirectory( + base, path, this->LocalGenerator->GetStateSnapshot().GetDirectory())) { + return path; + } + return cmOutputConverter::ForceToRelativePath(base, path); } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00173b71d97f81cc9db9b573998bd4359aa2c25b commit 00173b71d97f81cc9db9b573998bd4359aa2c25b Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 4 22:56:31 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 20:02:07 2016 +0200 Fortran: Wrap path convert in a call with a more-suitable name diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index c1c8880..4c0f688 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -198,16 +198,13 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, stamp += ".mod.stamp"; fcStream << "\n"; fcStream << " \"" - << this->LocalGenerator->ConvertToRelativePath(currentBinDir, - mod_lower) + << this->MaybeConvertToRelativePath(currentBinDir, mod_lower) << "\"\n"; fcStream << " \"" - << this->LocalGenerator->ConvertToRelativePath(currentBinDir, - mod_upper) + << this->MaybeConvertToRelativePath(currentBinDir, mod_upper) << "\"\n"; fcStream << " \"" - << this->LocalGenerator->ConvertToRelativePath(currentBinDir, - stamp) + << this->MaybeConvertToRelativePath(currentBinDir, stamp) << "\"\n"; } fcStream << " )\n"; @@ -323,17 +320,16 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, // Write the include dependencies to the output stream. std::string binDir = this->LocalGenerator->GetBinaryDirectory(); - std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj); + std::string obj_i = this->MaybeConvertToRelativePath(binDir, obj); std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i.c_str()); internalDepends << obj_i << std::endl; internalDepends << " " << src << std::endl; for (std::set<std::string>::const_iterator i = info.Includes.begin(); i != info.Includes.end(); ++i) { - makeDepends - << obj_m << ": " - << cmSystemTools::ConvertToOutputPath( - this->LocalGenerator->ConvertToRelativePath(binDir, *i).c_str()) - << std::endl; + makeDepends << obj_m << ": " + << cmSystemTools::ConvertToOutputPath( + this->MaybeConvertToRelativePath(binDir, *i).c_str()) + << std::endl; internalDepends << " " << *i << std::endl; } makeDepends << std::endl; @@ -359,7 +355,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, proxy += *i; proxy += ".mod.proxy"; proxy = cmSystemTools::ConvertToOutputPath( - this->LocalGenerator->ConvertToRelativePath(binDir, proxy).c_str()); + this->MaybeConvertToRelativePath(binDir, proxy).c_str()); // since we require some things add them to our list of requirements makeDepends << obj_m << ".requires: " << proxy << std::endl; @@ -375,8 +371,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, if (!required->second.empty()) { // This module is known. Depend on its timestamp file. std::string stampFile = cmSystemTools::ConvertToOutputPath( - this->LocalGenerator->ConvertToRelativePath(binDir, required->second) - .c_str()); + this->MaybeConvertToRelativePath(binDir, required->second).c_str()); makeDepends << obj_m << ": " << stampFile << "\n"; } else { // This module is not known to CMake. Try to locate it where @@ -384,7 +379,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, std::string module; if (this->FindModule(*i, module)) { module = cmSystemTools::ConvertToOutputPath( - this->LocalGenerator->ConvertToRelativePath(binDir, module).c_str()); + this->MaybeConvertToRelativePath(binDir, module).c_str()); makeDepends << obj_m << ": " << module << "\n"; } } @@ -398,7 +393,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, proxy += *i; proxy += ".mod.proxy"; proxy = cmSystemTools::ConvertToOutputPath( - this->LocalGenerator->ConvertToRelativePath(binDir, proxy).c_str()); + this->MaybeConvertToRelativePath(binDir, proxy).c_str()); makeDepends << proxy << ": " << obj_m << ".provides" << std::endl; } @@ -420,14 +415,14 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, modFile += "/"; modFile += *i; modFile = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath(binDir, modFile), + this->MaybeConvertToRelativePath(binDir, modFile), cmOutputConverter::SHELL); std::string stampFile = stamp_dir; stampFile += "/"; stampFile += m; stampFile += ".mod.stamp"; stampFile = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath(binDir, stampFile), + this->MaybeConvertToRelativePath(binDir, stampFile), cmOutputConverter::SHELL); makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod " << modFile << " " << stampFile; @@ -448,7 +443,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, std::string driver = this->TargetDirectory; driver += "/build"; driver = cmSystemTools::ConvertToOutputPath( - this->LocalGenerator->ConvertToRelativePath(binDir, driver).c_str()); + this->MaybeConvertToRelativePath(binDir, driver).c_str()); makeDepends << driver << ": " << obj_m << ".provides.build\n"; } @@ -708,3 +703,9 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, // content. return cmFortranStreamsDiffer(finModFile, finStampFile); } + +std::string cmDependsFortran::MaybeConvertToRelativePath( + std::string const& base, std::string const& path) +{ + return this->LocalGenerator->ConvertToRelativePath(base, path); +} diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index 8d347f4..90b82d4 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -78,6 +78,9 @@ protected: private: cmDependsFortran(cmDependsFortran const&); // Purposely not implemented. void operator=(cmDependsFortran const&); // Purposely not implemented. + + std::string MaybeConvertToRelativePath(std::string const& base, + std::string const& path); }; #endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d5911ef014fcffd14d397759ca638519733a48ad commit d5911ef014fcffd14d397759ca638519733a48ad Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 4 22:56:30 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 20:02:07 2016 +0200 Makefiles: Hardcode the relative location of the CMakeCache file In this context, currentBinDir refers to the CMAKE_BINARY_DIR because it comes from the first local generator. GetHomeOutputDirectory is the same as CMAKE_BINARY_DIR, so the computation here is unnecessary. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 4a5cc77..95f6ea8 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -306,16 +306,12 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() // reset lg to the first makefile lg = static_cast<cmLocalUnixMakefileGenerator3*>(this->LocalGenerators[0]); - // Build the path to the cache file. - 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(currentBinDir, cache) << "\"\n"; + << " \"CMakeCache.txt\"\n"; for (std::vector<std::string>::const_iterator i = lfiles.begin(); i != lfiles.end(); ++i) { cmakefileStream << " \"" << lg->ConvertToRelativePath(currentBinDir, *i) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c3264f48c2960325b9141d3ec58c6b49afe120c9 commit c3264f48c2960325b9141d3ec58c6b49afe120c9 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 4 22:56:30 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 20:02:06 2016 +0200 Convert: Extract method to determine if paths are in directory The conditional early return can be moved to clients, which would have many benefits, notably making cmOutputConverter independent of directory-specific state. diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 5d31f02..dfc1610 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -76,13 +76,14 @@ static bool cmOutputConverterNotAbove(const char* a, const char* b) cmSystemTools::IsSubDirectory(a, b)); } -std::string cmOutputConverter::ConvertToRelativePath( - std::string const& local_path, std::string const& remote_path) const +bool cmOutputConverter::ContainedInDirectory(std::string const& local_path, + std::string const& remote_path, + cmState::Directory directory) { const std::string relativePathTopBinary = - this->StateSnapshot.GetDirectory().GetRelativePathTopBinary(); + directory.GetRelativePathTopBinary(); const std::string relativePathTopSource = - this->StateSnapshot.GetDirectory().GetRelativePathTopSource(); + directory.GetRelativePathTopSource(); const bool bothInBinary = cmOutputConverterNotAbove(local_path.c_str(), @@ -96,7 +97,14 @@ std::string cmOutputConverter::ConvertToRelativePath( cmOutputConverterNotAbove(remote_path.c_str(), relativePathTopSource.c_str()); - if (!(bothInSource || bothInBinary)) { + return bothInSource || bothInBinary; +} + +std::string cmOutputConverter::ConvertToRelativePath( + std::string const& local_path, std::string const& remote_path) const +{ + if (!ContainedInDirectory(local_path, remote_path, + this->StateSnapshot.GetDirectory())) { return remote_path; } diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index fd887ae..745686b 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -99,6 +99,10 @@ public: }; static FortranFormat GetFortranFormat(const char* value); + static bool ContainedInDirectory(std::string const& local_path, + std::string const& remote_path, + cmState::Directory directory); + /** * Convert the given remote path to a relative path with respect to * the given local path. Both paths must use forward slashes and not https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=52168f3210ca07a8d80991958d588789c2693d63 commit 52168f3210ca07a8d80991958d588789c2693d63 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 4 22:56:30 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 20:02:05 2016 +0200 Convert: Remove asserts which are duplicated in delegate method This means that we don't encounter the asserts in the case where we early-return from here. diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 9970936..5d31f02 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -79,13 +79,6 @@ static bool cmOutputConverterNotAbove(const char* a, const char* b) std::string cmOutputConverter::ConvertToRelativePath( std::string const& local_path, std::string const& remote_path) const { - // The paths should never be quoted. - assert(local_path[0] != '\"'); - assert(remote_path[0] != '\"'); - - // The local path should never have a trailing slash. - assert(local_path.empty() || local_path[local_path.size() - 1] != '/'); - const std::string relativePathTopBinary = this->StateSnapshot.GetDirectory().GetRelativePathTopBinary(); const std::string relativePathTopSource = https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5213f8936fd5a70e1f38939e5d1894e7fabb9e02 commit 5213f8936fd5a70e1f38939e5d1894e7fabb9e02 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 4 22:56:30 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 20:02:05 2016 +0200 Convert: Remove early return check This function delegates to another function which does the same check. diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 70bcb99..9970936 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -86,11 +86,6 @@ std::string cmOutputConverter::ConvertToRelativePath( // The local path should never have a trailing slash. assert(local_path.empty() || local_path[local_path.size() - 1] != '/'); - // If the path is already relative then just return the path. - if (!cmSystemTools::FileIsFullPath(remote_path.c_str())) { - return remote_path; - } - const std::string relativePathTopBinary = this->StateSnapshot.GetDirectory().GetRelativePathTopBinary(); const std::string relativePathTopSource = https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b61c268bd04425597e2e9c5f213dea3cdad3cb19 commit b61c268bd04425597e2e9c5f213dea3cdad3cb19 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 4 22:56:30 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 20:02:04 2016 +0200 Convert: Extract local variables for readability diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index eee1988..70bcb99 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -91,21 +91,22 @@ std::string cmOutputConverter::ConvertToRelativePath( return remote_path; } + const std::string relativePathTopBinary = + this->StateSnapshot.GetDirectory().GetRelativePathTopBinary(); + const std::string relativePathTopSource = + this->StateSnapshot.GetDirectory().GetRelativePathTopSource(); + const bool bothInBinary = - cmOutputConverterNotAbove( - local_path.c_str(), - this->StateSnapshot.GetDirectory().GetRelativePathTopBinary()) && - cmOutputConverterNotAbove( - remote_path.c_str(), - this->StateSnapshot.GetDirectory().GetRelativePathTopBinary()); + cmOutputConverterNotAbove(local_path.c_str(), + relativePathTopBinary.c_str()) && + cmOutputConverterNotAbove(remote_path.c_str(), + relativePathTopBinary.c_str()); const bool bothInSource = - cmOutputConverterNotAbove( - local_path.c_str(), - this->StateSnapshot.GetDirectory().GetRelativePathTopSource()) && - cmOutputConverterNotAbove( - remote_path.c_str(), - this->StateSnapshot.GetDirectory().GetRelativePathTopSource()); + cmOutputConverterNotAbove(local_path.c_str(), + relativePathTopSource.c_str()) && + cmOutputConverterNotAbove(remote_path.c_str(), + relativePathTopSource.c_str()); if (!(bothInSource || bothInBinary)) { return remote_path; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e278f5a84806a2b228182dc4a2cc98a1eaa19f8c commit e278f5a84806a2b228182dc4a2cc98a1eaa19f8c Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 4 22:56:30 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 20:02:03 2016 +0200 Convert: Extract local variables Remove comment made obsolete by them. diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 0b270aa..eee1988 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -91,20 +91,23 @@ std::string cmOutputConverter::ConvertToRelativePath( return remote_path; } - // Skip conversion if the path and local are not both in the source - // or both in the binary tree. - if (!((cmOutputConverterNotAbove( - local_path.c_str(), - this->StateSnapshot.GetDirectory().GetRelativePathTopBinary()) && - cmOutputConverterNotAbove( - remote_path.c_str(), - this->StateSnapshot.GetDirectory().GetRelativePathTopBinary())) || - (cmOutputConverterNotAbove( - local_path.c_str(), - this->StateSnapshot.GetDirectory().GetRelativePathTopSource()) && - cmOutputConverterNotAbove( - remote_path.c_str(), - this->StateSnapshot.GetDirectory().GetRelativePathTopSource())))) { + const bool bothInBinary = + cmOutputConverterNotAbove( + local_path.c_str(), + this->StateSnapshot.GetDirectory().GetRelativePathTopBinary()) && + cmOutputConverterNotAbove( + remote_path.c_str(), + this->StateSnapshot.GetDirectory().GetRelativePathTopBinary()); + + const bool bothInSource = + cmOutputConverterNotAbove( + local_path.c_str(), + this->StateSnapshot.GetDirectory().GetRelativePathTopSource()) && + cmOutputConverterNotAbove( + remote_path.c_str(), + this->StateSnapshot.GetDirectory().GetRelativePathTopSource()); + + if (!(bothInSource || bothInBinary)) { return remote_path; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51bc6bddb91283da25d098492c9cc1b50e3008fc commit 51bc6bddb91283da25d098492c9cc1b50e3008fc Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Thu Jun 16 23:25:43 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 18:45:18 2016 +0200 cmOutputConverter: remove unused code Remove old ConvertToRelativePath function now that all clients have migrated to the new signature. diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 2ef603b..0b270aa 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -77,15 +77,6 @@ static bool cmOutputConverterNotAbove(const char* a, const char* b) } std::string cmOutputConverter::ConvertToRelativePath( - const std::vector<std::string>& local, const std::string& in_remote, - bool force) const -{ - std::string local_path = cmSystemTools::JoinPath(local); - return force ? this->ForceToRelativePath(local_path, in_remote) - : this->ConvertToRelativePath(local_path, in_remote); -} - -std::string cmOutputConverter::ConvertToRelativePath( std::string const& local_path, std::string const& remote_path) const { // The paths should never be quoted. diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 5979eaa..fd887ae 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -101,17 +101,6 @@ public: /** * Convert the given remote path to a relative path with respect to - * the given local path. The local path must be given in component - * form (see SystemTools::SplitPath) without a trailing slash. The - * remote path must use forward slashes and not already be escaped - * or quoted. - */ - std::string ConvertToRelativePath(const std::vector<std::string>& local, - const std::string& in_remote, - bool force = false) const; - - /** - * Convert the given remote path to a relative path with respect to * the given local path. Both paths must use forward slashes and not * already be escaped or quoted. * The conversion is skipped if the paths are not both in the source https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8e0c1599a1015cf80c4db35d108509986236b756 commit 8e0c1599a1015cf80c4db35d108509986236b756 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Mon Sep 19 22:54:38 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Oct 6 18:45:18 2016 +0200 Xcode: Inline ConvertToRelativePath calls Avoid violations of Interface Segregation Principle. These two calls now simply call different methods. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4ff612d..75fc2e4 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3325,14 +3325,14 @@ std::string cmGlobalXCodeGenerator::RelativeToSource(const char* p) { // We force conversion because Xcode breakpoints do not work unless // they are in a file named relative to the source tree. - return this->CurrentLocalGenerator->ConvertToRelativePath( - this->ProjectSourceDirectoryComponents, p, true); + return cmOutputConverter::ForceToRelativePath( + cmSystemTools::JoinPath(this->ProjectSourceDirectoryComponents), p); } std::string cmGlobalXCodeGenerator::RelativeToBinary(const char* p) { return this->CurrentLocalGenerator->ConvertToRelativePath( - this->ProjectOutputDirectoryComponents, p); + cmSystemTools::JoinPath(this->ProjectOutputDirectoryComponents), p); } std::string cmGlobalXCodeGenerator::XCodeEscapePath(const std::string& p) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits