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

Method GetMocBuildPath

Source/cmQtAutoGenInitializer.cxx:2428–2468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2426}
2427
2428std::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
2470bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars,
2471 std::string const& executable,

Callers 1

SetupWriteAutogenInfoMethod · 0.95

Calls 5

getPartMethod · 0.80
emplaceMethod · 0.80
GetExtensionMethod · 0.80
cmStrCatFunction · 0.70
ErrorClass · 0.70

Tested by

no test coverage detected