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

Method WriteTargetLanguageFlags

Source/cmMakefileTargetGenerator.cxx:543–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

541}
542
543void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
544{
545 // write language flags for target
546 std::set<std::string> languages;
547 this->GeneratorTarget->GetLanguages(
548 languages, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
549 // put the compiler in the rules.make file so that if it changes
550 // things rebuild
551 for (std::string const& language : languages) {
552 std::string compiler = cmStrCat("CMAKE_", language, "_COMPILER");
553 *this->FlagFileStream << "# compile " << language << " with "
554 << this->Makefile->GetSafeDefinition(compiler)
555 << "\n";
556 }
557
558 bool const escapeOctothorpe = this->GlobalGenerator->CanEscapeOctothorpe();
559
560 for (std::string const& language : languages) {
561 std::string defines = this->GetDefines(language, this->GetConfigName());
562 std::string includes = this->GetIncludes(language, this->GetConfigName());
563 if (escapeOctothorpe) {
564 // Escape comment characters so they do not terminate assignment.
565 cmSystemTools::ReplaceString(defines, "#", "\\#");
566 cmSystemTools::ReplaceString(includes, "#", "\\#");
567 }
568 *this->FlagFileStream << language << "_DEFINES = " << defines << "\n\n";
569 *this->FlagFileStream << language << "_INCLUDES = " << includes << "\n\n";
570
571 std::vector<std::string> architectures =
572 this->GeneratorTarget->GetAppleArchs(this->GetConfigName(), language);
573 architectures.emplace_back();
574
575 for (std::string const& arch : architectures) {
576 std::string flags =
577 this->GetFlags(language, this->GetConfigName(), arch);
578 if (escapeOctothorpe) {
579 cmSystemTools::ReplaceString(flags, "#", "\\#");
580 }
581 *this->FlagFileStream << language << "_FLAGS" << arch << " = " << flags
582 << "\n\n";
583 }
584 }
585}
586
587void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()(
588 cmSourceFile const& source, char const* pkgloc, std::string const& config)

Callers 2

WriteRuleFilesMethod · 0.80
WriteRuleFilesMethod · 0.80

Calls 8

GetAppleArchsMethod · 0.80
emplace_backMethod · 0.80
GetFlagsMethod · 0.80
cmStrCatFunction · 0.70
GetLanguagesMethod · 0.45
CanEscapeOctothorpeMethod · 0.45
GetDefinesMethod · 0.45
GetIncludesMethod · 0.45

Tested by

no test coverage detected