summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-18 11:16:12 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-03-18 11:16:24 (GMT)
commit32e40f7f534b2151053831f414af104aee86e8df (patch)
treea70dbe64ec075eb7136a3783ab80985760e951bb /Source
parentfafaca5fee23b6e991a54ec25e8e415d42b02cc2 (diff)
parentb44ad7992a2a377cc48ba1b7f666d863dbac34f3 (diff)
downloadCMake-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')
-rw-r--r--Source/cmake.cxx19
-rw-r--r--Source/cmake.h11
2 files changed, 7 insertions, 23 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)
diff --git a/Source/cmake.h b/Source/cmake.h
index 9c795c5..3c2a36c 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -183,12 +183,6 @@ public:
#endif
std::string ReportCapabilities() const;
- enum class HomeDirArgStyle
- {
- Plain,
- Dash_S,
- };
-
/**
* Set the home directory from `-S` or from a known location
* that contains a CMakeLists.txt. Will generate warnings
@@ -199,12 +193,11 @@ public:
* | `dirA dirA` | dirA | N/A |
* | `-S dirA -S dirA` | dirA | N/A |
* | `-S dirA -S dirB` | dirB | Ignoring dirA |
- * | `-S dirA dirB` | dirA | Ignoring dirB |
+ * | `-S dirA dirB` | dirB | Ignoring dirA |
* | `dirA -S dirB` | dirB | Ignoring dirA |
* | `dirA dirB` | dirB | Ignoring dirA |
*/
- void SetHomeDirectoryViaCommandLine(std::string const& path,
- HomeDirArgStyle argStyle);
+ void SetHomeDirectoryViaCommandLine(std::string const& path);
//@{
/**