aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clangcodemodel/clangcodemodelplugin.cpp
diff options
context:
space:
mode:
authorIvan Donchevskii <[email protected]>2019-03-13 14:31:50 +0100
committerIvan Donchevskii <[email protected]>2019-03-14 07:36:38 +0000
commitd2154e6c40856ff4f044210a928587f3b06ec344 (patch)
tree3d23100d51cce3ce7607c8c1e6845ac920ad679f /src/plugins/clangcodemodel/clangcodemodelplugin.cpp
parenta0072afd492d9653d035b3217ddda954154b2d24 (diff)
Clang: Save compilation database to the build directory
For example CMake puts compile_commands.json into the build directory and it makes sense because it uses some target-specific command line options. Change-Id: I92a5b391f35e3f75bbcf41b8efff448f197895bb Reviewed-by: Marco Bubke <[email protected]> Reviewed-by: Alessandro Portale <[email protected]> Reviewed-by: Christian Kandeler <[email protected]>
Diffstat (limited to 'src/plugins/clangcodemodel/clangcodemodelplugin.cpp')
-rw-r--r--src/plugins/clangcodemodel/clangcodemodelplugin.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/plugins/clangcodemodel/clangcodemodelplugin.cpp b/src/plugins/clangcodemodel/clangcodemodelplugin.cpp
index 11de94c3951..a4a1591cf47 100644
--- a/src/plugins/clangcodemodel/clangcodemodelplugin.cpp
+++ b/src/plugins/clangcodemodel/clangcodemodelplugin.cpp
@@ -68,13 +68,12 @@ void ClangCodeModelPlugin::generateCompilationDB() {
using namespace CppTools;
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
- if (!project)
+ if (!project || !project->activeTarget())
return;
- m_generatorWatcher.setFuture(QtConcurrent::run(
- &Utils::generateCompilationDB,
- project->projectDirectory(),
- CppModelManager::instance()->projectInfo(project)));
+ m_generatorWatcher.setFuture(
+ QtConcurrent::run(&Utils::generateCompilationDB,
+ CppModelManager::instance()->projectInfo(project)));
}
static bool isDBGenerationEnabled(ProjectExplorer::Project *project)