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

Method DetectCompilerFlags

Source/cmFastbuildNormalTargetGenerator.cxx:113–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113std::string cmFastbuildNormalTargetGenerator::DetectCompilerFlags(
114 cmSourceFile const& srcFile, std::string const& arch)
115{
116 std::string const language = srcFile.GetLanguage();
117 cmGeneratorExpressionInterpreter genexInterpreter(
118 this->GetLocalGenerator(), Config, this->GeneratorTarget, language);
119
120 std::vector<std::string> sourceIncludesVec;
121 if (cmValue cincludes = srcFile.GetProperty(INCLUDE_DIRECTORIES)) {
122 this->LocalGenerator->AppendIncludeDirectories(
123 sourceIncludesVec,
124 genexInterpreter.Evaluate(*cincludes, INCLUDE_DIRECTORIES), srcFile);
125 }
126 std::string sourceIncludesStr = this->LocalGenerator->GetIncludeFlags(
127 sourceIncludesVec, this->GeneratorTarget, language, Config, false);
128 LogMessage(cmStrCat("sourceIncludes = ", sourceIncludesStr));
129
130 std::string compileFlags =
131 CompileFlagsByLangAndArch[std::make_pair(language, arch)];
132 this->GeneratorTarget->AddExplicitLanguageFlags(compileFlags, srcFile);
133
134 if (cmValue const cflags = srcFile.GetProperty(COMPILE_FLAGS)) {
135 this->LocalGenerator->AppendFlags(
136 compileFlags, genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS));
137 }
138
139 if (cmValue const coptions = srcFile.GetProperty(COMPILE_OPTIONS)) {
140 this->LocalGenerator->AppendCompileOptions(
141 compileFlags, genexInterpreter.Evaluate(*coptions, COMPILE_OPTIONS));
142 }
143 // Source includes take precedence over target includes.
144 this->LocalGenerator->AppendFlags(compileFlags, sourceIncludesStr);
145 this->LocalGenerator->AppendFlags(compileFlags,
146 TargetIncludesByLanguage[language]);
147
148 if (language == "Fortran") {
149 this->AppendFortranFormatFlags(compileFlags, srcFile);
150 this->AppendFortranPreprocessFlags(compileFlags, srcFile);
151 }
152
153 LogMessage(cmStrCat("compileFlags = ", compileFlags));
154 return compileFlags;
155}
156
157void cmFastbuildNormalTargetGenerator::SplitLinkerFromArgs(
158 std::string const& command, std::string& outLinkerExecutable,

Callers

nothing calls this directly

Calls 12

GetLanguageMethod · 0.80
GetIncludeFlagsMethod · 0.80
AppendCompileOptionsMethod · 0.80
cmStrCatFunction · 0.70
GetLocalGeneratorMethod · 0.45
GetPropertyMethod · 0.45
EvaluateMethod · 0.45
AppendFlagsMethod · 0.45

Tested by

no test coverage detected