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

Method ComputeFlagsForObject

Source/cmExtraSublimeTextGenerator.cxx:343–377  ·  view source on GitHub ↗

TODO: Most of the code is picked up from the Ninja generator, refactor it.

Source from the content-addressed store, hash-verified

341
342// TODO: Most of the code is picked up from the Ninja generator, refactor it.
343std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject(
344 cmSourceFile* source, cmLocalGenerator* lg, cmGeneratorTarget* gtgt)
345{
346 std::string flags;
347 std::string language = source->GetOrDetermineLanguage();
348 if (language.empty()) {
349 language = "C";
350 }
351
352 // Explicitly add the explicit language flag before any other flag
353 // so user flags can override it.
354 gtgt->AddExplicitLanguageFlags(flags, *source);
355
356 std::string const& config =
357 lg->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
358
359 lg->GetTargetCompileFlags(gtgt, config, language, flags);
360
361 // Add source file specific flags.
362 cmGeneratorExpressionInterpreter genexInterpreter(lg, config, gtgt,
363 language);
364
365 std::string const COMPILE_FLAGS("COMPILE_FLAGS");
366 if (cmValue cflags = source->GetProperty(COMPILE_FLAGS)) {
367 lg->AppendFlags(flags, genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS));
368 }
369
370 std::string const COMPILE_OPTIONS("COMPILE_OPTIONS");
371 if (cmValue coptions = source->GetProperty(COMPILE_OPTIONS)) {
372 lg->AppendCompileOptions(
373 flags, genexInterpreter.Evaluate(*coptions, COMPILE_OPTIONS));
374 }
375
376 return flags;
377}
378
379// TODO: Refactor with
380// void cmMakefileTargetGenerator::WriteTargetLanguageFlags().

Callers 1

AppendTargetMethod · 0.95

Calls 8

GetTargetCompileFlagsMethod · 0.80
AppendCompileOptionsMethod · 0.80
emptyMethod · 0.45
GetMakefileMethod · 0.45
GetPropertyMethod · 0.45
AppendFlagsMethod · 0.45
EvaluateMethod · 0.45

Tested by

no test coverage detected