QCMake.cxx 20 KB

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