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

Method ComputeDefines

Source/cmNinjaTargetGenerator.cxx:306–337  ·  view source on GitHub ↗

TODO: Refactor with void cmMakefileTargetGenerator::WriteTargetLanguageFlags().

Source from the content-addressed store, hash-verified

304// TODO: Refactor with
305// void cmMakefileTargetGenerator::WriteTargetLanguageFlags().
306std::string cmNinjaTargetGenerator::ComputeDefines(cmSourceFile const* source,
307 std::string const& language,
308 std::string const& config)
309{
310 std::set<std::string> defines;
311 cmGeneratorExpressionInterpreter genexInterpreter(
312 this->LocalGenerator, config, this->GeneratorTarget, language);
313
314 // Seriously??
315 if (this->GetGlobalGenerator()->IsMultiConfig()) {
316 defines.insert(cmStrCat("CMAKE_INTDIR=\"", config, '"'));
317 }
318
319 std::string const COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
320 if (cmValue compile_defs = source->GetProperty(COMPILE_DEFINITIONS)) {
321 this->LocalGenerator->AppendDefines(
322 defines, genexInterpreter.Evaluate(*compile_defs, COMPILE_DEFINITIONS));
323 }
324
325 std::string defPropName =
326 cmStrCat("COMPILE_DEFINITIONS_", cmSystemTools::UpperCase(config));
327 if (cmValue config_compile_defs = source->GetProperty(defPropName)) {
328 this->LocalGenerator->AppendDefines(
329 defines,
330 genexInterpreter.Evaluate(*config_compile_defs, COMPILE_DEFINITIONS));
331 }
332
333 std::string definesString = this->GetDefines(language, config);
334 this->LocalGenerator->JoinDefines(defines, definesString, language);
335
336 return definesString;
337}
338
339std::string cmNinjaTargetGenerator::ComputeIncludes(
340 cmSourceFile const* source, std::string const& language,

Calls 9

GetGlobalGeneratorMethod · 0.95
JoinDefinesMethod · 0.80
cmStrCatFunction · 0.70
IsMultiConfigMethod · 0.45
insertMethod · 0.45
GetPropertyMethod · 0.45
AppendDefinesMethod · 0.45
EvaluateMethod · 0.45
GetDefinesMethod · 0.45

Tested by

no test coverage detected