diff options
author | Brad King <brad.king@kitware.com> | 2020-07-02 10:49:52 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-07-02 11:33:16 (GMT) |
commit | 85a945a607d5c417e780afed98868366fcfd8fae (patch) | |
tree | fd2b1a77f314c6cd0f953d1bc54abcad83062526 /Source | |
parent | 1e26c84b96c0ec6887de2cf5e14061ccb83bdbfe (diff) | |
download | CMake-85a945a607d5c417e780afed98868366fcfd8fae.zip CMake-85a945a607d5c417e780afed98868366fcfd8fae.tar.gz CMake-85a945a607d5c417e780afed98868366fcfd8fae.tar.bz2 |
Restore handling of build directory inside a symlinked path
In commit dd8365b3f1 (Merge branch 'upstream-KWSys' into update-kwsys,
2020-04-06, v3.18.0-rc1~397^2) we imported KWSys commit `019afb6ea`
(SystemTools: Drop GetCurrentWorkingDirectory 'collapse' argument,
2020-04-03). That caused `GetCurrentWorkingDirectory` to no longer send
paths through the KWSys translation map and broke CMake's detection of
the absolute path to a build directory containing a symbolic link.
Add our own `cmSystemTools::GetCurrentWorkingDirectory` wrapper around
the KWSys method in order to restore that mapping.
Test-case-by: Ben Boeckel <ben.boeckel@kitware.com>
Issue: #16228
Fixes: #20900
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/cpack.cxx | 2 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 6 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 3 |
3 files changed, 10 insertions, 1 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 2e5bde2..3a400b7 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -312,7 +312,7 @@ int main(int argc, char const* const* argv) // The value has not been set on the command line else { // get a default value (current working directory) - cpackProjectDirectory = cmsys::SystemTools::GetCurrentWorkingDirectory(); + cpackProjectDirectory = cmSystemTools::GetCurrentWorkingDirectory(); // use default value if no value has been provided by the config file if (!globalMF.IsSet("CPACK_PACKAGE_DIRECTORY")) { globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY", diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index be799b0..39de13f 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2080,6 +2080,12 @@ std::string const& cmSystemTools::GetCMakeRoot() return cmSystemToolsCMakeRoot; } +std::string cmSystemTools::GetCurrentWorkingDirectory() +{ + return cmSystemTools::CollapseFullPath( + cmsys::SystemTools::GetCurrentWorkingDirectory()); +} + void cmSystemTools::MakefileColorEcho(int color, const char* message, bool newline, bool enabled) { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index ee149a0..b886c58 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -390,6 +390,9 @@ public: static std::string const& GetCMClDepsCommand(); static std::string const& GetCMakeRoot(); + /** Get the CWD mapped through the KWSys translation map. */ + static std::string GetCurrentWorkingDirectory(); + /** Echo a message in color using KWSys's Terminal cprintf. */ static void MakefileColorEcho(int color, const char* message, bool newLine, bool enabled); |