QCMake.cxx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "QCMake.h"
  4. #include <algorithm>
  5. #include <cm/memory>
  6. #include <QCoreApplication>
  7. #include <QDir>
  8. #include <QString>
  9. #include <QVector>
  10. #include "cmExternalMakefileProjectGenerator.h"
  11. #include "cmGlobalGenerator.h"
  12. #include "cmMessageMetadata.h"
  13. #include "cmState.h"
  14. #include "cmStringAlgorithms.h"
  15. #include "cmSystemTools.h"
  16. #ifdef Q_OS_WIN
  17. # include "qt_windows.h" // For SetErrorMode
  18. #endif
  19. QCMake::QCMake(QObject* p)
  20. : QObject(p)
  21. , StartEnvironment(QProcessEnvironment::systemEnvironment())
  22. , Environment(QProcessEnvironment::systemEnvironment())
  23. {
  24. this->WarnUninitializedMode = false;
  25. qRegisterMetaType<QCMakeProperty>();
  26. qRegisterMetaType<QCMakePropertyList>();
  27. qRegisterMetaType<QProcessEnvironment>();
  28. qRegisterMetaType<QVector<QCMakePreset>>();
  29. qRegisterMetaType<cmCMakePresetsGraph::ReadFileResult>();
  30. cmSystemTools::DisableRunCommandOutput();
  31. cmSystemTools::SetRunCommandHideConsole(true);
  32. cmSystemTools::SetMessageCallback(
  33. [this](std::string const& msg, const cmMessageMetadata& md) {
  34. this->messageCallback(msg, md.title);
  35. });
  36. cmSystemTools::SetStdoutCallback(
  37. [this](std::string const& msg) { this->stdoutCallback(msg); });
  38. cmSystemTools::SetStderrCallback(
  39. [this](std::string const& msg) { this->stderrCallback(msg); });
  40. this->CMakeInstance =
  41. cm::make_unique<cmake>(cmake::RoleProject, cmState::Project);
  42. this->CMakeInstance->SetCMakeEditCommand(
  43. cmSystemTools::GetCMakeGUICommand());
  44. this->CMakeInstance->SetProgressCallback(
  45. [this](const std::string& msg, float percent) {
  46. this->progressCallback(msg, percent);
  47. });
  48. cmSystemTools::SetInterruptCallback(
  49. [this] { return this->interruptCallback(); });
  50. std::vector<cmake::GeneratorInfo> generators;
  51. this->CMakeInstance->GetRegisteredGenerators(
  52. generators, /*includeNamesWithPlatform=*/false);
  53. for (cmake::GeneratorInfo const& gen : generators) {
  54. this->AvailableGenerators.push_back(gen);
  55. }
  56. connect(&this->LoadPresetsTimer, &QTimer::timeout, this, [this]() {
  57. this->loadPresets();
  58. if (!this->PresetName.isEmpty() &&
  59. this->CMakePresetsGraph.ConfigurePresets.find(
  60. std::string(this->PresetName.toStdString())) ==
  61. this->CMakePresetsGraph.ConfigurePresets.end()) {
  62. this->setPreset(QString{});
  63. }
  64. });
  65. this->LoadPresetsTimer.start(1000);
  66. }
  67. QCMake::~QCMake() = default;
  68. void QCMake::loadCache(const QString& dir)
  69. {
  70. this->setBinaryDirectory(dir);
  71. }
  72. void QCMake::setSourceDirectory(const QString& _dir)
  73. {
  74. QString dir = QString::fromStdString(
  75. cmSystemTools::GetActualCaseForPath(_dir.toStdString()));
  76. if (this->SourceDirectory != dir) {
  77. this->SourceDirectory = QDir::fromNativeSeparators(dir);
  78. emit this->sourceDirChanged(this->SourceDirectory);
  79. this->loadPresets();
  80. this->setPreset(QString{});
  81. }
  82. }
  83. void QCMake::setBinaryDirectory(const QString& _dir)
  84. {
  85. QString dir = QString::fromStdString(
  86. cmSystemTools::GetActualCaseForPath(_dir.toStdString()));
  87. if (this->BinaryDirectory != dir) {
  88. this->BinaryDirectory = QDir::fromNativeSeparators(dir);
  89. emit this->binaryDirChanged(this->BinaryDirectory);
  90. cmState* state = this->CMakeInstance->GetState();
  91. this->setGenerator(QString());
  92. this->setToolset(QString());
  93. this->setPlatform(QString());
  94. if (!this->CMakeInstance->LoadCache(this->BinaryDirectory.toStdString())) {
  95. QDir testDir(this->BinaryDirectory);
  96. if (testDir.exists("CMakeCache.txt")) {
  97. cmSystemTools::Error(
  98. "There is a CMakeCache.txt file for the current binary "
  99. "tree but cmake does not have permission to read it. "
  100. "Please check the permissions of the directory you are trying to "
  101. "run CMake on.");
  102. }
  103. }
  104. QCMakePropertyList props = this->properties();
  105. emit this->propertiesChanged(props);
  106. cmValue homeDir = state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
  107. if (homeDir) {
  108. setSourceDirectory(QString(homeDir->c_str()));
  109. }
  110. cmValue gen = state->GetCacheEntryValue("CMAKE_GENERATOR");
  111. if (gen) {
  112. cmValue extraGen =
  113. state->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
  114. std::string curGen =
  115. cmExternalMakefileProjectGenerator::CreateFullGeneratorName(*gen,
  116. *extraGen);
  117. this->setGenerator(QString::fromStdString(curGen));
  118. }
  119. cmValue platform = state->GetCacheEntryValue("CMAKE_GENERATOR_PLATFORM");
  120. if (platform) {
  121. this->setPlatform(QString(platform->c_str()));
  122. }
  123. cmValue toolset = state->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET");
  124. if (toolset) {
  125. this->setToolset(QString(toolset->c_str()));
  126. }
  127. checkOpenPossible();
  128. }
  129. }
  130. void QCMake::setPreset(const QString& name, bool setBinary)
  131. {
  132. if (this->PresetName != name) {
  133. this->PresetName = name;
  134. emit this->presetChanged(this->PresetName);
  135. if (!name.isNull()) {
  136. std::string presetName(name.toStdString());
  137. auto const& expandedPreset =
  138. this->CMakePresetsGraph.ConfigurePresets[presetName].Expanded;
  139. if (expandedPreset) {
  140. if (setBinary && !expandedPreset->BinaryDir.empty()) {
  141. QString binaryDir =
  142. QString::fromStdString(expandedPreset->BinaryDir);
  143. this->setBinaryDirectory(binaryDir);
  144. }
  145. if (expandedPreset->WarnDev) {
  146. this->CMakeInstance->SetSuppressDevWarnings(
  147. !*expandedPreset->WarnDev);
  148. }
  149. if (expandedPreset->ErrorDev) {
  150. this->CMakeInstance->SetDevWarningsAsErrors(
  151. *expandedPreset->ErrorDev);
  152. }
  153. if (expandedPreset->WarnDeprecated) {
  154. this->CMakeInstance->SetSuppressDeprecatedWarnings(
  155. !*expandedPreset->WarnDeprecated);
  156. }
  157. if (expandedPreset->ErrorDeprecated) {
  158. this->CMakeInstance->SetDeprecatedWarningsAsErrors(
  159. *expandedPreset->ErrorDeprecated);
  160. }
  161. if (expandedPreset->WarnUninitialized) {
  162. this->WarnUninitializedMode = *expandedPreset->WarnUninitialized;
  163. emit this->warnUninitializedModeChanged(
  164. *expandedPreset->WarnUninitialized);
  165. }
  166. this->Environment = this->StartEnvironment;
  167. for (auto const& v : expandedPreset->Environment) {
  168. if (v.second) {
  169. this->Environment.insert(QString::fromStdString(v.first),
  170. QString::fromStdString(v.second.value()));
  171. }
  172. }
  173. }
  174. }
  175. emit this->propertiesChanged(this->properties());
  176. }
  177. }
  178. void QCMake::setGenerator(const QString& gen)
  179. {
  180. if (this->Generator != gen) {
  181. this->Generator = gen;
  182. emit this->generatorChanged(this->Generator);
  183. }
  184. }
  185. void QCMake::setPlatform(const QString& platform)
  186. {
  187. if (this->Platform != platform) {
  188. this->Platform = platform;
  189. emit this->platformChanged(this->Platform);
  190. }
  191. }
  192. void QCMake::setToolset(const QString& toolset)
  193. {
  194. if (this->Toolset != toolset) {
  195. this->Toolset = toolset;
  196. emit this->toolsetChanged(this->Toolset);
  197. }
  198. }
  199. void QCMake::setEnvironment(const QProcessEnvironment& environment)
  200. {
  201. this->Environment = environment;
  202. }
  203. void QCMake::configure()
  204. {
  205. int err;
  206. {
  207. cmSystemTools::SaveRestoreEnvironment restoreEnv;
  208. this->setUpEnvironment();
  209. #ifdef Q_OS_WIN
  210. UINT lastErrorMode = SetErrorMode(0);
  211. #endif
  212. this->CMakeInstance->SetHomeDirectory(this->SourceDirectory.toStdString());
  213. this->CMakeInstance->SetHomeOutputDirectory(
  214. this->BinaryDirectory.toStdString());
  215. this->CMakeInstance->SetGlobalGenerator(
  216. this->CMakeInstance->CreateGlobalGenerator(
  217. this->Generator.toStdString()));
  218. this->CMakeInstance->SetGeneratorPlatform(this->Platform.toStdString());
  219. this->CMakeInstance->SetGeneratorToolset(this->Toolset.toStdString());
  220. this->CMakeInstance->LoadCache();
  221. this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode);
  222. this->CMakeInstance->PreLoadCMakeFiles();
  223. InterruptFlag = 0;
  224. cmSystemTools::ResetErrorOccurredFlag();
  225. err = this->CMakeInstance->Configure();
  226. #ifdef Q_OS_WIN
  227. SetErrorMode(lastErrorMode);
  228. #endif
  229. }
  230. emit this->propertiesChanged(this->properties());
  231. emit this->configureDone(err);
  232. }
  233. void QCMake::generate()
  234. {
  235. int err;
  236. {
  237. cmSystemTools::SaveRestoreEnvironment restoreEnv;
  238. this->setUpEnvironment();
  239. #ifdef Q_OS_WIN
  240. UINT lastErrorMode = SetErrorMode(0);
  241. #endif
  242. InterruptFlag = 0;
  243. cmSystemTools::ResetErrorOccurredFlag();
  244. err = this->CMakeInstance->Generate();
  245. #ifdef Q_OS_WIN
  246. SetErrorMode(lastErrorMode);
  247. #endif
  248. }
  249. emit this->generateDone(err);
  250. checkOpenPossible();
  251. }
  252. void QCMake::open()
  253. {
  254. #ifdef Q_OS_WIN
  255. UINT lastErrorMode = SetErrorMode(0);
  256. #endif
  257. InterruptFlag = 0;
  258. cmSystemTools::ResetErrorOccurredFlag();
  259. auto successful =
  260. this->CMakeInstance->Open(this->BinaryDirectory.toStdString(), false);
  261. #ifdef Q_OS_WIN
  262. SetErrorMode(lastErrorMode);
  263. #endif
  264. emit this->openDone(successful);
  265. }
  266. void QCMake::setProperties(const QCMakePropertyList& newProps)
  267. {
  268. QCMakePropertyList props = newProps;
  269. QStringList toremove;
  270. // set the value of properties
  271. cmState* state = this->CMakeInstance->GetState();
  272. std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
  273. for (std::string const& key : cacheKeys) {
  274. cmStateEnums::CacheEntryType t = state->GetCacheEntryType(key);
  275. if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC) {
  276. continue;
  277. }
  278. QCMakeProperty prop;
  279. prop.Key = QString::fromStdString(key);
  280. int idx = props.indexOf(prop);
  281. if (idx == -1) {
  282. toremove.append(QString::fromStdString(key));
  283. } else {
  284. prop = props[idx];
  285. #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
  286. const bool isBool = prop.Value.type() == QVariant::Bool;
  287. #else
  288. const bool isBool = prop.Value.metaType() == QMetaType::fromType<bool>();
  289. #endif
  290. if (isBool) {
  291. state->SetCacheEntryValue(key, prop.Value.toBool() ? "ON" : "OFF");
  292. } else {
  293. state->SetCacheEntryValue(key, prop.Value.toString().toStdString());
  294. }
  295. props.removeAt(idx);
  296. }
  297. }
  298. // remove some properties
  299. foreach (QString const& s, toremove) {
  300. this->CMakeInstance->UnwatchUnusedCli(s.toStdString());
  301. state->RemoveCacheEntry(s.toStdString());
  302. }
  303. // add some new properties
  304. foreach (QCMakeProperty const& s, props) {
  305. this->CMakeInstance->WatchUnusedCli(s.Key.toStdString());
  306. if (s.Type == QCMakeProperty::BOOL) {
  307. this->CMakeInstance->AddCacheEntry(
  308. s.Key.toStdString(), s.Value.toBool() ? "ON" : "OFF",
  309. s.Help.toStdString().c_str(), cmStateEnums::BOOL);
  310. } else if (s.Type == QCMakeProperty::STRING) {
  311. this->CMakeInstance->AddCacheEntry(
  312. s.Key.toStdString(), s.Value.toString().toStdString(),
  313. s.Help.toStdString().c_str(), cmStateEnums::STRING);
  314. } else if (s.Type == QCMakeProperty::PATH) {
  315. this->CMakeInstance->AddCacheEntry(
  316. s.Key.toStdString(), s.Value.toString().toStdString(),
  317. s.Help.toStdString().c_str(), cmStateEnums::PATH);
  318. } else if (s.Type == QCMakeProperty::FILEPATH) {
  319. this->CMakeInstance->AddCacheEntry(
  320. s.Key.toStdString(), s.Value.toString().toStdString(),
  321. s.Help.toStdString().c_str(), cmStateEnums::FILEPATH);
  322. }
  323. }
  324. this->CMakeInstance->SaveCache(this->BinaryDirectory.toStdString());
  325. }
  326. QCMakePropertyList QCMake::properties() const
  327. {
  328. QCMakePropertyList ret;
  329. cmState* state = this->CMakeInstance->GetState();
  330. std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
  331. for (std::string const& key : cacheKeys) {
  332. cmStateEnums::CacheEntryType t = state->GetCacheEntryType(key);
  333. if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC ||
  334. t == cmStateEnums::UNINITIALIZED) {
  335. continue;
  336. }
  337. cmValue cachedValue = state->GetCacheEntryValue(key);
  338. QCMakeProperty prop;
  339. prop.Key = QString::fromStdString(key);
  340. if (cmValue hs = state->GetCacheEntryProperty(key, "HELPSTRING")) {
  341. prop.Help = QString(hs->c_str());
  342. }
  343. prop.Value = QString(cachedValue->c_str());
  344. prop.Advanced = state->GetCacheEntryPropertyAsBool(key, "ADVANCED");
  345. if (t == cmStateEnums::BOOL) {
  346. prop.Type = QCMakeProperty::BOOL;
  347. prop.Value = cmIsOn(*cachedValue);
  348. } else if (t == cmStateEnums::PATH) {
  349. prop.Type = QCMakeProperty::PATH;
  350. } else if (t == cmStateEnums::FILEPATH) {
  351. prop.Type = QCMakeProperty::FILEPATH;
  352. } else if (t == cmStateEnums::STRING) {
  353. prop.Type = QCMakeProperty::STRING;
  354. cmValue stringsProperty = state->GetCacheEntryProperty(key, "STRINGS");
  355. if (stringsProperty) {
  356. prop.Strings = QString(stringsProperty->c_str()).split(";");
  357. }
  358. }
  359. ret.append(prop);
  360. }
  361. if (!this->PresetName.isNull()) {
  362. std::string presetName(this->PresetName.toStdString());
  363. auto const& p =
  364. this->CMakePresetsGraph.ConfigurePresets.at(presetName).Expanded;
  365. if (p) {
  366. for (auto const& v : p->CacheVariables) {
  367. if (!v.second) {
  368. continue;
  369. }
  370. QCMakeProperty prop;
  371. prop.Key = QString::fromStdString(v.first);
  372. prop.Value = QString::fromStdString(v.second->Value);
  373. prop.Type = QCMakeProperty::STRING;
  374. if (!v.second->Type.empty()) {
  375. auto type = cmState::StringToCacheEntryType(v.second->Type);
  376. switch (type) {
  377. case cmStateEnums::BOOL:
  378. prop.Type = QCMakeProperty::BOOL;
  379. prop.Value = cmIsOn(v.second->Value);
  380. break;
  381. case cmStateEnums::PATH:
  382. prop.Type = QCMakeProperty::PATH;
  383. break;
  384. case cmStateEnums::FILEPATH:
  385. prop.Type = QCMakeProperty::FILEPATH;
  386. break;
  387. default:
  388. prop.Type = QCMakeProperty::STRING;
  389. break;
  390. }
  391. }
  392. // QCMakeCacheModel prefers variables earlier in the list rather than
  393. // later, so overwrite them if they already exist rather than simply
  394. // appending
  395. bool found = false;
  396. for (auto& orig : ret) {
  397. if (orig.Key == prop.Key) {
  398. orig = prop;
  399. found = true;
  400. break;
  401. }
  402. }
  403. if (!found) {
  404. ret.append(prop);
  405. }
  406. }
  407. }
  408. }
  409. return ret;
  410. }
  411. void QCMake::interrupt()
  412. {
  413. this->InterruptFlag.ref();
  414. }
  415. bool QCMake::interruptCallback()
  416. {
  417. #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
  418. return this->InterruptFlag.load();
  419. #else
  420. return this->InterruptFlag.loadRelaxed();
  421. #endif
  422. }
  423. void QCMake::progressCallback(const std::string& msg, float percent)
  424. {
  425. if (percent >= 0) {
  426. emit this->progressChanged(QString::fromStdString(msg), percent);
  427. } else {
  428. emit this->outputMessage(QString::fromStdString(msg));
  429. }
  430. QCoreApplication::processEvents();
  431. }
  432. void QCMake::messageCallback(std::string const& msg, const char* /*title*/)
  433. {
  434. emit this->errorMessage(QString::fromStdString(msg));
  435. QCoreApplication::processEvents();
  436. }
  437. void QCMake::stdoutCallback(std::string const& msg)
  438. {
  439. emit this->outputMessage(QString::fromStdString(msg));
  440. QCoreApplication::processEvents();
  441. }
  442. void QCMake::stderrCallback(std::string const& msg)
  443. {
  444. emit this->outputMessage(QString::fromStdString(msg));
  445. QCoreApplication::processEvents();
  446. }
  447. void QCMake::setUpEnvironment() const
  448. {
  449. auto env = QProcessEnvironment::systemEnvironment();
  450. for (auto const& key : env.keys()) {
  451. cmSystemTools::UnsetEnv(key.toStdString().c_str());
  452. }
  453. for (auto const& var : this->Environment.toStringList()) {
  454. cmSystemTools::PutEnv(var.toStdString());
  455. }
  456. }
  457. void QCMake::loadPresets()
  458. {
  459. auto result = this->CMakePresetsGraph.ReadProjectPresets(
  460. this->SourceDirectory.toStdString(), true);
  461. if (result != this->LastLoadPresetsResult &&
  462. result != cmCMakePresetsGraph::ReadFileResult::READ_OK) {
  463. emit this->presetLoadError(this->SourceDirectory, result);
  464. }
  465. this->LastLoadPresetsResult = result;
  466. QVector<QCMakePreset> presets;
  467. for (auto const& name : this->CMakePresetsGraph.ConfigurePresetOrder) {
  468. auto const& it = this->CMakePresetsGraph.ConfigurePresets[name];
  469. auto const& p = it.Unexpanded;
  470. if (p.Hidden) {
  471. continue;
  472. }
  473. QCMakePreset preset;
  474. preset.name = QString::fromStdString(p.Name);
  475. preset.displayName = QString::fromStdString(p.DisplayName);
  476. preset.description = QString::fromStdString(p.Description);
  477. preset.generator = QString::fromStdString(p.Generator);
  478. preset.architecture = QString::fromStdString(p.Architecture);
  479. preset.setArchitecture = !p.ArchitectureStrategy ||
  480. p.ArchitectureStrategy == cmCMakePresetsGraph::ArchToolsetStrategy::Set;
  481. preset.toolset = QString::fromStdString(p.Toolset);
  482. preset.setToolset = !p.ToolsetStrategy ||
  483. p.ToolsetStrategy == cmCMakePresetsGraph::ArchToolsetStrategy::Set;
  484. preset.enabled = it.Expanded && it.Expanded->ConditionResult &&
  485. std::find_if(this->AvailableGenerators.begin(),
  486. this->AvailableGenerators.end(),
  487. [&p](const cmake::GeneratorInfo& g) {
  488. return g.name == p.Generator;
  489. }) != this->AvailableGenerators.end();
  490. presets.push_back(preset);
  491. }
  492. emit this->presetsChanged(presets);
  493. }
  494. QString QCMake::binaryDirectory() const
  495. {
  496. return this->BinaryDirectory;
  497. }
  498. QString QCMake::sourceDirectory() const
  499. {
  500. return this->SourceDirectory;
  501. }
  502. QString QCMake::generator() const
  503. {
  504. return this->Generator;
  505. }
  506. QProcessEnvironment QCMake::environment() const
  507. {
  508. return this->Environment;
  509. }
  510. std::vector<cmake::GeneratorInfo> const& QCMake::availableGenerators() const
  511. {
  512. return AvailableGenerators;
  513. }
  514. void QCMake::deleteCache()
  515. {
  516. // delete cache
  517. this->CMakeInstance->DeleteCache(this->BinaryDirectory.toStdString());
  518. // reload to make our cache empty
  519. this->CMakeInstance->LoadCache(this->BinaryDirectory.toStdString());
  520. // emit no generator and no properties
  521. this->setGenerator(QString());
  522. this->setToolset(QString());
  523. QCMakePropertyList props = this->properties();
  524. emit this->propertiesChanged(props);
  525. }
  526. void QCMake::reloadCache()
  527. {
  528. // emit that the cache was cleaned out
  529. QCMakePropertyList props;
  530. emit this->propertiesChanged(props);
  531. // reload
  532. this->CMakeInstance->LoadCache(this->BinaryDirectory.toStdString());
  533. // emit new cache properties
  534. props = this->properties();
  535. emit this->propertiesChanged(props);
  536. }
  537. void QCMake::setDebugOutput(bool flag)
  538. {
  539. if (flag != this->CMakeInstance->GetDebugOutput()) {
  540. this->CMakeInstance->SetDebugOutputOn(flag);
  541. emit this->debugOutputChanged(flag);
  542. }
  543. }
  544. bool QCMake::getDebugOutput() const
  545. {
  546. return this->CMakeInstance->GetDebugOutput();
  547. }
  548. bool QCMake::getSuppressDevWarnings()
  549. {
  550. return this->CMakeInstance->GetSuppressDevWarnings();
  551. }
  552. void QCMake::setSuppressDevWarnings(bool value)
  553. {
  554. this->CMakeInstance->SetSuppressDevWarnings(value);
  555. }
  556. bool QCMake::getSuppressDeprecatedWarnings()
  557. {
  558. return this->CMakeInstance->GetSuppressDeprecatedWarnings();
  559. }
  560. void QCMake::setSuppressDeprecatedWarnings(bool value)
  561. {
  562. this->CMakeInstance->SetSuppressDeprecatedWarnings(value);
  563. }
  564. bool QCMake::getDevWarningsAsErrors()
  565. {
  566. return this->CMakeInstance->GetDevWarningsAsErrors();
  567. }
  568. void QCMake::setDevWarningsAsErrors(bool value)
  569. {
  570. this->CMakeInstance->SetDevWarningsAsErrors(value);
  571. }
  572. bool QCMake::getDeprecatedWarningsAsErrors()
  573. {
  574. return this->CMakeInstance->GetDeprecatedWarningsAsErrors();
  575. }
  576. void QCMake::setDeprecatedWarningsAsErrors(bool value)
  577. {
  578. this->CMakeInstance->SetDeprecatedWarningsAsErrors(value);
  579. }
  580. void QCMake::setWarnUninitializedMode(bool value)
  581. {
  582. this->WarnUninitializedMode = value;
  583. }
  584. void QCMake::checkOpenPossible()
  585. {
  586. std::string data = this->BinaryDirectory.toStdString();
  587. auto possible = this->CMakeInstance->Open(data, true);
  588. emit openPossible(possible);
  589. }