diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp index de6d366f98c..966364b4b4f 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp @@ -440,8 +440,13 @@ Utils::FilePath CompilationDatabaseProject::rootPathFromSettings() const #ifdef WITH_TESTS return Utils::FilePath::fromString(projectDirectory().fileName()); #else - return Utils::FilePath::fromString( + auto rootPath = Utils::FilePath::fromString( namedSettings(ProjectExplorer::Constants::PROJECT_ROOT_PATH_KEY).toString()); + + if (rootPath.isEmpty()) + rootPath = Utils::FilePath::fromString(projectDirectory().fileName()); + + return rootPath; #endif }