diff --git a/src/lib/CxxProject.cpp b/src/lib/CxxProject.cpp index 9100e280..2623e680 100644 --- a/src/lib/CxxProject.cpp +++ b/src/lib/CxxProject.cpp @@ -96,9 +96,14 @@ Parser::Arguments CxxProject::getParserArguments() const utility::append(args.compilerFlags, m_projectSettings->getCompilerFlags()); - // MAYBE DO THIS IN PARSER! AND ONLY ADD THE PATH OF THE CURRENT FILE!! // Add the source paths as HeaderSearchPaths as well, so clang will also look here when searching include files. - //utility::append(args.systemHeaderSearchPaths, m_fileManager.getSourcePaths()); + for (const FilePath& sourcePath: getSourcePaths()) + { + if (sourcePath.isDirectory()) + { + args.systemHeaderSearchPaths.push_back(sourcePath); + } + } utility::append(args.systemHeaderSearchPaths, m_projectSettings->getAbsoluteHeaderSearchPaths()); diff --git a/src/lib/Project.cpp b/src/lib/Project.cpp index 36cb4a8c..55ef659b 100644 --- a/src/lib/Project.cpp +++ b/src/lib/Project.cpp @@ -187,6 +187,11 @@ DialogView* Project::getDialogView() const return m_dialogView; } +const std::vector& Project::getSourcePaths() const +{ + return m_fileManager.getSourcePaths(); +} + void Project::load() { m_storageAccessProxy->setSubject(nullptr); diff --git a/src/lib/Project.h b/src/lib/Project.h index 1bb908b3..47fbb16e 100644 --- a/src/lib/Project.h +++ b/src/lib/Project.h @@ -38,6 +38,7 @@ public: protected: Project(StorageAccessProxy* storageAccessProxy, DialogView* dialogView); DialogView* getDialogView() const; + const std::vector& getSourcePaths() const; virtual std::shared_ptr getProjectSettings() = 0; virtual const std::shared_ptr getProjectSettings() const = 0;