diff options
author | Peter Waller <p@pwaller.net> | 2019-10-11 19:48:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-10-14 20:17:00 (GMT) |
commit | c9d73b26b0a78fac774a549de41eee55ed4e8d7b (patch) | |
tree | d7fbd0a006240f40c825f07ef5e321272cb5c6ae /Source | |
parent | 9150c818b7d2afb868575fcb2e0c9ba62b9d7f85 (diff) | |
download | CMake-c9d73b26b0a78fac774a549de41eee55ed4e8d7b.zip CMake-c9d73b26b0a78fac774a549de41eee55ed4e8d7b.tar.gz CMake-c9d73b26b0a78fac774a549de41eee55ed4e8d7b.tar.bz2 |
cmake: Fix relative path regression in -C
Since commit 4ca0526f8a (cmake: Pass -S and -B into PreLoad.cmake and -C
scripts, 2019-08-20, v3.16.0-rc1~195^2) the value of `CMAKE_SOURCE_DIR`
is the source directory rather than the current working directory.
This was correct on its own, but the place storing that value is also
used as the base for relative paths specified on the command line.
The latter should of course be relative to the current working
directory.
The fix is to switch to use a full path internally, unless a full path
is already specified. Add tests for the behaviour of `-C` under these
four circumstances:
{with -S, without -S} x {full path, relative path}
Fixes: #19827
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmake.cxx | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 50f47af..f63a264 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -423,6 +423,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) } } std::cout << "loading initial cache file " << path << "\n"; + // Resolve script path specified on command line relative to $PWD. + path = cmSystemTools::CollapseFullPath(path); this->ReadListFile(args, path); } else if (arg.find("-P", 0) == 0) { i++; |