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

Method GetSourceVariables

Source/cmGeneratorTarget.cxx:2439–2540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2437}
2438
2439cmGeneratorTarget::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 =

Callers 1

Calls 15

GetTypeMethod · 0.95
GetLocalGeneratorMethod · 0.95
GetGlobalGeneratorMethod · 0.95
GetCompilePDBPathMethod · 0.95
GetSupportDirectoryMethod · 0.95
GetPDBDirectoryMethod · 0.95
GetPDBNameMethod · 0.95
moveFunction · 0.85
GetLanguageMethod · 0.80
GetConfigDirectoryMethod · 0.80

Tested by

no test coverage detected