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

View File

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

View File

@ -643,8 +643,14 @@ public:
std::string const& presetName, bool listPresets, std::string const& presetName, bool listPresets,
std::vector<std::string> const& args); std::vector<std::string> const& args);
enum class DryRun
{
No,
Yes,
};
//! run the --open option //! run the --open option
bool Open(std::string const& dir, bool dryRun); bool Open(std::string const& dir, DryRun dryRun);
//! run the --workflow option //! run the --workflow option
enum class WorkflowListPresets 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) { cm.SetProgressCallback([&cm](std::string const& msg, float prog) {
cmakemainProgressCallback(msg, prog, &cm); cmakemainProgressCallback(msg, prog, &cm);
}); });
return cm.Open(dir, false) ? 0 : 1; return cm.Open(dir, cmake::DryRun::No) ? 0 : 1;
#endif #endif
} }
} // namespace } // namespace