| 2437 | } |
| 2438 | |
| 2439 | cmGeneratorTarget::SourceVariables cmGeneratorTarget::GetSourceVariables( |
| 2440 | cmSourceFile const* sf, std::string const& config) |
| 2441 | { |
| 2442 | SourceVariables vars; |
| 2443 | auto const language = sf->GetLanguage(); |
| 2444 | auto const targetType = this->GetType(); |
| 2445 | auto const* const lg = this->GetLocalGenerator(); |
| 2446 | auto const* const gg = this->GetGlobalGenerator(); |
| 2447 | auto const* const mf = this->Makefile; |
| 2448 | |
| 2449 | // PDB settings. |
| 2450 | { |
| 2451 | if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") || |
| 2452 | mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID") || |
| 2453 | mf->GetDefinition("MSVC_CUDA_ARCHITECTURE_ID")) { |
| 2454 | std::string pdbPath; |
| 2455 | std::string compilePdbPath; |
| 2456 | if (targetType <= cmStateEnums::OBJECT_LIBRARY) { |
| 2457 | compilePdbPath = this->GetCompilePDBPath(config); |
| 2458 | if (compilePdbPath.empty()) { |
| 2459 | // Match VS default: `$(IntDir)vc$(PlatformToolsetVersion).pdb`. |
| 2460 | // A trailing slash tells the toolchain to add its default file name. |
| 2461 | compilePdbPath = this->GetSupportDirectory(); |
| 2462 | if (gg->IsMultiConfig()) { |
| 2463 | compilePdbPath = cmStrCat(compilePdbPath, '/', config); |
| 2464 | } |
| 2465 | compilePdbPath += '/'; |
| 2466 | if (targetType == cmStateEnums::STATIC_LIBRARY) { |
| 2467 | // Match VS default for static libs: `$(IntDir)$(ProjectName).pdb`. |
| 2468 | compilePdbPath = cmStrCat(compilePdbPath, this->GetName(), ".pdb"); |
| 2469 | } |
| 2470 | } |
| 2471 | } |
| 2472 | |
| 2473 | if (targetType == cmStateEnums::EXECUTABLE || |
| 2474 | targetType == cmStateEnums::STATIC_LIBRARY || |
| 2475 | targetType == cmStateEnums::SHARED_LIBRARY || |
| 2476 | targetType == cmStateEnums::MODULE_LIBRARY) { |
| 2477 | pdbPath = cmStrCat(this->GetPDBDirectory(config), '/', |
| 2478 | this->GetPDBName(config)); |
| 2479 | } |
| 2480 | |
| 2481 | vars.TargetPDB = lg->ConvertToOutputFormat( |
| 2482 | gg->ConvertToOutputPath(std::move(pdbPath)), cmOutputConverter::SHELL); |
| 2483 | vars.TargetCompilePDB = lg->ConvertToOutputFormat( |
| 2484 | gg->ConvertToOutputPath(std::move(compilePdbPath)), |
| 2485 | cmOutputConverter::SHELL); |
| 2486 | } |
| 2487 | } |
| 2488 | |
| 2489 | // Object settings. |
| 2490 | { |
| 2491 | std::string const targetSupportDir = lg->MaybeRelativeToTopBinDir( |
| 2492 | gg->ConvertToOutputPath(this->GetCMFSupportDirectory())); |
| 2493 | std::string const objectDir = gg->ConvertToOutputPath( |
| 2494 | cmStrCat(this->GetSupportDirectory(), gg->GetConfigDirectory(config))); |
| 2495 | std::string const objectFileName = this->GetObjectName(sf); |
| 2496 | std::string const objectFilePath = |
no test coverage detected