| 2468 | } |
| 2469 | |
| 2470 | bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars, |
| 2471 | std::string const& executable, |
| 2472 | bool ignoreMissingTarget) const |
| 2473 | { |
| 2474 | auto print_err = [this, &genVars](std::string const& err) { |
| 2475 | cmSystemTools::Error(cmStrCat(genVars.GenNameUpper, " for target ", |
| 2476 | this->GenTarget->GetName(), ": ", err)); |
| 2477 | }; |
| 2478 | |
| 2479 | // Custom executable |
| 2480 | { |
| 2481 | std::string const prop = cmStrCat(genVars.GenNameUpper, "_EXECUTABLE"); |
| 2482 | std::string const& val = this->GenTarget->Target->GetSafeProperty(prop); |
| 2483 | if (!val.empty()) { |
| 2484 | // Evaluate generator expression |
| 2485 | { |
| 2486 | cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); |
| 2487 | cmGeneratorExpression ge(*this->Makefile->GetCMakeInstance(), lfbt); |
| 2488 | std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(val); |
| 2489 | if (this->MultiConfig && this->UseBetterGraph) { |
| 2490 | for (auto const& config : this->ConfigsList) { |
| 2491 | genVars.Executable.Config[config] = |
| 2492 | cge->Evaluate(this->LocalGen, config); |
| 2493 | } |
| 2494 | } else { |
| 2495 | genVars.Executable.Default = cge->Evaluate(this->LocalGen, ""); |
| 2496 | } |
| 2497 | } |
| 2498 | |
| 2499 | if (genVars.Executable.Default.empty() && |
| 2500 | genVars.Executable.Config.empty() && !ignoreMissingTarget) { |
| 2501 | print_err(prop + " evaluates to an empty value"); |
| 2502 | return false; |
| 2503 | } |
| 2504 | |
| 2505 | // Create empty compiler features. |
| 2506 | if (this->MultiConfig && this->UseBetterGraph) { |
| 2507 | for (auto const& config : this->ConfigsList) { |
| 2508 | genVars.ExecutableFeatures.Config[config] = |
| 2509 | std::make_shared<cmQtAutoGen::CompilerFeatures>(); |
| 2510 | } |
| 2511 | } else { |
| 2512 | genVars.ExecutableFeatures.Default = |
| 2513 | std::make_shared<cmQtAutoGen::CompilerFeatures>(); |
| 2514 | } |
| 2515 | return true; |
| 2516 | } |
| 2517 | } |
| 2518 | |
| 2519 | // Find executable target |
| 2520 | { |
| 2521 | // Find executable target name |
| 2522 | cm::string_view prefix; |
| 2523 | if (this->QtVersion.Major == 4) { |
| 2524 | prefix = "Qt4::"; |
| 2525 | } else if (this->QtVersion.Major == 5) { |
| 2526 | prefix = "Qt5::"; |
| 2527 | } else if (this->QtVersion.Major == 6) { |
no test coverage detected