forked from qt-creator/qt-creator
Add all cmake files to the project tree
That is if using a cmake that outputs enough information. The necessary patch for that was commited to cmake's cvs recently by Alexander Neundorf. Task-Nr: 250399
This commit is contained in:
@@ -175,9 +175,15 @@ void CMakeProject::parseCMakeLists()
|
||||
|
||||
//qDebug()<<"Building Tree";
|
||||
|
||||
|
||||
QList<ProjectExplorer::FileNode *> fileList = cbpparser.fileList();
|
||||
// Manually add the CMakeLists.txt file
|
||||
fileList.append(new ProjectExplorer::FileNode(sourceDirectory() + "/CMakeLists.txt", ProjectExplorer::ProjectFileType, false));
|
||||
|
||||
if (cbpparser.hasCMakeFiles()) {
|
||||
fileList.append(cbpparser.cmakeFileList());
|
||||
} else {
|
||||
// Manually add the CMakeLists.txt file
|
||||
fileList.append(new ProjectExplorer::FileNode(sourceDirectory() + "/CMakeLists.txt", ProjectExplorer::ProjectFileType, false));
|
||||
}
|
||||
|
||||
m_files.clear();
|
||||
foreach (ProjectExplorer::FileNode *fn, fileList)
|
||||
@@ -941,18 +947,43 @@ void CMakeCbpParser::parseUnit()
|
||||
{
|
||||
//qDebug()<<stream.attributes().value("filename");
|
||||
QString fileName = attributes().value("filename").toString();
|
||||
if (!fileName.endsWith(".rule"))
|
||||
m_fileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::SourceType, false));
|
||||
m_parsingCmakeUnit = false;
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
if (!fileName.endsWith(".rule") && !m_processedUnits.contains(fileName)) {
|
||||
// Now check whether we found a virtual element beneath
|
||||
if (m_parsingCmakeUnit)
|
||||
m_fileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::SourceType, false));
|
||||
else
|
||||
m_cmakeFileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::ProjectFileType, false));
|
||||
m_processedUnits.insert(fileName);
|
||||
}
|
||||
return;
|
||||
} else if (name() == "Option") {
|
||||
parseUnitOption();
|
||||
} else if (isStartElement()) {
|
||||
parseUnknownElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMakeCbpParser::parseUnitOption()
|
||||
{
|
||||
if (attributes().hasAttribute("virtualFolder"))
|
||||
m_parsingCmakeUnit = true;
|
||||
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
|
||||
if (isEndElement())
|
||||
break;
|
||||
|
||||
if (isStartElement())
|
||||
parseUnknownElement();
|
||||
}
|
||||
}
|
||||
|
||||
void CMakeCbpParser::parseUnknownElement()
|
||||
{
|
||||
Q_ASSERT(isStartElement());
|
||||
@@ -973,6 +1004,16 @@ QList<ProjectExplorer::FileNode *> CMakeCbpParser::fileList()
|
||||
return m_fileList;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::FileNode *> CMakeCbpParser::cmakeFileList()
|
||||
{
|
||||
return m_cmakeFileList;
|
||||
}
|
||||
|
||||
bool CMakeCbpParser::hasCMakeFiles()
|
||||
{
|
||||
return !m_cmakeFileList.isEmpty();
|
||||
}
|
||||
|
||||
QStringList CMakeCbpParser::includeFiles()
|
||||
{
|
||||
return m_includeFiles;
|
||||
|
Reference in New Issue
Block a user