Commit 30f8555a authored by Erik Verbruggen's avatar Erik Verbruggen Committed by Nikolai Kosjar
Browse files

CMakeProject: put different languages into separate project parts.

This is in preparation for changes to the ProjectParts, where one part
can only hold files for 1 language.

Change-Id: I669e4f5b20e6553caad3a9ea2ed0e7c4455a8db7
Reviewed-by: default avatarNikolai Kosjar <>
parent 876ea282
...@@ -332,55 +332,25 @@ bool CMakeProject::parseCMakeLists() ...@@ -332,55 +332,25 @@ bool CMakeProject::parseCMakeLists()
CppTools::ProjectInfo pinfo = modelmanager->projectInfo(this); CppTools::ProjectInfo pinfo = modelmanager->projectInfo(this);
pinfo.clearProjectParts(); pinfo.clearProjectParts();
foreach (const CMakeBuildTarget &cbt, m_buildTargets) { CppTools::ProjectPartBuilder ppBuilder(pinfo);
typedef CppTools::ProjectPart ProjectPart;
ProjectPart::Ptr part(new ProjectPart);
part->project = this;
part->displayName = cbt.title;
part->projectFile = projectFilePath().toString();
foreach (const CMakeBuildTarget &cbt, m_buildTargets) {
// This explicitly adds -I. to the include paths // This explicitly adds -I. to the include paths
part->headerPaths += ProjectPart::HeaderPath(projectDirectory().toString(), QStringList includePaths = cbt.includeFiles;
ProjectPart::HeaderPath::IncludePath); includePaths += projectDirectory().toString();
foreach (const QString &includeFile, cbt.includeFiles) { ppBuilder.setCFlags(getCXXFlagsFor(cbt));
ProjectPart::HeaderPath hp(includeFile, ProjectPart::HeaderPath::IncludePath); ppBuilder.setCxxFlags(getCXXFlagsFor(cbt));
// CodeBlocks is utterly ignorant of frameworks on Mac, and won't report framework ppBuilder.setDisplayName(cbt.title);
// paths. The work-around is to check if the include path ends in ".framework", and
// if so, add the parent directory as framework path.
if (includeFile.endsWith(QLatin1String(".framework"))) {
const int slashIdx = includeFile.lastIndexOf(QLatin1Char('/'));
if (slashIdx != -1) {
hp = ProjectPart::HeaderPath(includeFile.left(slashIdx),
part->headerPaths += hp; const QList<Core::Id> languages = ppBuilder.createProjectPartsForFiles(cbt.files);
foreach (Core::Id language, languages)
setProjectLanguage(language, true);
} }
part->projectDefines += cbt.defines;
// TODO rewrite
CppTools::ProjectFileAdder adder(part->files);
foreach (const QString &file, cbt.files)
QStringList cxxflags = getCXXFlagsFor(cbt);
setProjectLanguage(ProjectExplorer::Constants::LANG_CXX, !part->files.isEmpty());
m_codeModelFuture.cancel(); m_codeModelFuture.cancel();
m_codeModelFuture = modelmanager->updateProjectInfo(pinfo); m_codeModelFuture = modelmanager->updateProjectInfo(pinfo);
} }
emit displayNameChanged(); emit displayNameChanged();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment