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

Method CreateBuildSettings

Source/cmGlobalXCodeGenerator.cxx:2551–3270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2549}
2550
2551void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
2552 cmXCodeObject* buildSettings,
2553 std::string const& configName)
2554{
2555 if (!gtgt->IsInBuildSystem()) {
2556 return;
2557 }
2558
2559 std::string defFlags;
2560 bool shared = ((gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) ||
2561 (gtgt->GetType() == cmStateEnums::MODULE_LIBRARY));
2562 bool binary = ((gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) ||
2563 (gtgt->GetType() == cmStateEnums::STATIC_LIBRARY) ||
2564 (gtgt->GetType() == cmStateEnums::EXECUTABLE) || shared);
2565
2566 // Compute the compilation flags for each language.
2567 std::set<std::string> languages;
2568 gtgt->GetLanguages(languages, configName);
2569 std::map<std::string, std::string> cflags;
2570 for (auto const& lang : languages) {
2571 std::string& flags = cflags[lang];
2572
2573 // Add language-specific flags.
2574 this->CurrentLocalGenerator->AddLanguageFlags(
2575 flags, gtgt, cmBuildStep::Compile, lang, configName);
2576
2577 if (gtgt->IsIPOEnabled(lang, configName)) {
2578 this->CurrentLocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
2579 }
2580
2581 this->CurrentLocalGenerator->AddFeatureFlags(flags, gtgt, lang,
2582 configName);
2583
2584 this->CurrentLocalGenerator->AddVisibilityPresetFlags(flags, gtgt, lang);
2585
2586 this->CurrentLocalGenerator->AddCompileOptions(flags, gtgt, lang,
2587 configName);
2588 }
2589
2590 std::string llang = gtgt->GetLinkerLanguage(configName);
2591 if (binary && llang.empty()) {
2592 cmSystemTools::Error(
2593 cmStrCat("CMake can not determine linker language for target: ",
2594 gtgt->GetName()));
2595 return;
2596 }
2597
2598 // Choose a language to use for target-wide preprocessor definitions.
2599 static char const* ppLangs[] = { "CXX", "C", "OBJCXX", "OBJC" };
2600 std::string langForPreprocessorDefinitions;
2601 if (cm::contains(ppLangs, llang)) {
2602 langForPreprocessorDefinitions = llang;
2603 } else {
2604 for (char const* l : ppLangs) {
2605 if (languages.count(l)) {
2606 langForPreprocessorDefinitions = l;
2607 break;
2608 }

Callers 1

AddConfigurationsMethod · 0.95

Calls 15

CreateStringMethod · 0.95
AppendDefinesMethod · 0.95
CreateObjectMethod · 0.95
GetTargetTempDirMethod · 0.95
GetCMakeCFGIntDirMethod · 0.95
GetTargetProductTypeMethod · 0.95
XCodeEscapePathMethod · 0.95
ExtractFlagRegexMethod · 0.95
ExtractFlagMethod · 0.95
ExpandCFGIntDirMethod · 0.95

Tested by

no test coverage detected