diff options
author | Brad King <brad.king@kitware.com> | 2022-03-18 11:16:12 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-03-18 11:16:24 (GMT) |
commit | 32e40f7f534b2151053831f414af104aee86e8df (patch) | |
tree | a70dbe64ec075eb7136a3783ab80985760e951bb /Source/cmake.cxx | |
parent | fafaca5fee23b6e991a54ec25e8e415d42b02cc2 (diff) | |
parent | b44ad7992a2a377cc48ba1b7f666d863dbac34f3 (diff) | |
download | CMake-32e40f7f534b2151053831f414af104aee86e8df.zip CMake-32e40f7f534b2151053831f414af104aee86e8df.tar.gz CMake-32e40f7f534b2151053831f414af104aee86e8df.tar.bz2 |
Merge topic 'always_prefer_last_source_dir'
b44ad7992a cmake: Always prefer the last source directory provided
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7084
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 81d225d..f211314 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -819,7 +819,7 @@ void cmake::SetArgs(const std::vector<std::string>& args) std::string path = cmSystemTools::CollapseFullPath(value); cmSystemTools::ConvertToUnixSlashes(path); - state->SetHomeDirectoryViaCommandLine(path, HomeDirArgStyle::Dash_S); + state->SetHomeDirectoryViaCommandLine(path); return true; }; @@ -1555,7 +1555,7 @@ bool cmake::SetDirectoriesFromFile(const std::string& arg) // When invoked with a path that points to an existing CMakeCache // This function is called multiple times with the same path if (is_source_dir) { - this->SetHomeDirectoryViaCommandLine(listPath, HomeDirArgStyle::Plain); + this->SetHomeDirectoryViaCommandLine(listPath); if (no_build_tree) { std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); this->SetHomeOutputDirectory(cwd); @@ -1780,28 +1780,19 @@ void cmake::PrintPresetList(const cmCMakePresetsGraph& graph) const } #endif -void cmake::SetHomeDirectoryViaCommandLine(std::string const& path, - HomeDirArgStyle argStyle) +void cmake::SetHomeDirectoryViaCommandLine(std::string const& path) { - bool fromDashS = argStyle == HomeDirArgStyle::Dash_S; - static bool homeDirectorySetExplicitly = false; if (path.empty()) { return; } auto prev_path = this->GetHomeDirectory(); if (prev_path != path && !prev_path.empty()) { - const bool ignore_prev_path = - (fromDashS || (!fromDashS && !homeDirectorySetExplicitly)); - const std::string& ignored_path = (ignore_prev_path) ? prev_path : path; this->IssueMessage(MessageType::WARNING, cmStrCat("Ignoring extra path from command line:\n \"", - ignored_path, "\"")); + prev_path, "\"")); } - if (fromDashS || !homeDirectorySetExplicitly) { - this->SetHomeDirectory(path); - } - homeDirectorySetExplicitly = fromDashS; + this->SetHomeDirectory(path); } void cmake::SetHomeDirectory(const std::string& dir) |