cmake-gui: Clarify "Open Project" button implementation details

This commit is contained in:
Brad King 2025-03-06 10:56:14 -05:00
parent 7c55e2a698
commit 6f0ad398f1
4 changed files with 13 additions and 7 deletions

View File

@ -310,8 +310,8 @@ void QCMake::open()
InterruptFlag = 0;
cmSystemTools::ResetErrorOccurredFlag();
auto successful =
this->CMakeInstance->Open(this->BinaryDirectory.toStdString(), false);
auto successful = this->CMakeInstance->Open(
this->BinaryDirectory.toStdString(), cmake::DryRun::No);
#ifdef Q_OS_WIN
SetErrorMode(lastErrorMode);
@ -715,6 +715,6 @@ void QCMake::setWarnUninitializedMode(bool value)
void QCMake::checkOpenPossible()
{
std::string data = this->BinaryDirectory.toStdString();
auto possible = this->CMakeInstance->Open(data, true);
auto possible = this->CMakeInstance->Open(data, cmake::DryRun::Yes);
emit openPossible(possible);
}

View File

@ -4011,7 +4011,7 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
return buildresult;
}
bool cmake::Open(std::string const& dir, bool dryRun)
bool cmake::Open(std::string const& dir, DryRun dryRun)
{
this->SetHomeDirectory("");
this->SetHomeOutputDirectory("");
@ -4052,7 +4052,7 @@ bool cmake::Open(std::string const& dir, bool dryRun)
return false;
}
return gen->Open(dir, *cachedProjectName, dryRun);
return gen->Open(dir, *cachedProjectName, dryRun == DryRun::Yes);
}
#if !defined(CMAKE_BOOTSTRAP)

View File

@ -643,8 +643,14 @@ public:
std::string const& presetName, bool listPresets,
std::vector<std::string> const& args);
enum class DryRun
{
No,
Yes,
};
//! run the --open option
bool Open(std::string const& dir, bool dryRun);
bool Open(std::string const& dir, DryRun dryRun);
//! run the --workflow option
enum class WorkflowListPresets

View File

@ -1132,7 +1132,7 @@ int do_open(int ac, char const* const* av)
cm.SetProgressCallback([&cm](std::string const& msg, float prog) {
cmakemainProgressCallback(msg, prog, &cm);
});
return cm.Open(dir, false) ? 0 : 1;
return cm.Open(dir, cmake::DryRun::No) ? 0 : 1;
#endif
}
} // namespace