From e503e1e4e9e4b4482373f1f17eec0655b9562b3e Mon Sep 17 00:00:00 2001
From: dt <qtc-commiter@nokia.com>
Date: Mon, 8 Dec 2008 12:24:31 +0100
Subject: [PATCH] Fixes:    Parse all the targets.

Task:     -
RevBy:    -
AutoTest: -
Details:  (Only outputs them via qDebug().)
---
 .../cmakeprojectmanager/cmakeproject.cpp      | 24 +++++++++++++++++++
 .../cmakeprojectmanager/cmakeproject.h        |  5 ++++
 2 files changed, 29 insertions(+)

diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index fe591fa0041..4eb31302e65 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -393,12 +393,36 @@ void CMakeCbpParser::parseBuild()
 
 void CMakeCbpParser::parseTarget()
 {
+    m_targetOutput.clear();
+    m_targetType = false;
     while(!atEnd()) {
         readNext();
         if (isEndElement()) {
+            if (m_targetType && !m_targetOutput.isEmpty()) {
+                qDebug()<<"found target "<<m_targetOutput;
+                m_targets.insert(m_targetOutput);
+            }
             return;
         } else if (name() == "Compiler") {
             parseCompiler();
+        } else if (name() == "Option") {
+            parseTargetOption();
+        } else if (isStartElement()) {
+            parseUnknownElement();
+        }
+    }
+}
+
+void CMakeCbpParser::parseTargetOption()
+{
+    if (attributes().hasAttribute("output"))
+        m_targetOutput = attributes().value("output").toString();
+    else if (attributes().hasAttribute("type") && attributes().value("type") == "1")
+        m_targetType = true;
+    while(!atEnd()) {
+        readNext();
+        if (isEndElement()) {
+            return;
         } else if (isStartElement()) {
             parseUnknownElement();
         }
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h
index c765c0d3838..a0c821ada5e 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.h
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.h
@@ -123,13 +123,18 @@ private:
     void parseProject();
     void parseBuild();
     void parseTarget();
+    void parseTargetOption();
     void parseCompiler();
     void parseAdd();
     void parseUnit();
     void parseUnknownElement();
 
+    QSet<QString> m_targets;
     QList<ProjectExplorer::FileNode *> m_fileList;
     QStringList m_includeFiles;
+
+    QString m_targetOutput;
+    bool m_targetType;
 };
 
 class CMakeFile : public Core::IFile
-- 
GitLab