PDA

View Full Version : Qt Creator Plugin: CppTools::ProjectInfo project sources and include paths



R-Type
2nd February 2015, 11:25
Hello,
I'm writing my first plugin for Qt Creator to integrate PC Lint check into projects. In order to provide Lint with required information I get active project information this way:


CppTools::CppModelManager* modelManager = CppTools::CppModelManager::instance();
Project* project=SessionManager::startupProject();
CppTools::ProjectInfo info=modelManager->projectInfo(project);
CppTools::ProjectPart::HeaderPaths includePath=info.headerPaths();
QByteArray defs=info.defines();
const QSet<QString> sourceFiles=info.sourceFiles();

The problem is that if I have conditions in qmake .pro file and some sources and include paths are added only for special configuration, I still get all source files from ProjectInfo, but include paths only for active configuration. Consequently Lint cannot resolve some includes and stops with error. Example application.pro:


HEADERS += main/file1.h
CONFIG(with_smth) {
HEADERS += dynamic/file2.h
}
SOURCES += main/file1.cpp
CONFIG(with_smth) {
SOURCES += dynamic/file2.cpp
}
INCLUDEPATH += main
CONFIG(with_smth) {
INCLUDEPATH += dynamic
}

In such case I have file1.cpp and file2.cpp, but only ./main in include paths and file2.h cannot be resolved.
Is there anothe way to get project information from Qt Creator internals?

anda_skoa
2nd February 2015, 13:32
That sounds like a question that is more likely to get an anwer on the QtCreator development mailing list
http://lists.qt-project.org/mailman/listinfo/qt-creator

Cheers,
_

R-Type
2nd February 2015, 15:32
Thanks, I've posted it there.