MCPcopy Create free account
hub / github.com/Kitware/CMake / InitAutogenTarget

Method InitAutogenTarget

Source/cmQtAutoGenInitializer.cxx:1365–1697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1363}
1364
1365bool cmQtAutoGenInitializer::InitAutogenTarget()
1366{
1367 // Register info file as generated by CMake
1368 this->Makefile->AddCMakeOutputFile(this->AutogenTarget.InfoFile);
1369
1370 // Determine whether to use a depfile for the AUTOGEN target.
1371 bool const useDepfile = [this]() -> bool {
1372 auto const& gen = this->GlobalGen->GetName();
1373 return this->QtVersion >= IntegerVersion(5, 15) &&
1374 (gen.find("Ninja") != std::string::npos ||
1375 gen.find("Make") != std::string::npos);
1376 }();
1377
1378 // Files provided by the autogen target
1379 std::vector<std::string> autogenByproducts;
1380 std::vector<std::string> timestampByproducts;
1381 if (this->Moc.Enabled) {
1382 this->AddGeneratedSource(this->Moc.CompilationFile, this->Moc, true);
1383 if (useDepfile) {
1384 if (this->CrossConfig &&
1385 this->GlobalGen->GetName().find("Ninja") != std::string::npos &&
1386 !this->UseBetterGraph) {
1387 // Make all mocs_compilation_<CONFIG>.cpp files byproducts of the
1388 // ${target}_autogen/timestamp custom command.
1389 // We cannot just use Moc.CompilationFileGenex here, because that
1390 // custom command runs cmake_autogen for each configuration.
1391 for (auto const& p : this->Moc.CompilationFile.Config) {
1392 timestampByproducts.push_back(p.second);
1393 }
1394 } else {
1395 timestampByproducts.push_back(this->Moc.CompilationFileGenex);
1396 }
1397 } else {
1398 autogenByproducts.push_back(this->Moc.CompilationFileGenex);
1399 }
1400 }
1401
1402 if (this->Uic.Enabled) {
1403 for (auto const& file : this->Uic.UiHeaders) {
1404 this->AddGeneratedSource(file.first, this->Uic);
1405 if (!this->GlobalGen->IsFastbuild()) {
1406 autogenByproducts.push_back(file.second);
1407 }
1408 }
1409 }
1410
1411 // Compose target comment
1412 std::string autogenComment;
1413 {
1414 std::string tools;
1415 if (this->Moc.Enabled) {
1416 tools += "MOC";
1417 }
1418 if (this->Uic.Enabled) {
1419 if (!tools.empty()) {
1420 tools += " and ";
1421 }
1422 tools += "UIC";

Callers 1

InitCustomTargetsMethod · 0.95

Calls 15

AddGeneratedSourceMethod · 0.95
IntegerVersionClass · 0.85
cmMakeCommandLineFunction · 0.85
moveFunction · 0.85
StaticLibraryCycleFunction · 0.85
AddCMakeOutputFileMethod · 0.80
push_backMethod · 0.80
AddUtilityMethod · 0.80
SetOutputsMethod · 0.80
SetDependsMethod · 0.80
c_strMethod · 0.80
SetEscapeOldStyleMethod · 0.80

Tested by

no test coverage detected