diff options
-rw-r--r-- | Source/cmake.cxx | 19 | ||||
-rw-r--r-- | Source/cmake.h | 11 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 2 |
3 files changed, 8 insertions, 24 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f9e2d6e..7de488b 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); //@{ /** diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 081ee3f..f7554ff 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -180,7 +180,7 @@ message(STATUS "CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}'") run_cmake_with_options(ExplicitDirs-S-S-same -S ${source_dir} -S ${source_dir} -B ${binary_dir}) run_cmake_with_options(ExplicitDirs-S-S-differs -S ${binary_dir}/other_dir -S ${source_dir} -B ${binary_dir}) run_cmake_with_options(ExplicitDirs-S-implicit-same -S ${source_dir} ${source_dir} -B ${binary_dir}) - run_cmake_with_options(ExplicitDirs-S-implicit-differs -S ${source_dir} ${binary_dir}/other_dir -B ${binary_dir}) + run_cmake_with_options(ExplicitDirs-S-implicit-differs -S ${binary_dir}/other_dir ${source_dir} -B ${binary_dir}) run_cmake_with_options(ExplicitDirs-S-implicit-differs2 ${binary_dir}/other_dir -S ${source_dir} -B ${binary_dir}) run_cmake_with_options(ExplicitDirs-S-implicit-differs3 ${binary_dir}/other_dir ${source_dir} -B ${binary_dir}) run_cmake_with_options(ExplicitDirs-S-S-Sdiffers -S ${binary_dir}/other_dir1 -S ${binary_dir}/other_dir2 -S ${source_dir} -B ${binary_dir}) |