TODO: Most of the code is picked up from the Ninja generator, refactor it.
| 341 | |
| 342 | // TODO: Most of the code is picked up from the Ninja generator, refactor it. |
| 343 | std::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(). |
no test coverage detected