| 2426 | } |
| 2427 | |
| 2428 | std::string cmQtAutoGenInitializer::GetMocBuildPath(MUFile const& muf) |
| 2429 | { |
| 2430 | std::string res; |
| 2431 | if (!muf.MocIt) { |
| 2432 | return res; |
| 2433 | } |
| 2434 | |
| 2435 | std::string basePath = |
| 2436 | cmStrCat(this->PathCheckSum.getPart(muf.FullPath), "/moc_", |
| 2437 | FileNameWithoutLastExtension(muf.FullPath)); |
| 2438 | |
| 2439 | res = cmStrCat(basePath, ".cpp"); |
| 2440 | if (this->Moc.EmittedBuildPaths.emplace(res).second) { |
| 2441 | return res; |
| 2442 | } |
| 2443 | |
| 2444 | // File name already emitted. |
| 2445 | // Try appending the header suffix to the base path. |
| 2446 | basePath = cmStrCat(basePath, '_', muf.SF->GetExtension()); |
| 2447 | res = cmStrCat(basePath, ".cpp"); |
| 2448 | if (this->Moc.EmittedBuildPaths.emplace(res).second) { |
| 2449 | return res; |
| 2450 | } |
| 2451 | |
| 2452 | // File name with header extension already emitted. |
| 2453 | // Try adding a number to the base path. |
| 2454 | constexpr std::size_t number_begin = 2; |
| 2455 | constexpr std::size_t number_end = 256; |
| 2456 | for (std::size_t ii = number_begin; ii != number_end; ++ii) { |
| 2457 | res = cmStrCat(basePath, '_', ii, ".cpp"); |
| 2458 | if (this->Moc.EmittedBuildPaths.emplace(res).second) { |
| 2459 | return res; |
| 2460 | } |
| 2461 | } |
| 2462 | |
| 2463 | // Output file name conflict (unlikely, but still...) |
| 2464 | cmSystemTools::Error( |
| 2465 | cmStrCat("moc output file name conflict for ", muf.FullPath)); |
| 2466 | |
| 2467 | return res; |
| 2468 | } |
| 2469 | |
| 2470 | bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars, |
| 2471 | std::string const& executable, |
no test coverage detected