bool CMakeProject::parseCMakeLists() { if (!activeTarget() || !activeTarget()->activeBuildConfiguration()) { return false; } CMakeBuildConfiguration *activeBC = static_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration()); foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments()) if (isProjectFile(document->filePath())) document->infoBar()->removeInfo("CMakeEditor.RunCMake"); // Find cbp file QString cbpFile = CMakeManager::findCbpFile(activeBC->buildDirectory().toString()); if (cbpFile.isEmpty()) { emit buildTargetsChanged(); return false; } Kit *k = activeTarget()->kit(); // setFolderName m_rootNode->setDisplayName(QFileInfo(cbpFile).completeBaseName()); CMakeCbpParser cbpparser; // Parsing //qDebug()<<"Parsing file "<<cbpFile; if (!cbpparser.parseCbpFile(k,cbpFile, projectDirectory().toString())) { // TODO report error emit buildTargetsChanged(); return false; } foreach (const QString &file, m_watcher->files()) if (file != cbpFile) m_watcher->removePath(file); // how can we ensure that it is completely written? m_watcher->addPath(cbpFile); m_projectName = cbpparser.projectName(); m_rootNode->setDisplayName(cbpparser.projectName()); //qDebug()<<"Building Tree"; QList<ProjectExplorer::FileNode *> fileList = cbpparser.fileList(); QSet<FileName> projectFiles; if (cbpparser.hasCMakeFiles()) { fileList.append(cbpparser.cmakeFileList()); foreach (const ProjectExplorer::FileNode *node, cbpparser.cmakeFileList()) projectFiles.insert(node->path()); } else {
void BuildDirManager::extractData() { const Utils::FileName topCMake = Utils::FileName::fromString(m_sourceDir.toString() + QLatin1String("/CMakeLists.txt")); m_projectName = m_sourceDir.fileName(); m_buildTargets.clear(); m_watchedFiles.clear(); m_files.clear(); m_files.append(new ProjectExplorer::FileNode(topCMake, ProjectExplorer::ProjectFileType, false)); m_watchedFiles.insert(topCMake); m_watcher->removePaths(m_watcher->files()); // Find cbp file QString cbpFile = CMakeManager::findCbpFile(m_buildDir.toString()); if (cbpFile.isEmpty()) return; m_watcher->addPath(cbpFile); // setFolderName CMakeCbpParser cbpparser; // Parsing if (!cbpparser.parseCbpFile(m_kit, cbpFile, m_sourceDir.toString())) return; m_projectName = cbpparser.projectName(); m_files = cbpparser.fileList(); QSet<Utils::FileName> projectFiles; if (cbpparser.hasCMakeFiles()) { m_files.append(cbpparser.cmakeFileList()); foreach (const ProjectExplorer::FileNode *node, cbpparser.cmakeFileList()) projectFiles.insert(node->filePath()); } else {