mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 21:00:17 -06:00
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
//@{
|
||||
/**
|
||||
|
||||
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user