diff -crb qt-creator-2.1.0-src-orig/src/plugins/cmakeprojectmanager/cmakeproject.cpp qt-creator-2.1.0-src/src/plugins/cmakeprojectmanager/cmakeproject.cpp *** qt-creator-2.1.0-src-orig/src/plugins/cmakeprojectmanager/cmakeproject.cpp 2011-02-11 11:29:12.000000000 +0100 --- qt-creator-2.1.0-src/src/plugins/cmakeprojectmanager/cmakeproject.cpp 2011-03-10 14:18:50.342454998 +0100 *************** *** 248,265 **** allIncludePaths.append(projectDirectory()); allIncludePaths.append(cbpparser.includeFiles()); CppTools::CppModelManagerInterface *modelmanager = ExtensionSystem::PluginManager::instance()->getObject(); if (modelmanager) { CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this); if (pinfo.includePaths != allIncludePaths || pinfo.sourceFiles != m_files ! || pinfo.defines != activeBC->toolChain()->predefinedMacros() || pinfo.frameworkPaths != allFrameworkPaths) { pinfo.includePaths = allIncludePaths; // TODO we only want C++ files, not all other stuff that might be in the project pinfo.sourceFiles = m_files; ! pinfo.defines = activeBC->toolChain()->predefinedMacros(); // TODO this is to simplistic pinfo.frameworkPaths = allFrameworkPaths; modelmanager->updateProjectInfo(pinfo); m_codeModelFuture.cancel(); --- 248,270 ---- allIncludePaths.append(projectDirectory()); allIncludePaths.append(cbpparser.includeFiles()); + + QByteArray allDefines; + allDefines.append(activeBC->toolChain()->predefinedMacros()); + allDefines.append(cbpparser.defines()); + CppTools::CppModelManagerInterface *modelmanager = ExtensionSystem::PluginManager::instance()->getObject(); if (modelmanager) { CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this); if (pinfo.includePaths != allIncludePaths || pinfo.sourceFiles != m_files ! || pinfo.defines != allDefines || pinfo.frameworkPaths != allFrameworkPaths) { pinfo.includePaths = allIncludePaths; // TODO we only want C++ files, not all other stuff that might be in the project pinfo.sourceFiles = m_files; ! pinfo.defines = allDefines; pinfo.frameworkPaths = allFrameworkPaths; modelmanager->updateProjectInfo(pinfo); m_codeModelFuture.cancel(); *************** *** 892,897 **** --- 897,910 ---- void CMakeCbpParser::parseAdd() { m_includeFiles.append(attributes().value("directory").toString()); + QString compilerOption = attributes().value("option").toString(); + m_compilerOptions.append(compilerOption); + //assume only one compileroption is placed in the option attribute + if(compilerOption.indexOf("-D") != -1) { + m_defines.append("#define "); + m_defines.append(compilerOption.mid(compilerOption.indexOf("-D")+2).replace("=", " ").toAscii()); + m_defines.append("\n"); + } while (!atEnd()) { readNext(); if (isEndElement()) { *************** *** 989,994 **** --- 1002,1017 ---- return m_includeFiles; } + QStringList CMakeCbpParser::compilerOptions() + { + return m_compilerOptions; + } + + QByteArray CMakeCbpParser::defines() + { + return m_defines; + } + QList CMakeCbpParser::buildTargets() { return m_buildTargets; diff -crb qt-creator-2.1.0-src-orig/src/plugins/cmakeprojectmanager/cmakeproject.h qt-creator-2.1.0-src/src/plugins/cmakeprojectmanager/cmakeproject.h *** qt-creator-2.1.0-src-orig/src/plugins/cmakeprojectmanager/cmakeproject.h 2011-02-11 11:29:12.000000000 +0100 --- qt-creator-2.1.0-src/src/plugins/cmakeprojectmanager/cmakeproject.h 2011-03-10 14:01:37.412455006 +0100 *************** *** 147,152 **** --- 147,154 ---- QList fileList(); QList cmakeFileList(); QStringList includeFiles(); + QStringList compilerOptions(); + QByteArray defines(); QList buildTargets(); QString projectName() const; QString compilerName() const; *************** *** 172,177 **** --- 174,181 ---- QSet m_processedUnits; bool m_parsingCmakeUnit; QStringList m_includeFiles; + QStringList m_compilerOptions; + QByteArray m_defines; CMakeBuildTarget m_buildTarget; bool m_buildTargetType;