diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-10-23 16:37:06 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2020-10-26 11:32:45 (GMT) |
commit | b7d7eca66db97f9dcb6068762733f06941c0c05a (patch) | |
tree | 17b111e02de883947dd10c1097ae14303906945b /Source/cmake.cxx | |
parent | f2a59d400e9ec2e937f6000000c2e9860e388ca7 (diff) | |
download | CMake-b7d7eca66db97f9dcb6068762733f06941c0c05a.zip CMake-b7d7eca66db97f9dcb6068762733f06941c0c05a.tar.gz CMake-b7d7eca66db97f9dcb6068762733f06941c0c05a.tar.bz2 |
CMakePresets.json: Rework how --preset argument is handled
If a path argument with no -S or -B leads to a cache directory,
use that directory as the binary directory. Otherwise, use the
binary directory from the preset.
Fixes: #21311
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 291ce22..8d4cd03 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -727,6 +727,7 @@ void cmake::SetArgs(const std::vector<std::string>& args) { bool haveToolset = false; bool havePlatform = false; + bool haveBArg = false; #if !defined(CMAKE_BOOTSTRAP) std::string profilingFormat; std::string profilingOutput; @@ -775,6 +776,7 @@ void cmake::SetArgs(const std::vector<std::string>& args) path = cmSystemTools::CollapseFullPath(path); cmSystemTools::ConvertToUnixSlashes(path); this->SetHomeOutputDirectory(path); + haveBArg = true; } else if ((i < args.size() - 2) && cmHasLiteralPrefix(arg, "--check-build-system")) { this->CheckBuildSystemArgument = args[++i]; @@ -1057,7 +1059,7 @@ void cmake::SetArgs(const std::vector<std::string>& args) return; } - if (!haveBinaryDir) { + if (!this->State->IsCacheLoaded() && !haveBArg) { this->SetHomeOutputDirectory(expandedPreset->BinaryDir); } if (!this->GlobalGenerator) { |