diff --git a/src/lib_cxx/utility/codeblocks/CodeblocksProject.cpp b/src/lib_cxx/utility/codeblocks/CodeblocksProject.cpp index 21ff29ed..d12d9c61 100644 --- a/src/lib_cxx/utility/codeblocks/CodeblocksProject.cpp +++ b/src/lib_cxx/utility/codeblocks/CodeblocksProject.cpp @@ -225,32 +225,32 @@ std::vector> Project::getIndexerCommands( sourceGroupSettings->getFrameworkSearchPathsExpandedAndAbsolute(), appSettings->getFrameworkSearchPathsExpanded()); - OrderedCache> optionsCache( - [&](const std::wstring& targetName) { - std::vector compilerFlags; - for (std::shared_ptr target: m_targets) + OrderedCache> optionsCache([&](const std::wstring& targetName) { + std::vector compilerFlags; + for (std::shared_ptr target: m_targets) + { + if (target && target->getTitle() == targetName) { - if (target->getTitle() == targetName) + if (std::shared_ptr compiler = target->getCompiler()) { compilerFlags = utility::concat( IndexerCommandCxx::getCompilerFlagsForSystemHeaderSearchPaths( - utility::convert( - target->getCompiler()->getDirectories())), - target->getCompiler()->getOptions()); + utility::convert(compiler->getDirectories())), + compiler->getOptions()); break; } } + } - utility::append( - compilerFlags, - IndexerCommandCxx::getCompilerFlagsForSystemHeaderSearchPaths( - systemHeaderSearchPaths)); - utility::append( - compilerFlags, - IndexerCommandCxx::getCompilerFlagsForFrameworkSearchPaths(frameworkSearchPaths)); - utility::append(compilerFlags, sourceGroupSettings->getCompilerFlags()); - return compilerFlags; - }); + utility::append( + compilerFlags, + IndexerCommandCxx::getCompilerFlagsForSystemHeaderSearchPaths(systemHeaderSearchPaths)); + utility::append( + compilerFlags, + IndexerCommandCxx::getCompilerFlagsForFrameworkSearchPaths(frameworkSearchPaths)); + utility::append(compilerFlags, sourceGroupSettings->getCompilerFlags()); + return compilerFlags; + }); std::vector> indexerCommands; std::vector> nonTargetIndexerCommands;