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 cade5c78ff25278826bc1690084230a04994a6e6 (commit) via 5683e63cca186ef87e4601616be013421a8aad54 (commit) via daf862ae62ad9c11e6352a02068922b42acf2919 (commit) via 2ad43682e3f665a59e54746d039a7577b976ca6f (commit) via 95ac2339588d0d16f21327c16b098f4c54b5d67b (commit) via bcab65ad983297e1455f43ea9e06f38170e9bb75 (commit) via aab066a87b18d6ca2be47fbd5c2a6b8dd8e287a9 (commit) via ca466374c54031b22018519868d70c9e917df8d1 (commit) via 0e9c972fc2cc3d4338890a5e4528bfd7a8b22fc1 (commit) via ce2c74c4783f0de4493268c27b3aecd5ddecb135 (commit) via 6f1f8f6299a8f7e05e839573b5f1ae4ce1ad1ea2 (commit) via 8e1d9db85bd462c8226550f4bea988ff6b220ac5 (commit) via c282b12f815a95135c2347f022263efcdea1544b (commit) via 257265241a791b96a219133d0eba22b9e2b71468 (commit) via 8f4b0756bd6bd8e5a1a6055af373972abf66de54 (commit) via b25b70e36e2620b4e8480af62fb7d77babff59a4 (commit) via 2fe53afb2ca99257143cb89e633b7a4fe84265cb (commit) via 1b855d76829ea3633eea0ec608e5cbabf18c06ff (commit) via 983421d8048c44f33704dba4b1302eeadd600463 (commit) via 94a51b0185fde6210056cd3b3b5526bb5e0ed830 (commit) via 5d3f0e12ed94c4048ef24025f1674692474b7602 (commit) via 3d87bd9725341f76ba95f6063b177021dd84a583 (commit) via 11ad1af8a35a744413b405c5c86e1dbdab38c430 (commit) via 8d47a20f131147d4cf38e63df0c382ec5844a833 (commit) via 149af87b86362449a99301860af5aac1a3b4b20c (commit) from a1d30dcccfa79e3f79ab13c88749a8d0f04f14aa (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=cade5c78ff25278826bc1690084230a04994a6e6 commit cade5c78ff25278826bc1690084230a04994a6e6 Merge: a1d30dc 5683e63 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Sep 17 04:50:52 2016 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Sat Sep 17 04:50:52 2016 -0400 Merge topic 'cleanup-Convert' into next 5683e63c cmOutputConverter: Remove now-obsolete Convert method daf862ae Convert: Inline uses of START_OUTPUT 2ad43682 Convert: Remove HOME_OUTPUT enum value 95ac2339 Ninja: Update comment variable reference bcab65ad Convert: Move access to BinaryDirectory out of loops aab066a8 Convert: Inline uses of HOME_OUTPUT ca466374 Common: Use a string instead of enum for WorkingDirectory 0e9c972f Convert: Simplify switch ce2c74c4 Convert: Remove obsolete MAKERULE enum value 6f1f8f62 Convert: Move access to BinaryDirectory out of loops 8e1d9db8 Convert: Inline HOME_OUTPUT MAKERULE conversion c282b12f Convert: Inline MAKERULE conversions 25726524 Convert: Move access to BinaryDirectory out of loops 8f4b0756 Convert: Avoid HOME_OUTPUT enum when converting to relative paths b25b70e3 Convert: Move access to CurrentBinaryDirectory out of loops 2fe53afb Convert: Avoid START_OUTPUT enum when converting to relative paths ... https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5683e63cca186ef87e4601616be013421a8aad54 commit 5683e63cca186ef87e4601616be013421a8aad54 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 27 19:01:20 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:32:48 2016 +0200 cmOutputConverter: Remove now-obsolete Convert method diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index df68280..fdf0b0e 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -47,13 +47,6 @@ 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); diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index b433c18..4c52fe5 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -57,10 +57,6 @@ 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/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 26ac6a9..d952007 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -46,29 +46,6 @@ 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 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 35bb466..078b451 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -24,24 +24,6 @@ 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 - { - START_OUTPUT - }; enum OutputFormat { SHELL, @@ -50,10 +32,6 @@ 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; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=daf862ae62ad9c11e6352a02068922b42acf2919 commit daf862ae62ad9c11e6352a02068922b42acf2919 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 27 18:52:40 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:32:48 2016 +0200 Convert: Inline uses of START_OUTPUT diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 40f3e81..5dbe57c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1410,7 +1410,9 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, #endif // Normal behavior. - return this->Convert(lib, START_OUTPUT, format); + return this->ConvertToOutputFormat( + this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), lib), + format); } /** diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index f2a13bc..82e4d2c 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -500,8 +500,10 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher( const std::vector<std::string>& outputs = ccg.GetOutputs(); if (!outputs.empty()) { if (ccg.GetWorkingDirectory().empty()) { - output = this->Convert(outputs[0], cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + output = this->ConvertToOutputFormat( + this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), + outputs[0]), + cmOutputConverter::SHELL); } else { output = this->ConvertToOutputFormat(outputs[0], cmOutputConverter::SHELL); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 3f8dc17..23d1571 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1002,8 +1002,10 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( const std::vector<std::string>& outputs = ccg.GetOutputs(); if (!outputs.empty()) { if (workingDir.empty()) { - output = this->Convert(outputs[0], cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + output = this->ConvertToOutputFormat( + this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), + outputs[0]), + cmOutputConverter::SHELL); } else { output = this->ConvertToOutputFormat(outputs[0], @@ -1095,8 +1097,9 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand( fout << ")\n"; } std::string remove = "$(CMAKE_COMMAND) -P "; - remove += this->Convert(cleanfile, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + remove += this->ConvertToOutputFormat( + this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), cleanfile), + 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 d344dc5..77ec6f7 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -205,7 +205,9 @@ std::string cmLocalVisualStudioGenerator::ConstructScript( } if (workingDirectory.empty()) { - script += this->Convert(cmd.c_str(), START_OUTPUT, SHELL); + script += this->ConvertToOutputFormat( + this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), cmd), + cmOutputConverter::SHELL); } else { script += this->ConvertToOutputFormat(cmd.c_str(), SHELL); } diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index c1079a2..82bd1a3 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -138,14 +138,20 @@ 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->Convert( - targetFullPath, cmOutputConverter::START_OUTPUT, cmOutputConverter::SHELL); - std::string targetOutPathReal = - this->Convert(targetFullPathReal, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + 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 targetOutPathImport = - this->Convert(targetFullPathImport, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), + targetFullPathImport), + cmOutputConverter::SHELL); // Get the language to use for linking this executable. std::string linkLanguage = @@ -319,14 +325,19 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); - objectDir = this->Convert(objectDir, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + + objectDir = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir), + cmOutputConverter::SHELL); vars.ObjectDir = objectDir.c_str(); cmOutputConverter::OutputFormat output = (useWatcomQuote) ? cmOutputConverter::WATCOMQUOTE : cmOutputConverter::SHELL; - std::string target = this->Convert( - targetFullPathReal, cmOutputConverter::START_OUTPUT, output); + std::string target = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal), + output); vars.Target = target.c_str(); vars.TargetPDB = targetOutPathPDB.c_str(); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 8d90089..1d66d52 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -312,17 +312,25 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // arguments. std::string targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat( targetFullPathPDB, 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 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 targetOutPathImport = - this->Convert(targetFullPathImport, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), + targetFullPathImport), + cmOutputConverter::SHELL); this->NumberOfProgressActions++; if (!this->NoRuleMessages) { @@ -536,14 +544,20 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); - objectDir = this->Convert(objectDir, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + + objectDir = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir), + cmOutputConverter::SHELL); + vars.ObjectDir = objectDir.c_str(); cmOutputConverter::OutputFormat output = (useWatcomQuote) ? cmOutputConverter::WATCOMQUOTE : cmOutputConverter::SHELL; - std::string target = this->Convert( - targetFullPathReal, cmOutputConverter::START_OUTPUT, output); + std::string target = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal), + 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 5f39a85..014feb9 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -526,14 +526,17 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( } } - targetOutPathReal = - this->Convert(targetFullPathReal, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal), + cmOutputConverter::SHELL); targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat( targetFullPathPDB, cmOutputConverter::SHELL); - targetOutPathCompilePDB = - this->Convert(targetFullPathCompilePDB, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + targetOutPathCompilePDB = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), + targetFullPathCompilePDB), + cmOutputConverter::SHELL); if (this->LocalGenerator->IsMinGWMake() && cmHasLiteralSuffix(targetOutPathCompilePDB, "\\")) { @@ -555,12 +558,16 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( this->LocalGenerator->ConvertToOutputFormat(obj, cmOutputConverter::SHELL); vars.Object = shellObj.c_str(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); - objectDir = this->Convert(objectDir, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + objectDir = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir), + cmOutputConverter::SHELL); vars.ObjectDir = objectDir.c_str(); std::string objectFileDir = cmSystemTools::GetFilenamePath(obj); - objectFileDir = this->Convert(objectFileDir, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + objectFileDir = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), objectFileDir), + cmOutputConverter::SHELL); vars.ObjectFileDir = objectFileDir.c_str(); vars.Flags = flags.c_str(); @@ -1231,8 +1238,10 @@ public: void Feed(std::string const& obj) { // Construct the name of the next object. - this->NextObject = this->LocalGenerator->Convert( - obj, cmOutputConverter::START_OUTPUT, cmOutputConverter::RESPONSE); + this->NextObject = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), obj), + cmOutputConverter::RESPONSE); // Roll over to next string if the limit will be exceeded. if (this->LengthLimit != std::string::npos && @@ -1474,8 +1483,10 @@ 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->Convert( - linkScriptName, cmOutputConverter::START_OUTPUT, cmOutputConverter::SHELL); + link_command += this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), linkScriptName), + cmOutputConverter::SHELL); link_command += " --verbose=$(VERBOSE)"; makefile_commands.push_back(link_command); makefile_depends.push_back(linkScriptName); @@ -1506,9 +1517,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 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. + // 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. size_t length = 0; for (std::vector<std::string>::const_iterator i = this->Objects.begin(); i != this->Objects.end(); ++i) { @@ -1709,13 +1720,17 @@ void cmMakefileTargetGenerator::GenDefFile( cmd = this->LocalGenerator->ConvertToOutputFormat( cmd, cmOutputConverter::SHELL); cmd += " -E __create_def "; - cmd += this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + cmd += this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file), + cmOutputConverter::SHELL); cmd += " "; std::string objlist_file = name_of_def_file; objlist_file += ".objs"; - cmd += this->Convert(objlist_file, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + cmd += this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), objlist_file), + 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()); @@ -1733,9 +1748,10 @@ void cmMakefileTargetGenerator::GenDefFile( // now add the def file link flag linkFlags += " "; linkFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); - linkFlags += - this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); + linkFlags += this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file), + cmOutputConverter::SHELL); linkFlags += " "; } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2ad43682e3f665a59e54746d039a7577b976ca6f commit 2ad43682e3f665a59e54746d039a7577b976ca6f Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 27 18:41:42 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:32:48 2016 +0200 Convert: Remove HOME_OUTPUT enum value diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index e7b7cd3..26ac6a9 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -52,9 +52,6 @@ std::string cmOutputConverter::ConvertToRelativePath( std::string result; switch (relative) { - case HOME_OUTPUT: - result = this->GetState()->GetBinaryDirectory(); - break; case START_OUTPUT: result = this->StateSnapshot.GetDirectory().GetCurrentBinary(); break; diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 86fcf12..35bb466 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -40,7 +40,6 @@ public: */ enum RelativeRoot { - HOME_OUTPUT, START_OUTPUT }; enum OutputFormat https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95ac2339588d0d16f21327c16b098f4c54b5d67b commit 95ac2339588d0d16f21327c16b098f4c54b5d67b Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 27 18:40:45 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:32:47 2016 +0200 Ninja: Update comment variable reference diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 335b552..5c32e00 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -642,7 +642,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } } } - // If we have any PRE_LINK commands, we need to go back to HOME_OUTPUT for + // If we have any PRE_LINK commands, we need to go back to CMAKE_BINARY_DIR + // for // the link commands. if (!preLinkCmdLines.empty()) { const std::string homeOutDir = localGen.ConvertToOutputFormat( https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bcab65ad983297e1455f43ea9e06f38170e9bb75 commit bcab65ad983297e1455f43ea9e06f38170e9bb75 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Wed Sep 7 23:31:04 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:32:47 2016 +0200 Convert: Move access to BinaryDirectory out of loops diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 9fb4221..ba0617f 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -429,16 +429,14 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, modFile += "/"; modFile += *i; modFile = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetBinaryDirectory(), modFile), + this->LocalGenerator->ConvertToRelativePath(binDir, modFile), cmOutputConverter::SHELL); std::string stampFile = stamp_dir; stampFile += "/"; stampFile += m; stampFile += ".mod.stamp"; stampFile = this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetBinaryDirectory(), stampFile), + this->LocalGenerator->ConvertToRelativePath(binDir, stampFile), cmOutputConverter::SHELL); makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod " << modFile << " " << stampFile; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index cdf4330..5f39a85 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -900,13 +900,13 @@ 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( - this->LocalGenerator->GetBinaryDirectory(), *o), + this->LocalGenerator->ConvertToRelativePath(binDir, *o), cmOutputConverter::SHELL); std::vector<std::string> output_commands; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aab066a87b18d6ca2be47fbd5c2a6b8dd8e287a9 commit aab066a87b18d6ca2be47fbd5c2a6b8dd8e287a9 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 27 18:20:37 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:32:47 2016 +0200 Convert: Inline uses of HOME_OUTPUT diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index d7e2c33..9fb4221 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -428,14 +428,18 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, std::string modFile = mod_dir; modFile += "/"; modFile += *i; - modFile = this->LocalGenerator->Convert( - modFile, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::SHELL); + modFile = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetBinaryDirectory(), modFile), + cmOutputConverter::SHELL); std::string stampFile = stamp_dir; stampFile += "/"; stampFile += m; stampFile += ".mod.stamp"; - stampFile = this->LocalGenerator->Convert( - stampFile, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::SHELL); + stampFile = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetBinaryDirectory(), stampFile), + cmOutputConverter::SHELL); makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod " << modFile << " " << stampFile; cmMakefile* mf = this->LocalGenerator->GetMakefile(); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 94f4929..f2a13bc 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -145,7 +145,8 @@ std::string cmLocalNinjaGenerator::ConvertToIncludeReference( return this->ConvertToOutputFormat(cmSystemTools::CollapseFullPath(path), format); } - return this->Convert(path, cmOutputConverter::HOME_OUTPUT, format); + return this->ConvertToOutputFormat( + this->ConvertToRelativePath(this->GetBinaryDirectory(), path), format); } // Private methods. diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 9809be6..cdf4330 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -904,8 +904,10 @@ bool cmMakefileTargetGenerator::WriteMakeRule( 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->Convert(*o, cmOutputConverter::HOME_OUTPUT, - cmOutputConverter::SHELL); + std::string const out = this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetBinaryDirectory(), *o), + cmOutputConverter::SHELL); std::vector<std::string> output_commands; bool o_symbolic = false; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ca466374c54031b22018519868d70c9e917df8d1 commit ca466374c54031b22018519868d70c9e917df8d1 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 27 18:32:49 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:32:47 2016 +0200 Common: Use a string instead of enum for WorkingDirectory diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 6167e2c..df68280 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -204,8 +204,9 @@ 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->Convert( - (*mi)->GetFullPath(), this->LocalGenerator->GetWorkingDirectory(), + manifests.push_back(this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->ConvertToRelativePath( + this->LocalGenerator->GetWorkingDirectory(), (*mi)->GetFullPath()), cmOutputConverter::SHELL)); } diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index 0e79293..97323c9 100644 --- a/Source/cmLocalCommonGenerator.cxx +++ b/Source/cmLocalCommonGenerator.cxx @@ -18,8 +18,9 @@ class cmGlobalGenerator; -cmLocalCommonGenerator::cmLocalCommonGenerator( - cmGlobalGenerator* gg, cmMakefile* mf, cmOutputConverter::RelativeRoot wd) +cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg, + cmMakefile* mf, + std::string const& wd) : cmLocalGenerator(gg, mf) , WorkingDirectory(wd) { @@ -55,8 +56,9 @@ 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->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL); + mod_dir = this->ConvertToOutputFormat( + this->ConvertToRelativePath(this->WorkingDirectory, mod_dir), + cmOutputConverter::SHELL); } else { mod_dir = this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index 9012afd..9454739 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -30,21 +30,18 @@ class cmLocalCommonGenerator : public cmLocalGenerator { public: cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf, - cmOutputConverter::RelativeRoot wd); + std::string const& wd); ~cmLocalCommonGenerator() CM_OVERRIDE; std::string const& GetConfigName() { return this->ConfigName; } - cmOutputConverter::RelativeRoot GetWorkingDirectory() const - { - return this->WorkingDirectory; - } + std::string GetWorkingDirectory() const { return this->WorkingDirectory; } std::string GetTargetFortranFlags(cmGeneratorTarget const* target, std::string const& config) CM_OVERRIDE; protected: - cmOutputConverter::RelativeRoot WorkingDirectory; + std::string WorkingDirectory; void SetConfigName(); std::string ConfigName; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index f651c6e..94f4929 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -34,7 +34,7 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmMakefile* mf) - : cmLocalCommonGenerator(gg, mf, cmOutputConverter::HOME_OUTPUT) + : cmLocalCommonGenerator(gg, mf, mf->GetState()->GetBinaryDirectory()) , HomeRelativeOutputPath("") { this->TargetImplib = "$TARGET_IMPLIB"; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 6fd319e..3f8dc17 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, cmOutputConverter::START_OUTPUT) + : cmLocalCommonGenerator(gg, mf, mf->GetCurrentBinaryDirectory()) { this->MakefileVariableSize = 0; this->ColorMakefile = false; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e9c972fc2cc3d4338890a5e4528bfd7a8b22fc1 commit 0e9c972fc2cc3d4338890a5e4528bfd7a8b22fc1 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 27 13:48:57 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:32:47 2016 +0200 Convert: Simplify switch Make it more clear what is happening here. diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index b890a76..e7b7cd3 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -53,15 +53,14 @@ std::string cmOutputConverter::ConvertToRelativePath( switch (relative) { case HOME_OUTPUT: - result = this->ConvertToRelativePath( - this->GetState()->GetBinaryDirectory(), source); + result = this->GetState()->GetBinaryDirectory(); break; case START_OUTPUT: - result = this->ConvertToRelativePath( - this->StateSnapshot.GetDirectory().GetCurrentBinary(), source); + result = this->StateSnapshot.GetDirectory().GetCurrentBinary(); break; } - return result; + + return this->ConvertToRelativePath(result, source); } std::string cmOutputConverter::Convert(const std::string& source, https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ce2c74c4783f0de4493268c27b3aecd5ddecb135 commit ce2c74c4783f0de4493268c27b3aecd5ddecb135 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 27 18:10:25 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:32:47 2016 +0200 Convert: Remove obsolete MAKERULE enum value diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 200bc83..b890a76 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -78,9 +78,7 @@ std::string cmOutputConverter::ConvertToOutputFormat(const std::string& source, { std::string result = source; // Convert it to an output path. - if (output == MAKERULE) { - result = cmSystemTools::ConvertToOutputPath(result.c_str()); - } else if (output == SHELL || output == WATCOMQUOTE) { + if (output == SHELL || output == WATCOMQUOTE) { result = this->ConvertDirectorySeparatorsForShell(source); result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE); } else if (output == RESPONSE) { diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 5ebd8ee..86fcf12 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -45,7 +45,6 @@ public: }; enum OutputFormat { - MAKERULE, SHELL, WATCOMQUOTE, RESPONSE https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f1f8f6299a8f7e05e839573b5f1ae4ce1ad1ea2 commit 6f1f8f6299a8f7e05e839573b5f1ae4ce1ad1ea2 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Wed Sep 7 23:14:30 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:32:47 2016 +0200 Convert: Move access to BinaryDirectory out of loops diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 48a32f1..3296ffc 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -239,20 +239,18 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, // written by the original local generator for this directory // convert the dependencies to paths relative to the home output // directory. We must do the same here. - std::string obj_i = this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetBinaryDirectory(), obj); + std::string binDir = this->LocalGenerator->GetBinaryDirectory(); + std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj); std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i.c_str()); internalDepends << obj_i << std::endl; for (std::set<std::string>::const_iterator i = dependencies.begin(); i != dependencies.end(); ++i) { - makeDepends << obj_m << ": " - << cmSystemTools::ConvertToOutputPath( - this->LocalGenerator - ->ConvertToRelativePath( - this->LocalGenerator->GetBinaryDirectory(), *i) - .c_str()) - << std::endl; + makeDepends + << obj_m << ": " + << cmSystemTools::ConvertToOutputPath( + this->LocalGenerator->ConvertToRelativePath(binDir, *i).c_str()) + << std::endl; internalDepends << " " << *i << std::endl; } makeDepends << std::endl; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 8317534..d7e2c33 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -331,20 +331,18 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, const char* src = info.Source.c_str(); // Write the include dependencies to the output stream. - std::string obj_i = this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetBinaryDirectory(), obj); + std::string binDir = this->LocalGenerator->GetBinaryDirectory(); + std::string obj_i = this->LocalGenerator->ConvertToRelativePath(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( - this->LocalGenerator->GetBinaryDirectory(), *i) - .c_str()) - << std::endl; + makeDepends + << obj_m << ": " + << cmSystemTools::ConvertToOutputPath( + this->LocalGenerator->ConvertToRelativePath(binDir, *i).c_str()) + << std::endl; internalDepends << " " << *i << std::endl; } makeDepends << std::endl; @@ -370,10 +368,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, proxy += *i; proxy += ".mod.proxy"; proxy = cmSystemTools::ConvertToOutputPath( - this->LocalGenerator - ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(), - proxy) - .c_str()); + this->LocalGenerator->ConvertToRelativePath(binDir, proxy).c_str()); // since we require some things add them to our list of requirements makeDepends << obj_m << ".requires: " << proxy << std::endl; @@ -389,9 +384,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(this->LocalGenerator->GetBinaryDirectory(), - required->second) + this->LocalGenerator->ConvertToRelativePath(binDir, required->second) .c_str()); makeDepends << obj_m << ": " << stampFile << "\n"; } else { @@ -400,10 +393,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, std::string module; if (this->FindModule(*i, module)) { module = cmSystemTools::ConvertToOutputPath( - this->LocalGenerator - ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(), - module) - .c_str()); + this->LocalGenerator->ConvertToRelativePath(binDir, module).c_str()); makeDepends << obj_m << ": " << module << "\n"; } } @@ -417,10 +407,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, proxy += *i; proxy += ".mod.proxy"; proxy = cmSystemTools::ConvertToOutputPath( - this->LocalGenerator - ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(), - proxy) - .c_str()); + this->LocalGenerator->ConvertToRelativePath(binDir, proxy).c_str()); makeDepends << proxy << ": " << obj_m << ".provides" << std::endl; } @@ -468,10 +455,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, std::string driver = this->TargetDirectory; driver += "/build"; driver = cmSystemTools::ConvertToOutputPath( - this->LocalGenerator - ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(), - driver) - .c_str()); + this->LocalGenerator->ConvertToRelativePath(binDir, driver).c_str()); makeDepends << driver << ": " << obj_m << ".provides.build\n"; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 59dc445..6fd319e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -581,12 +581,12 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule( } else { // Split dependencies into multiple rule lines. This allows for // very long dependency lists even on older make implementations. + std::string binDir = this->GetBinaryDirectory(); for (std::vector<std::string>::const_iterator dep = depends.begin(); dep != depends.end(); ++dep) { replace = *dep; replace = cmSystemTools::ConvertToOutputPath( - this->ConvertToRelativePath(this->GetBinaryDirectory(), replace) - .c_str()); + this->ConvertToRelativePath(binDir, replace).c_str()); os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n"; } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8e1d9db85bd462c8226550f4bea988ff6b220ac5 commit 8e1d9db85bd462c8226550f4bea988ff6b220ac5 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 27 18:09:04 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:32:46 2016 +0200 Convert: Inline HOME_OUTPUT MAKERULE conversion diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 619106f..48a32f1 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -247,9 +247,11 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, for (std::set<std::string>::const_iterator i = dependencies.begin(); i != dependencies.end(); ++i) { makeDepends << obj_m << ": " - << this->LocalGenerator->Convert( - *i, cmOutputConverter::HOME_OUTPUT, - cmOutputConverter::MAKERULE) + << cmSystemTools::ConvertToOutputPath( + this->LocalGenerator + ->ConvertToRelativePath( + this->LocalGenerator->GetBinaryDirectory(), *i) + .c_str()) << std::endl; internalDepends << " " << *i << std::endl; } diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 4a4acce..8317534 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -339,9 +339,11 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, for (std::set<std::string>::const_iterator i = info.Includes.begin(); i != info.Includes.end(); ++i) { makeDepends << obj_m << ": " - << this->LocalGenerator->Convert( - *i, cmOutputConverter::HOME_OUTPUT, - cmOutputConverter::MAKERULE) + << cmSystemTools::ConvertToOutputPath( + this->LocalGenerator + ->ConvertToRelativePath( + this->LocalGenerator->GetBinaryDirectory(), *i) + .c_str()) << std::endl; internalDepends << " " << *i << std::endl; } @@ -367,8 +369,11 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, proxy += "/"; proxy += *i; proxy += ".mod.proxy"; - proxy = this->LocalGenerator->Convert( - proxy, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE); + proxy = cmSystemTools::ConvertToOutputPath( + this->LocalGenerator + ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(), + proxy) + .c_str()); // since we require some things add them to our list of requirements makeDepends << obj_m << ".requires: " << proxy << std::endl; @@ -383,17 +388,22 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, } if (!required->second.empty()) { // This module is known. Depend on its timestamp file. - std::string stampFile = this->LocalGenerator->Convert( - required->second, cmOutputConverter::HOME_OUTPUT, - cmOutputConverter::MAKERULE); + std::string stampFile = cmSystemTools::ConvertToOutputPath( + this->LocalGenerator + ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(), + required->second) + .c_str()); makeDepends << obj_m << ": " << stampFile << "\n"; } else { // This module is not known to CMake. Try to locate it where // the compiler will and depend on that. std::string module; if (this->FindModule(*i, module)) { - module = this->LocalGenerator->Convert( - module, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE); + module = cmSystemTools::ConvertToOutputPath( + this->LocalGenerator + ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(), + module) + .c_str()); makeDepends << obj_m << ": " << module << "\n"; } } @@ -406,8 +416,11 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, proxy += "/"; proxy += *i; proxy += ".mod.proxy"; - proxy = this->LocalGenerator->Convert( - proxy, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE); + proxy = cmSystemTools::ConvertToOutputPath( + this->LocalGenerator + ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(), + proxy) + .c_str()); makeDepends << proxy << ": " << obj_m << ".provides" << std::endl; } @@ -454,8 +467,11 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, // the target finishes building. std::string driver = this->TargetDirectory; driver += "/build"; - driver = this->LocalGenerator->Convert( - driver, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE); + driver = cmSystemTools::ConvertToOutputPath( + this->LocalGenerator + ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(), + driver) + .c_str()); makeDepends << driver << ": " << obj_m << ".provides.build\n"; } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index c17eb23..52ae469 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -480,9 +480,10 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2( } // Begin the directory-level rules section. - std::string dir = lg->GetCurrentBinaryDirectory(); - dir = lg->Convert(dir, cmOutputConverter::HOME_OUTPUT, - cmOutputConverter::MAKERULE); + std::string dir = cmSystemTools::ConvertToOutputPath( + lg->ConvertToRelativePath(lg->GetBinaryDirectory(), + lg->GetCurrentBinaryDirectory()) + .c_str()); lg->WriteDivider(ruleFileStream); ruleFileStream << "# Directory level rules for directory " << dir << "\n\n"; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 697d856..59dc445 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -556,8 +556,8 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule( } // Construct the left hand side of the rule. - std::string tgt = this->Convert(target, cmOutputConverter::HOME_OUTPUT, - cmOutputConverter::MAKERULE); + std::string tgt = cmSystemTools::ConvertToOutputPath( + this->ConvertToRelativePath(this->GetBinaryDirectory(), target).c_str()); const char* space = ""; if (tgt.size() == 1) { @@ -584,8 +584,9 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule( for (std::vector<std::string>::const_iterator dep = depends.begin(); dep != depends.end(); ++dep) { replace = *dep; - replace = this->Convert(replace, cmOutputConverter::HOME_OUTPUT, - cmOutputConverter::MAKERULE); + replace = cmSystemTools::ConvertToOutputPath( + this->ConvertToRelativePath(this->GetBinaryDirectory(), replace) + .c_str()); os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n"; } } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index fc5af4a..9809be6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -216,8 +216,11 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() *this->BuildFileStream << "# Include any dependencies generated for this target.\n" << this->GlobalGenerator->IncludeDirective << " " << root - << this->Convert(dependFileNameFull, cmOutputConverter::HOME_OUTPUT, - cmOutputConverter::MAKERULE) + << cmSystemTools::ConvertToOutputPath( + this->LocalGenerator + ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(), + dependFileNameFull) + .c_str()) << "\n\n"; if (!this->NoRuleMessages) { @@ -225,9 +228,12 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() *this->BuildFileStream << "# Include the progress variables for this target.\n" << this->GlobalGenerator->IncludeDirective << " " << root - << this->Convert(this->ProgressFileNameFull, - cmOutputConverter::HOME_OUTPUT, - cmOutputConverter::MAKERULE) + << cmSystemTools::ConvertToOutputPath( + this->LocalGenerator + ->ConvertToRelativePath( + this->LocalGenerator->GetBinaryDirectory(), + this->ProgressFileNameFull) + .c_str()) << "\n\n"; } @@ -257,8 +263,11 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() *this->BuildFileStream << "# Include the compile flags for this target's objects.\n" << this->GlobalGenerator->IncludeDirective << " " << root - << this->Convert(this->FlagFileNameFull, cmOutputConverter::HOME_OUTPUT, - cmOutputConverter::MAKERULE) + << cmSystemTools::ConvertToOutputPath( + this->LocalGenerator + ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(), + this->FlagFileNameFull) + .c_str()) << "\n\n"; } diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index b709545..8bf0a23 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -53,9 +53,12 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() *this->BuildFileStream << "# Include the progress variables for this target.\n" << this->GlobalGenerator->IncludeDirective << " " << root - << this->Convert(this->ProgressFileNameFull, - cmOutputConverter::HOME_OUTPUT, - cmOutputConverter::MAKERULE) + << cmSystemTools::ConvertToOutputPath( + this->LocalGenerator + ->ConvertToRelativePath( + this->LocalGenerator->GetBinaryDirectory(), + this->ProgressFileNameFull) + .c_str()) << "\n\n"; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c282b12f815a95135c2347f022263efcdea1544b commit c282b12f815a95135c2347f022263efcdea1544b Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 27 13:50:30 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:32:46 2016 +0200 Convert: Inline MAKERULE conversions This is a trivial use of a static method. diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index bc71aac..619106f 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -241,8 +241,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, // directory. We must do the same here. std::string obj_i = this->LocalGenerator->ConvertToRelativePath( this->LocalGenerator->GetBinaryDirectory(), obj); - std::string obj_m = this->LocalGenerator->ConvertToOutputFormat( - obj_i, cmOutputConverter::MAKERULE); + std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i.c_str()); internalDepends << obj_i << std::endl; for (std::set<std::string>::const_iterator i = dependencies.begin(); diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 925e385..4a4acce 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -333,8 +333,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, // Write the include dependencies to the output stream. std::string obj_i = this->LocalGenerator->ConvertToRelativePath( this->LocalGenerator->GetBinaryDirectory(), obj); - std::string obj_m = this->LocalGenerator->ConvertToOutputFormat( - obj_i, cmOutputConverter::MAKERULE); + 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(); diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx index 96080a9..d5c2fee 100644 --- a/Source/cmExportBuildAndroidMKGenerator.cxx +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -48,8 +48,7 @@ void cmExportBuildAndroidMKGenerator::GenerateImportTargetCode( os << "LOCAL_MODULE := "; os << targetName << "\n"; os << "LOCAL_SRC_FILES := "; - std::string path = target->GetLocalGenerator()->ConvertToOutputFormat( - target->GetFullPath(), cmOutputConverter::MAKERULE); + std::string path = cmSystemTools::ConvertToOutputPath(target->GetFullPath().c_str()); os << path << "\n"; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=257265241a791b96a219133d0eba22b9e2b71468 commit 257265241a791b96a219133d0eba22b9e2b71468 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Sep 6 23:29:01 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:29:51 2016 +0200 Convert: Move access to BinaryDirectory out of loops diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index d1be0c7..61f2851 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -914,7 +914,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const const std::vector<cmGeneratorTarget*> targets = (*it)->GetGeneratorTargets(); std::string subdir = (*it)->ConvertToRelativePath( - (*it)->GetBinaryDirectory(), (*it)->GetCurrentBinaryDirectory()); + this->HomeOutputDirectory, (*it)->GetCurrentBinaryDirectory()); if (subdir == ".") { subdir = ""; } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 5438375..c17eb23 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -347,6 +347,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() << "\"\n"; cmakefileStream << " )\n\n"; + const std::string binDir = lg->GetBinaryDirectory(); + // CMake must rerun if a byproduct is missing. { cmakefileStream << "# Byproducts of CMake generate step:\n" @@ -355,9 +357,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() lg->GetMakefile()->GetOutputFiles(); for (std::vector<std::string>::const_iterator k = outfiles.begin(); k != outfiles.end(); ++k) { - cmakefileStream << " \"" - << lg->ConvertToRelativePath(lg->GetBinaryDirectory(), - *k) + cmakefileStream << " \"" << lg->ConvertToRelativePath(binDir, *k) << "\"\n"; } @@ -369,9 +369,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() tmpStr = lg->GetCurrentBinaryDirectory(); tmpStr += cmake::GetCMakeFilesDirectory(); tmpStr += "/CMakeDirectoryInformation.cmake"; - cmakefileStream << " \"" - << lg->ConvertToRelativePath(lg->GetBinaryDirectory(), - tmpStr) + cmakefileStream << " \"" << lg->ConvertToRelativePath(binDir, tmpStr) << "\"\n"; } cmakefileStream << " )\n\n"; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 6d2dac2..697d856 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1853,9 +1853,9 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo( const std::string& config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); this->GetIncludeDirectories(includes, target, l->first, config); + std::string binaryDir = this->GetState()->GetBinaryDirectory(); if (this->Makefile->IsOn("CMAKE_DEPENDS_IN_PROJECT_ONLY")) { const char* sourceDir = this->GetState()->GetSourceDirectory(); - const char* binaryDir = this->GetState()->GetBinaryDirectory(); std::vector<std::string>::iterator itr = std::remove_if(includes.begin(), includes.end(), ::NotInProjectDir(sourceDir, binaryDir)); @@ -1863,9 +1863,7 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo( } for (std::vector<std::string>::iterator i = includes.begin(); i != includes.end(); ++i) { - cmakefileStream << " \"" - << this->ConvertToRelativePath( - this->GetBinaryDirectory(), *i) + cmakefileStream << " \"" << this->ConvertToRelativePath(binaryDir, *i) << "\"\n"; } cmakefileStream << " )\n"; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8f4b0756bd6bd8e5a1a6055af373972abf66de54 commit 8f4b0756bd6bd8e5a1a6055af373972abf66de54 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Sep 6 23:02:23 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:29:50 2016 +0200 Convert: Avoid HOME_OUTPUT enum when converting to relative paths diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index fbbf42f..bc71aac 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -240,7 +240,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, // convert the dependencies to paths relative to the home output // directory. We must do the same here. std::string obj_i = this->LocalGenerator->ConvertToRelativePath( - obj, cmOutputConverter::HOME_OUTPUT); + this->LocalGenerator->GetBinaryDirectory(), obj); std::string obj_m = this->LocalGenerator->ConvertToOutputFormat( obj_i, cmOutputConverter::MAKERULE); internalDepends << obj_i << std::endl; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 44592bb..925e385 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -332,7 +332,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, // Write the include dependencies to the output stream. std::string obj_i = this->LocalGenerator->ConvertToRelativePath( - obj, cmOutputConverter::HOME_OUTPUT); + this->LocalGenerator->GetBinaryDirectory(), obj); std::string obj_m = this->LocalGenerator->ConvertToOutputFormat( obj_i, cmOutputConverter::MAKERULE); internalDepends << obj_i << std::endl; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 5a98e34..d1be0c7 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -914,7 +914,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const const std::vector<cmGeneratorTarget*> targets = (*it)->GetGeneratorTargets(); std::string subdir = (*it)->ConvertToRelativePath( - (*it)->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT); + (*it)->GetBinaryDirectory(), (*it)->GetCurrentBinaryDirectory()); if (subdir == ".") { subdir = ""; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 64c9870..2ea2990 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2578,7 +2578,7 @@ void cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs, // Shorten the output name (in expected use case). cmOutputConverter converter(this->GetMakefiles()[0]->GetStateSnapshot()); std::string fname = converter.ConvertToRelativePath( - outputs[0], cmOutputConverter::HOME_OUTPUT); + this->GetMakefiles()[0]->GetState()->GetBinaryDirectory(), outputs[0]); // Associate the hash with this output. this->RuleHashes[fname] = hash; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 7e343c9..bd65366 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -760,8 +760,8 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path) { cmLocalNinjaGenerator* ng = static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]); - std::string convPath = - ng->ConvertToRelativePath(path, cmOutputConverter::HOME_OUTPUT); + std::string convPath = ng->ConvertToRelativePath( + this->LocalGenerators[0]->GetState()->GetBinaryDirectory(), path); convPath = this->NinjaOutputPath(convPath); #ifdef _WIN32 std::replace(convPath.begin(), convPath.end(), '/', '\\'); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index caf71fd..5438375 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -356,8 +356,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() for (std::vector<std::string>::const_iterator k = outfiles.begin(); k != outfiles.end(); ++k) { cmakefileStream << " \"" - << lg->ConvertToRelativePath( - *k, cmOutputConverter::HOME_OUTPUT) + << lg->ConvertToRelativePath(lg->GetBinaryDirectory(), + *k) << "\"\n"; } @@ -370,8 +370,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() tmpStr += cmake::GetCMakeFilesDirectory(); tmpStr += "/CMakeDirectoryInformation.cmake"; cmakefileStream << " \"" - << lg->ConvertToRelativePath( - tmpStr, cmOutputConverter::HOME_OUTPUT) + << lg->ConvertToRelativePath(lg->GetBinaryDirectory(), + tmpStr) << "\"\n"; } cmakefileStream << " )\n\n"; @@ -532,7 +532,8 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( tname += "/fast"; } cmOutputConverter conv(mf->GetStateSnapshot()); - tname = conv.ConvertToRelativePath(tname, cmOutputConverter::HOME_OUTPUT); + tname = + conv.ConvertToRelativePath(mf->GetState()->GetBinaryDirectory(), tname); cmSystemTools::ConvertToOutputSlashes(tname); makeCommand.push_back(tname); if (this->Makefiles.empty()) { diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 6793f84..f651c6e 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -51,7 +51,7 @@ void cmLocalNinjaGenerator::Generate() // Compute the path to use when referencing the current output // directory from the top output directory. this->HomeRelativeOutputPath = this->ConvertToRelativePath( - this->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT); + this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); if (this->HomeRelativeOutputPath == ".") { this->HomeRelativeOutputPath = ""; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9d3567e..6d2dac2 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -151,7 +151,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->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT); + this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); if (this->HomeRelativeOutputPath == ".") { this->HomeRelativeOutputPath = ""; } @@ -1865,7 +1865,7 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo( i != includes.end(); ++i) { cmakefileStream << " \"" << this->ConvertToRelativePath( - *i, cmOutputConverter::HOME_OUTPUT) + this->GetBinaryDirectory(), *i) << "\"\n"; } cmakefileStream << " )\n"; @@ -1930,7 +1930,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(tgt, cmOutputConverter::HOME_OUTPUT); + this->ConvertToRelativePath(this->GetBinaryDirectory(), tgt); // The target may have been written with windows paths. cmSystemTools::ConvertToOutputSlashes(tgt2); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index df06dc1..fc5af4a 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -317,7 +317,7 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()( this->Generator->LocalGenerator->ConvertToRelativePath( this->Generator->LocalGenerator->GetCurrentBinaryDirectory(), output)); output = this->Generator->LocalGenerator->ConvertToRelativePath( - output, cmOutputConverter::HOME_OUTPUT); + this->Generator->LocalGenerator->GetBinaryDirectory(), output); // Create a rule to copy the content into the bundle. std::vector<std::string> depends; @@ -1275,7 +1275,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule( std::string buildTargetRuleName = dir; buildTargetRuleName += relink ? "/preinstall" : "/build"; buildTargetRuleName = this->LocalGenerator->ConvertToRelativePath( - buildTargetRuleName, cmOutputConverter::HOME_OUTPUT); + this->LocalGenerator->GetBinaryDirectory(), buildTargetRuleName); // Build the list of target outputs to drive. std::vector<std::string> depends; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b25b70e36e2620b4e8480af62fb7d77babff59a4 commit b25b70e36e2620b4e8480af62fb7d77babff59a4 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Sep 6 23:52:42 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:29:50 2016 +0200 Convert: Move access to CurrentBinaryDirectory out of loops diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index eed31fa..44592bb 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -189,6 +189,8 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, cmGeneratedFileStream fcStream(fcName.c_str()); fcStream << "# Remove fortran modules provided by this target.\n"; fcStream << "FILE(REMOVE"; + std::string currentBinDir = + this->LocalGenerator->GetCurrentBinaryDirectory(); for (std::set<std::string>::const_iterator i = provides.begin(); i != provides.end(); ++i) { std::string mod_upper = mod_dir; @@ -205,18 +207,16 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, stamp += ".mod.stamp"; fcStream << "\n"; fcStream << " \"" - << this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), - mod_lower) + << this->LocalGenerator->ConvertToRelativePath(currentBinDir, + mod_lower) << "\"\n"; fcStream << " \"" - << this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), - mod_upper) + << this->LocalGenerator->ConvertToRelativePath(currentBinDir, + mod_upper) << "\"\n"; fcStream << " \"" - << this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), stamp) + << this->LocalGenerator->ConvertToRelativePath(currentBinDir, + stamp) << "\"\n"; } fcStream << " )\n"; diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 9443b0a..caf71fd 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -319,18 +319,15 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() 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(lg->GetCurrentBinaryDirectory(), cache) - << "\"\n"; + << " \"" << lg->ConvertToRelativePath(currentBinDir, cache) << "\"\n"; for (std::vector<std::string>::const_iterator i = lfiles.begin(); i != lfiles.end(); ++i) { - cmakefileStream << " \"" - << lg->ConvertToRelativePath( - lg->GetCurrentBinaryDirectory(), *i) + cmakefileStream << " \"" << lg->ConvertToRelativePath(currentBinDir, *i) << "\"\n"; } cmakefileStream << " )\n\n"; @@ -344,12 +341,9 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() cmakefileStream << "# The corresponding makefile is:\n" << "set(CMAKE_MAKEFILE_OUTPUTS\n" << " \"" - << lg->ConvertToRelativePath(lg->GetCurrentBinaryDirectory(), - makefileName) + << lg->ConvertToRelativePath(currentBinDir, makefileName) << "\"\n" - << " \"" - << lg->ConvertToRelativePath(lg->GetCurrentBinaryDirectory(), - check) + << " \"" << lg->ConvertToRelativePath(currentBinDir, check) << "\"\n"; cmakefileStream << " )\n\n"; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index ed41e60..7664b02 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -382,6 +382,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( { VisualStudioFolders.clear(); + std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { cmGeneratorTarget const* target = *tt; @@ -405,8 +406,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( if (vcprojName) { cmLocalGenerator* lg = target->GetLocalGenerator(); std::string dir = lg->GetCurrentBinaryDirectory(); - dir = root->ConvertToRelativePath(root->GetCurrentBinaryDirectory(), - dir.c_str()); + dir = root->ConvertToRelativePath(rootBinaryDir, dir.c_str()); if (dir == ".") { dir = ""; // msbuild cannot handle ".\" prefix } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 774e328..40f3e81 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -177,10 +177,11 @@ void cmLocalGenerator::GenerateTestFiles() } typedef std::vector<cmState::Snapshot> vec_t; vec_t const& children = this->Makefile->GetStateSnapshot().GetChildren(); + std::string parentBinDir = this->GetCurrentBinaryDirectory(); for (vec_t::const_iterator i = children.begin(); i != children.end(); ++i) { // TODO: Use add_subdirectory instead? std::string outP = i->GetDirectory().GetCurrentBinary(); - outP = this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), + outP = this->ConvertToRelativePath(parentBinDir, outP); outP = cmOutputConverter::EscapeForCMake(outP); fout << "subdirs(" << outP << ")" << std::endl; @@ -2243,11 +2244,11 @@ std::string cmLocalGenerator::ConstructComment( std::string comment; comment = "Generating "; const char* sep = ""; + std::string currentBinaryDir = this->GetCurrentBinaryDirectory(); for (std::vector<std::string>::const_iterator o = ccg.GetOutputs().begin(); o != ccg.GetOutputs().end(); ++o) { comment += sep; - comment += - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), *o); + comment += this->ConvertToRelativePath(currentBinaryDir, *o); sep = ", "; } return comment; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 2b22f49..9d3567e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -952,6 +952,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( // Add each command line to the set of commands. std::vector<std::string> commands1; + std::string currentBinDir = this->GetCurrentBinaryDirectory(); for (unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c) { // Build the command line in a single string. std::string cmd = ccg.GetCommand(c); @@ -976,8 +977,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(this->GetCurrentBinaryDirectory(), cmd); + cmd = this->ConvertToRelativePath(currentBinDir, cmd); } bool has_slash = cmd.find('/') != cmd.npos; if (had_slash && !has_slash) { @@ -1069,7 +1069,8 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand( std::vector<std::string>& commands, const std::vector<std::string>& files, cmGeneratorTarget* target, const char* filename) { - std::string cleanfile = this->GetCurrentBinaryDirectory(); + std::string currentBinDir = this->GetCurrentBinaryDirectory(); + std::string cleanfile = currentBinDir; cleanfile += "/"; cleanfile += this->GetTargetDirectory(target); cleanfile += "/cmake_clean"; @@ -1087,8 +1088,7 @@ 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(this->GetCurrentBinaryDirectory(), *f); + std::string fc = this->ConvertToRelativePath(currentBinDir, *f); fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n"; } fout << ")\n"; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 9cc1b7e..f477a0e 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1298,10 +1298,11 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries( std::ostream& fout, ItemVector const& libs) { cmLocalVisualStudio7Generator* lg = this->LocalGenerator; + std::string currentBinDir = lg->GetCurrentBinaryDirectory(); for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) { if (l->IsPath) { - std::string rel = lg->ConvertToRelativePath( - lg->GetCurrentBinaryDirectory(), l->Value.c_str()); + std::string rel = + lg->ConvertToRelativePath(currentBinDir, l->Value.c_str()); fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " "; } else if (!l->Target || l->Target->GetType() != cmState::INTERFACE_LIBRARY) { @@ -1316,13 +1317,13 @@ void cmLocalVisualStudio7GeneratorInternals::OutputObjects( // VS < 8 does not support per-config source locations so we // list object library content on the link line instead. cmLocalVisualStudio7Generator* lg = this->LocalGenerator; + std::string currentBinDir = lg->GetCurrentBinaryDirectory(); std::vector<std::string> objs; gt->UseObjectLibraries(objs, ""); const char* sep = isep ? isep : ""; for (std::vector<std::string>::const_iterator oi = objs.begin(); oi != objs.end(); ++oi) { - std::string rel = lg->ConvertToRelativePath( - lg->GetCurrentBinaryDirectory(), oi->c_str()); + std::string rel = lg->ConvertToRelativePath(currentBinDir, oi->c_str()); fout << sep << lg->ConvertToXMLOutputPath(rel.c_str()); sep = " "; } @@ -1332,6 +1333,7 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories( std::ostream& fout, std::vector<std::string> const& dirs) { const char* comma = ""; + std::string currentBinDir = this->GetCurrentBinaryDirectory(); for (std::vector<std::string>::const_iterator d = dirs.begin(); d != dirs.end(); ++d) { // Remove any trailing slash and skip empty paths. @@ -1345,8 +1347,8 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories( // Switch to a relative path specification if it is shorter. if (cmSystemTools::FileIsFullPath(dir.c_str())) { - std::string rel = this->ConvertToRelativePath( - this->GetCurrentBinaryDirectory(), dir.c_str()); + std::string rel = + this->ConvertToRelativePath(currentBinDir, dir.c_str()); if (rel.size() < dir.size()) { dir = rel; } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 215952a..df06dc1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -162,6 +162,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() // files for this target. std::vector<cmSourceFile const*> customCommands; this->GeneratorTarget->GetCustomCommands(customCommands, config); + std::string currentBinDir = + this->LocalGenerator->GetCurrentBinaryDirectory(); for (std::vector<cmSourceFile const*>::const_iterator si = customCommands.begin(); si != customCommands.end(); ++si) { @@ -172,8 +174,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() const std::vector<std::string>& outputs = ccg.GetOutputs(); for (std::vector<std::string>::const_iterator o = outputs.begin(); o != outputs.end(); ++o) { - this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), *o)); + this->CleanFiles.push_back( + this->LocalGenerator->ConvertToRelativePath(currentBinDir, *o)); } } } @@ -1180,11 +1182,12 @@ void cmMakefileTargetGenerator::WriteObjectsVariable( << this->GeneratorTarget->GetName() << "\n" << variableNameExternal << " ="; /* clang-format on */ + std::string currentBinDir = + this->LocalGenerator->GetCurrentBinaryDirectory(); for (std::vector<std::string>::const_iterator i = this->ExternalObjects.begin(); i != this->ExternalObjects.end(); ++i) { - object = this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), *i); + object = this->LocalGenerator->ConvertToRelativePath(currentBinDir, *i); *this->BuildFileStream << " " << lineContinue << "\n" << this->Makefile->GetSafeDefinition( "CMAKE_OBJECT_NAME"); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index a4065ca..85084eb 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2415,10 +2415,12 @@ void cmVisualStudio10TargetGenerator::AddLibraries( { typedef cmComputeLinkInformation::ItemVector ItemVector; ItemVector libs = cli.GetItems(); + std::string currentBinDir = + this->LocalGenerator->GetCurrentBinaryDirectory(); for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) { if (l->IsPath) { std::string path = this->LocalGenerator->ConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), l->Value.c_str()); + currentBinDir, l->Value.c_str()); this->ConvertToWindowsSlash(path); libVec.push_back(path); } else if (!l->Target || https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2fe53afb2ca99257143cb89e633b7a4fe84265cb commit 2fe53afb2ca99257143cb89e633b7a4fe84265cb Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 27 13:50:29 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:29:50 2016 +0200 Convert: Avoid START_OUTPUT enum when converting to relative paths diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index eb4c1ec..eed31fa 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -206,15 +206,17 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, fcStream << "\n"; fcStream << " \"" << this->LocalGenerator->ConvertToRelativePath( - mod_lower, cmOutputConverter::START_OUTPUT) + this->LocalGenerator->GetCurrentBinaryDirectory(), + mod_lower) << "\"\n"; fcStream << " \"" << this->LocalGenerator->ConvertToRelativePath( - mod_upper, cmOutputConverter::START_OUTPUT) + this->LocalGenerator->GetCurrentBinaryDirectory(), + mod_upper) << "\"\n"; fcStream << " \"" << this->LocalGenerator->ConvertToRelativePath( - stamp, cmOutputConverter::START_OUTPUT) + this->LocalGenerator->GetCurrentBinaryDirectory(), stamp) << "\"\n"; } fcStream << " )\n"; diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index d90ebf0..9443b0a 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -324,13 +324,13 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() << "# The top level Makefile was generated from the following files:\n" << "set(CMAKE_MAKEFILE_DEPENDS\n" << " \"" - << lg->ConvertToRelativePath(cache, cmOutputConverter::START_OUTPUT) + << lg->ConvertToRelativePath(lg->GetCurrentBinaryDirectory(), cache) << "\"\n"; for (std::vector<std::string>::const_iterator i = lfiles.begin(); i != lfiles.end(); ++i) { cmakefileStream << " \"" << lg->ConvertToRelativePath( - *i, cmOutputConverter::START_OUTPUT) + lg->GetCurrentBinaryDirectory(), *i) << "\"\n"; } cmakefileStream << " )\n\n"; @@ -344,12 +344,12 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() cmakefileStream << "# The corresponding makefile is:\n" << "set(CMAKE_MAKEFILE_OUTPUTS\n" << " \"" - << lg->ConvertToRelativePath(makefileName, - cmOutputConverter::START_OUTPUT) + << lg->ConvertToRelativePath(lg->GetCurrentBinaryDirectory(), + makefileName) << "\"\n" << " \"" - << lg->ConvertToRelativePath(check, - cmOutputConverter::START_OUTPUT) + << lg->ConvertToRelativePath(lg->GetCurrentBinaryDirectory(), + check) << "\"\n"; cmakefileStream << " )\n\n"; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 0dc4497..ed41e60 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -405,8 +405,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( if (vcprojName) { cmLocalGenerator* lg = target->GetLocalGenerator(); std::string dir = lg->GetCurrentBinaryDirectory(); - dir = root->ConvertToRelativePath(dir.c_str(), - cmOutputConverter::START_OUTPUT); + dir = root->ConvertToRelativePath(root->GetCurrentBinaryDirectory(), + dir.c_str()); if (dir == ".") { dir = ""; // msbuild cannot handle ".\" prefix } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0162781..774e328 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -180,7 +180,8 @@ void cmLocalGenerator::GenerateTestFiles() for (vec_t::const_iterator i = children.begin(); i != children.end(); ++i) { // TODO: Use add_subdirectory instead? std::string outP = i->GetDirectory().GetCurrentBinary(); - outP = this->ConvertToRelativePath(outP, START_OUTPUT); + outP = this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), + outP); outP = cmOutputConverter::EscapeForCMake(outP); fout << "subdirs(" << outP << ")" << std::endl; } @@ -2246,7 +2247,7 @@ std::string cmLocalGenerator::ConstructComment( o != ccg.GetOutputs().end(); ++o) { comment += sep; comment += - this->ConvertToRelativePath(*o, cmOutputConverter::START_OUTPUT); + this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), *o); sep = ", "; } return comment; @@ -2522,7 +2523,7 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget( // Try referencing the source relative to the binary tree. std::string relFromBinary = - this->ConvertToRelativePath(fullPath, START_OUTPUT); + this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), fullPath); assert(!relFromBinary.empty()); bool relBinary = !cmSystemTools::FileIsFullPath(relFromBinary.c_str()); bool subBinary = relBinary && relFromBinary[0] != '.'; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 611c502..2b22f49 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -977,7 +977,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( bool had_slash = cmd.find('/') != cmd.npos; if (workingDir.empty()) { cmd = - this->ConvertToRelativePath(cmd, cmOutputConverter::START_OUTPUT); + this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), cmd); } bool has_slash = cmd.find('/') != cmd.npos; if (had_slash && !has_slash) { @@ -1088,7 +1088,7 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand( for (std::vector<std::string>::const_iterator f = files.begin(); f != files.end(); ++f) { std::string fc = - this->ConvertToRelativePath(*f, cmOutputConverter::START_OUTPUT); + this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), *f); fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n"; } fout << ")\n"; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 70fe819..9cc1b7e 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->ConvertToRelativePath(target_mod_dir, - cmOutputConverter::START_OUTPUT); + modDir = this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), + target_mod_dir); } else { modDir = "."; } @@ -1301,7 +1301,7 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries( for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) { if (l->IsPath) { std::string rel = lg->ConvertToRelativePath( - l->Value.c_str(), cmOutputConverter::START_OUTPUT); + lg->GetCurrentBinaryDirectory(), l->Value.c_str()); fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " "; } else if (!l->Target || l->Target->GetType() != cmState::INTERFACE_LIBRARY) { @@ -1321,8 +1321,8 @@ void cmLocalVisualStudio7GeneratorInternals::OutputObjects( const char* sep = isep ? isep : ""; for (std::vector<std::string>::const_iterator oi = objs.begin(); oi != objs.end(); ++oi) { - std::string rel = - lg->ConvertToRelativePath(oi->c_str(), cmOutputConverter::START_OUTPUT); + std::string rel = lg->ConvertToRelativePath( + lg->GetCurrentBinaryDirectory(), oi->c_str()); fout << sep << lg->ConvertToXMLOutputPath(rel.c_str()); sep = " "; } @@ -1346,7 +1346,7 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories( // Switch to a relative path specification if it is shorter. if (cmSystemTools::FileIsFullPath(dir.c_str())) { std::string rel = this->ConvertToRelativePath( - dir.c_str(), cmOutputConverter::START_OUTPUT); + this->GetCurrentBinaryDirectory(), dir.c_str()); if (rel.size() < dir.size()) { dir = rel; } diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 66e1ca2..c1079a2 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -219,25 +219,27 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // may need to be cleaned. std::vector<std::string> exeCleanFiles; exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( - targetFullPath, cmOutputConverter::START_OUTPUT)); + 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( - (targetFullPath + ".manifest").c_str(), cmOutputConverter::START_OUTPUT)); + this->LocalGenerator->GetCurrentBinaryDirectory(), + (targetFullPath + ".manifest").c_str())); #endif if (targetNameReal != targetName) { exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( - targetFullPathReal, cmOutputConverter::START_OUTPUT)); + this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal)); } if (!targetNameImport.empty()) { exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( - targetFullPathImport, cmOutputConverter::START_OUTPUT)); + this->LocalGenerator->GetCurrentBinaryDirectory(), + targetFullPathImport)); std::string implib; if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport, implib)) { exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( - implib, cmOutputConverter::START_OUTPUT)); + this->LocalGenerator->GetCurrentBinaryDirectory(), implib)); } } @@ -245,7 +247,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // cleaned. We do not want to delete the .pdb file just before // linking the target. this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( - targetFullPathPDB, cmOutputConverter::START_OUTPUT)); + this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathPDB)); // 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 c31c469..8d90089 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -368,23 +368,24 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // Clean files associated with this library. std::vector<std::string> libCleanFiles; libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( - targetFullPath, cmOutputConverter::START_OUTPUT)); + this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath)); if (targetNameReal != targetName) { libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( - targetFullPathReal, cmOutputConverter::START_OUTPUT)); + this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal)); } if (targetNameSO != targetName && targetNameSO != targetNameReal) { libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( - targetFullPathSO, cmOutputConverter::START_OUTPUT)); + this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathSO)); } if (!targetNameImport.empty()) { libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( - targetFullPathImport, cmOutputConverter::START_OUTPUT)); + this->LocalGenerator->GetCurrentBinaryDirectory(), + targetFullPathImport)); std::string implib; if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport, implib)) { libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( - implib, cmOutputConverter::START_OUTPUT)); + this->LocalGenerator->GetCurrentBinaryDirectory(), implib)); } } @@ -392,15 +393,15 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // cleaned. We do not want to delete the .pdb file just before // linking the target. this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath( - targetFullPathPDB, cmOutputConverter::START_OUTPUT)); + 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( - (targetFullPath + ".manifest").c_str(), - cmOutputConverter::START_OUTPUT)); + this->LocalGenerator->GetCurrentBinaryDirectory(), + (targetFullPath + ".manifest").c_str())); } #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 165f96c..215952a 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -173,7 +173,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( - *o, cmOutputConverter::START_OUTPUT)); + this->LocalGenerator->GetCurrentBinaryDirectory(), *o)); } } } @@ -313,7 +313,7 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()( output += cmSystemTools::GetFilenameName(input); this->Generator->CleanFiles.push_back( this->Generator->LocalGenerator->ConvertToRelativePath( - output, cmOutputConverter::START_OUTPUT)); + this->Generator->LocalGenerator->GetCurrentBinaryDirectory(), output)); output = this->Generator->LocalGenerator->ConvertToRelativePath( output, cmOutputConverter::HOME_OUTPUT); @@ -1184,7 +1184,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable( this->ExternalObjects.begin(); i != this->ExternalObjects.end(); ++i) { object = this->LocalGenerator->ConvertToRelativePath( - *i, cmOutputConverter::START_OUTPUT); + this->LocalGenerator->GetCurrentBinaryDirectory(), *i); *this->BuildFileStream << " " << lineContinue << "\n" << this->Makefile->GetSafeDefinition( "CMAKE_OBJECT_NAME"); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 8ff7366..a4065ca 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2418,7 +2418,7 @@ void cmVisualStudio10TargetGenerator::AddLibraries( for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) { if (l->IsPath) { std::string path = this->LocalGenerator->ConvertToRelativePath( - l->Value.c_str(), cmOutputConverter::START_OUTPUT); + this->LocalGenerator->GetCurrentBinaryDirectory(), l->Value.c_str()); this->ConvertToWindowsSlash(path); libVec.push_back(path); } else if (!l->Target || https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1b855d76829ea3633eea0ec608e5cbabf18c06ff commit 1b855d76829ea3633eea0ec608e5cbabf18c06ff Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 27 17:55:31 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:29:50 2016 +0200 Convert: Remove obsolete HOME and START enum values diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 415b32b..200bc83 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -52,14 +52,6 @@ std::string cmOutputConverter::ConvertToRelativePath( std::string result; switch (relative) { - case HOME: - result = this->ConvertToRelativePath( - this->GetState()->GetSourceDirectory(), source); - break; - case START: - result = this->ConvertToRelativePath( - this->StateSnapshot.GetDirectory().GetCurrentSource(), source); - break; case HOME_OUTPUT: result = this->ConvertToRelativePath( this->GetState()->GetBinaryDirectory(), source); diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index d778f5f..5ebd8ee 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -40,8 +40,6 @@ public: */ enum RelativeRoot { - HOME, - START, HOME_OUTPUT, START_OUTPUT }; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=983421d8048c44f33704dba4b1302eeadd600463 commit 983421d8048c44f33704dba4b1302eeadd600463 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Sep 6 22:59:59 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:29:50 2016 +0200 Convert: Remove last uses of HOME enum value diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 30a05a0..7e343c9 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -774,8 +774,8 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaFolderRule( { cmLocalNinjaGenerator* ng = static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]); - std::string convPath = - ng->ConvertToRelativePath(path + "/all", cmOutputConverter::HOME); + std::string convPath = ng->ConvertToRelativePath( + this->LocalGenerators[0]->GetState()->GetSourceDirectory(), path + "/all"); convPath = this->NinjaOutputPath(convPath); #ifdef _WIN32 std::replace(convPath.begin(), convPath.end(), '/', '\\'); diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 14bb81e..7ab7de1 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -404,8 +404,8 @@ void cmListFileBacktrace::PrintTitle(std::ostream& out) const cmOutputConverter converter(this->Bottom); cmListFileContext lfc = *this->Cur; if (!this->Bottom.GetState()->GetIsInTryCompile()) { - lfc.FilePath = - converter.ConvertToRelativePath(lfc.FilePath, cmOutputConverter::HOME); + lfc.FilePath = converter.ConvertToRelativePath( + this->Bottom.GetState()->GetSourceDirectory(), lfc.FilePath); } out << (lfc.Line ? " at " : " in ") << lfc; } @@ -430,8 +430,8 @@ void cmListFileBacktrace::PrintCallStack(std::ostream& out) const } cmListFileContext lfc = *i; if (!this->Bottom.GetState()->GetIsInTryCompile()) { - lfc.FilePath = - converter.ConvertToRelativePath(lfc.FilePath, cmOutputConverter::HOME); + lfc.FilePath = converter.ConvertToRelativePath( + this->Bottom.GetState()->GetSourceDirectory(), lfc.FilePath); } out << " " << lfc << "\n"; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1b6c93e..1dad742 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -596,8 +596,8 @@ void cmTarget::GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const it != this->TLLCommands.end(); ++it) { if (it->first == sig) { cmListFileContext lfc = it->second; - lfc.FilePath = - converter.ConvertToRelativePath(lfc.FilePath, cmOutputConverter::HOME); + lfc.FilePath = converter.ConvertToRelativePath( + this->Makefile->GetState()->GetSourceDirectory(), lfc.FilePath); s << " * " << lfc << std::endl; } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=94a51b0185fde6210056cd3b3b5526bb5e0ed830 commit 94a51b0185fde6210056cd3b3b5526bb5e0ed830 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Sep 6 22:58:19 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:29:49 2016 +0200 Convert: Remove last use of START enum value The enums just introduce unfamiliar names and don't provide value. The order of arguments is reversed, as that is the result of the cmOutputConverter::ConvertToRelativePath overload which accepts the RelativeRoot enum. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a76bed3..0162781 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2514,7 +2514,8 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget( const char* fullPath = source.GetFullPath().c_str(); // Try referencing the source relative to the source tree. - std::string relFromSource = this->ConvertToRelativePath(fullPath, START); + std::string relFromSource = + this->ConvertToRelativePath(this->GetCurrentSourceDirectory(), fullPath); assert(!relFromSource.empty()); bool relSource = !cmSystemTools::FileIsFullPath(relFromSource.c_str()); bool subSource = relSource && relFromSource[0] != '.'; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d3f0e12ed94c4048ef24025f1674692474b7602 commit 5d3f0e12ed94c4048ef24025f1674692474b7602 Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Thu Jun 16 23:25:43 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:29:49 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 ae7c583..415b32b 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -123,15 +123,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 1efe109..d778f5f 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -136,17 +136,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=3d87bd9725341f76ba95f6063b177021dd84a583 commit 3d87bd9725341f76ba95f6063b177021dd84a583 Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Thu Jun 16 23:19:28 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:29:49 2016 +0200 cmGlobalXCodeGenerator: use new ConvertToRelativePath signature diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 5653820..581af3e 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -351,13 +351,6 @@ void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root) { this->CurrentProject = root->GetProjectName(); this->SetCurrentLocalGenerator(root); - cmSystemTools::SplitPath( - this->CurrentLocalGenerator->GetCurrentSourceDirectory(), - this->ProjectSourceDirectoryComponents); - cmSystemTools::SplitPath( - this->CurrentLocalGenerator->GetCurrentBinaryDirectory(), - this->ProjectOutputDirectoryComponents); - this->CurrentXCodeHackMakefile = root->GetCurrentBinaryDirectory(); this->CurrentXCodeHackMakefile += "/CMakeScripts"; cmSystemTools::MakeDirectory(this->CurrentXCodeHackMakefile.c_str()); @@ -896,10 +889,6 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen) { this->CurrentLocalGenerator = gen; this->CurrentMakefile = gen->GetMakefile(); - std::string outdir = cmSystemTools::CollapseFullPath( - this->CurrentLocalGenerator->GetCurrentBinaryDirectory()); - cmSystemTools::SplitPath(outdir, this->CurrentOutputDirectoryComponents); - // Select the current set of configuration types. this->CurrentConfigurationTypes.clear(); this->CurrentMakefile->GetConfigurations(this->CurrentConfigurationTypes); @@ -3328,14 +3317,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 this->CurrentLocalGenerator->ForceToRelativePath( + this->CurrentLocalGenerator->GetCurrentSourceDirectory(), p); } std::string cmGlobalXCodeGenerator::RelativeToBinary(const char* p) { return this->CurrentLocalGenerator->ConvertToRelativePath( - this->ProjectOutputDirectoryComponents, p); + this->CurrentLocalGenerator->GetCurrentBinaryDirectory(), p); } std::string cmGlobalXCodeGenerator::XCodeEscapePath(const std::string& p) diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 303dfa0..c9fc9b3 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -241,9 +241,6 @@ private: std::string CurrentXCodeHackMakefile; std::string CurrentProject; std::set<std::string> TargetDoneSet; - std::vector<std::string> CurrentOutputDirectoryComponents; - std::vector<std::string> ProjectSourceDirectoryComponents; - std::vector<std::string> ProjectOutputDirectoryComponents; std::map<std::string, cmXCodeObject*> GroupMap; std::map<std::string, cmXCodeObject*> GroupNameMap; std::map<std::string, cmXCodeObject*> TargetGroup; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=11ad1af8a35a744413b405c5c86e1dbdab38c430 commit 11ad1af8a35a744413b405c5c86e1dbdab38c430 Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Thu Jun 16 23:15:03 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:29:49 2016 +0200 cmState: remove unused code Remove the code that was used by cmOutputConverter exclusively. diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 073c239..ffb104b 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -77,8 +77,6 @@ struct cmState::BuildsystemDirectoryStateType std::string Location; std::string OutputLocation; - std::vector<std::string> CurrentSourceDirectoryComponents; - std::vector<std::string> CurrentBinaryDirectoryComponents; // The top-most directories for relative path conversion. Both the // source and destination location of a relative path conversion // must be underneath one of these directories (both under source or @@ -591,10 +589,6 @@ void cmState::SetSourceDirectory(std::string const& sourceDirectory) { this->SourceDirectory = sourceDirectory; cmSystemTools::ConvertToUnixSlashes(this->SourceDirectory); - - cmSystemTools::SplitPath( - cmSystemTools::CollapseFullPath(this->SourceDirectory), - this->SourceDirectoryComponents); } const char* cmState::GetSourceDirectory() const @@ -602,19 +596,10 @@ const char* cmState::GetSourceDirectory() const return this->SourceDirectory.c_str(); } -std::vector<std::string> const& cmState::GetSourceDirectoryComponents() const -{ - return this->SourceDirectoryComponents; -} - void cmState::SetBinaryDirectory(std::string const& binaryDirectory) { this->BinaryDirectory = binaryDirectory; cmSystemTools::ConvertToUnixSlashes(this->BinaryDirectory); - - cmSystemTools::SplitPath( - cmSystemTools::CollapseFullPath(this->BinaryDirectory), - this->BinaryDirectoryComponents); } void cmState::SetWindowsShell(bool windowsShell) @@ -692,11 +677,6 @@ const char* cmState::GetBinaryDirectory() const return this->BinaryDirectory.c_str(); } -std::vector<std::string> const& cmState::GetBinaryDirectoryComponents() const -{ - return this->BinaryDirectoryComponents; -} - void cmState::Directory::ComputeRelativePathTopSource() { // Relative path conversion inside the source tree is not used to @@ -978,8 +958,6 @@ void cmState::Directory::SetCurrentSource(std::string const& dir) cmSystemTools::ConvertToUnixSlashes(loc); loc = cmSystemTools::CollapseFullPath(loc); - cmSystemTools::SplitPath( - loc, this->DirectoryState->CurrentSourceDirectoryComponents); this->ComputeRelativePathTopSource(); this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc); @@ -997,8 +975,6 @@ void cmState::Directory::SetCurrentBinary(std::string const& dir) cmSystemTools::ConvertToUnixSlashes(loc); loc = cmSystemTools::CollapseFullPath(loc); - cmSystemTools::SplitPath( - loc, this->DirectoryState->CurrentBinaryDirectoryComponents); this->ComputeRelativePathTopBinary(); this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc); @@ -1009,18 +985,6 @@ void cmState::Snapshot::SetListFile(const std::string& listfile) *this->Position->ExecutionListFile = listfile; } -std::vector<std::string> const& -cmState::Directory::GetCurrentSourceComponents() const -{ - return this->DirectoryState->CurrentSourceDirectoryComponents; -} - -std::vector<std::string> const& -cmState::Directory::GetCurrentBinaryComponents() const -{ - return this->DirectoryState->CurrentBinaryDirectoryComponents; -} - const char* cmState::Directory::GetRelativePathTopSource() const { return this->DirectoryState->RelativePathTopSource.c_str(); diff --git a/Source/cmState.h b/Source/cmState.h index 9ab4213..0fac42c 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -135,9 +135,6 @@ public: const char* GetCurrentBinary() const; void SetCurrentBinary(std::string const& dir); - std::vector<std::string> const& GetCurrentSourceComponents() const; - std::vector<std::string> const& GetCurrentBinaryComponents() const; - const char* GetRelativePathTopSource() const; const char* GetRelativePathTopBinary() const; void SetRelativePathTopSource(const char* dir); @@ -312,9 +309,6 @@ public: const char* GetBinaryDirectory() const; void SetBinaryDirectory(std::string const& binaryDirectory); - std::vector<std::string> const& GetSourceDirectoryComponents() const; - std::vector<std::string> const& GetBinaryDirectoryComponents() const; - void SetWindowsShell(bool windowsShell); bool UseWindowsShell() const; void SetWindowsVSIDE(bool windowsVSIDE); @@ -350,8 +344,6 @@ private: cmLinkedTree<SnapshotDataType> SnapshotData; cmLinkedTree<cmDefinitions> VarTree; - std::vector<std::string> SourceDirectoryComponents; - std::vector<std::string> BinaryDirectoryComponents; std::string SourceDirectory; std::string BinaryDirectory; bool IsInTryCompile; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8d47a20f131147d4cf38e63df0c382ec5844a833 commit 8d47a20f131147d4cf38e63df0c382ec5844a833 Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Thu Jun 16 23:08:49 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:29:49 2016 +0200 cmOutputConverter: use new ConvertToRelativePath signature internally diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index e6aaed1..ae7c583 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -54,21 +54,19 @@ std::string cmOutputConverter::ConvertToRelativePath( switch (relative) { case HOME: result = this->ConvertToRelativePath( - this->GetState()->GetSourceDirectoryComponents(), source); + this->GetState()->GetSourceDirectory(), source); break; case START: result = this->ConvertToRelativePath( - this->StateSnapshot.GetDirectory().GetCurrentSourceComponents(), - source); + this->StateSnapshot.GetDirectory().GetCurrentSource(), source); break; case HOME_OUTPUT: result = this->ConvertToRelativePath( - this->GetState()->GetBinaryDirectoryComponents(), source); + this->GetState()->GetBinaryDirectory(), source); break; case START_OUTPUT: result = this->ConvertToRelativePath( - this->StateSnapshot.GetDirectory().GetCurrentBinaryComponents(), - source); + this->StateSnapshot.GetDirectory().GetCurrentBinary(), source); break; } return result; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=149af87b86362449a99301860af5aac1a3b4b20c commit 149af87b86362449a99301860af5aac1a3b4b20c Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Thu Jun 16 21:37:57 2016 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Sat Sep 17 10:29:48 2016 +0200 cmOutputConverter: split ConvertToRelativePath Split the ConvertToRelativePath funtion into ConvertToRelativePath and ForceToRelativePath. Both functions take the local path as a string rather than a vector of path segments. Reimplement the old interface on top of the two new functions for interface compatibility. diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index d44fbb7..e6aaed1 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -128,41 +128,67 @@ std::string cmOutputConverter::ConvertToRelativePath( const std::vector<std::string>& local, const std::string& in_remote, bool force) const { - // The path should never be quoted. - assert(in_remote[0] != '\"'); + 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. + assert(local_path[0] != '\"'); + assert(remote_path[0] != '\"'); // The local path should never have a trailing slash. - assert(!local.empty() && !(local[local.size() - 1] == "")); + assert(local_path.empty() || local_path[local_path.size() - 1] != '/'); // If the path is already relative then just return the path. - if (!cmSystemTools::FileIsFullPath(in_remote.c_str())) { - return in_remote; - } - - if (!force) { - // Skip conversion if the path and local are not both in the source - // or both in the binary tree. - std::string local_path = cmSystemTools::JoinPath(local); - if (!((cmOutputConverterNotAbove( - local_path.c_str(), - this->StateSnapshot.GetDirectory().GetRelativePathTopBinary()) && - cmOutputConverterNotAbove( - in_remote.c_str(), - this->StateSnapshot.GetDirectory().GetRelativePathTopBinary())) || - (cmOutputConverterNotAbove( - local_path.c_str(), - this->StateSnapshot.GetDirectory().GetRelativePathTopSource()) && - cmOutputConverterNotAbove(in_remote.c_str(), - this->StateSnapshot.GetDirectory() - .GetRelativePathTopSource())))) { - return in_remote; - } + if (!cmSystemTools::FileIsFullPath(remote_path.c_str())) { + 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())))) { + return remote_path; + } + + return this->ForceToRelativePath(local_path, remote_path); +} + +std::string cmOutputConverter::ForceToRelativePath( + std::string const& local_path, std::string const& remote_path) +{ + // 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] != '/'); + + // If the path is already relative then just return the path. + if (!cmSystemTools::FileIsFullPath(remote_path.c_str())) { + return remote_path; } // Identify the longest shared path component between the remote // path and the local path. + std::vector<std::string> local; + cmSystemTools::SplitPath(local_path, local); std::vector<std::string> remote; - cmSystemTools::SplitPath(in_remote, remote); + cmSystemTools::SplitPath(remote_path, remote); unsigned int common = 0; while (common < remote.size() && common < local.size() && cmSystemTools::ComparePath(remote[common], local[common])) { @@ -171,7 +197,7 @@ std::string cmOutputConverter::ConvertToRelativePath( // If no part of the path is in common then return the full path. if (common == 0) { - return in_remote; + return remote_path; } // If the entire path is in common then just return a ".". diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index ac58ddc..1efe109 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -145,6 +145,24 @@ public: 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 + * or both in the binary tree. + */ + std::string ConvertToRelativePath(std::string const& local_path, + std::string const& remote_path) 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. + */ + static std::string ForceToRelativePath(std::string const& local_path, + std::string const& remote_path); + private: cmState* GetState() const; ----------------------------------------------------------------------- Summary of changes: Source/cmCommonTargetGenerator.cxx | 12 +-- Source/cmCommonTargetGenerator.h | 4 - Source/cmDependsC.cxx | 17 ++-- Source/cmDependsFortran.cxx | 63 +++++++------ Source/cmExportBuildAndroidMKGenerator.cxx | 3 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmGlobalGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.cxx | 8 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 36 +++----- Source/cmGlobalVisualStudio7Generator.cxx | 4 +- Source/cmGlobalXCodeGenerator.cxx | 17 +--- Source/cmGlobalXCodeGenerator.h | 3 - Source/cmListFileCache.cxx | 8 +- Source/cmLocalCommonGenerator.cxx | 10 +- Source/cmLocalCommonGenerator.h | 9 +- Source/cmLocalGenerator.cxx | 17 ++-- Source/cmLocalNinjaGenerator.cxx | 13 ++- Source/cmLocalUnixMakefileGenerator3.cxx | 42 +++++---- Source/cmLocalVisualStudio7Generator.cxx | 18 ++-- Source/cmLocalVisualStudioGenerator.cxx | 4 +- Source/cmMakefileExecutableTargetGenerator.cxx | 47 ++++++---- Source/cmMakefileLibraryTargetGenerator.cxx | 59 +++++++----- Source/cmMakefileTargetGenerator.cxx | 110 ++++++++++++++-------- Source/cmMakefileUtilityTargetGenerator.cxx | 9 +- Source/cmNinjaNormalTargetGenerator.cxx | 3 +- Source/cmOutputConverter.cxx | 116 ++++++++++-------------- Source/cmOutputConverter.h | 47 +++------- Source/cmState.cxx | 36 -------- Source/cmState.h | 8 -- Source/cmTarget.cxx | 4 +- Source/cmVisualStudio10TargetGenerator.cxx | 4 +- 31 files changed, 349 insertions(+), 386 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits