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

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 <nikolai.kosjar@digia.com>
parent 876ea282
......@@ -332,55 +332,25 @@ bool CMakeProject::parseCMakeLists()
CppTools::ProjectInfo pinfo = modelmanager->projectInfo(this);
pinfo.clearProjectParts();
foreach (const CMakeBuildTarget &cbt, m_buildTargets) {
typedef CppTools::ProjectPart ProjectPart;
ProjectPart::Ptr part(new ProjectPart);
part->project = this;
part->displayName = cbt.title;
part->projectFile = projectFilePath().toString();
CppTools::ProjectPartBuilder ppBuilder(pinfo);
foreach (const CMakeBuildTarget &cbt, m_buildTargets) {
// This explicitly adds -I. to the include paths
part->headerPaths += ProjectPart::HeaderPath(projectDirectory().toString(),
ProjectPart::HeaderPath::IncludePath);
foreach (const QString &includeFile, cbt.includeFiles) {
ProjectPart::HeaderPath hp(includeFile, ProjectPart::HeaderPath::IncludePath);
// CodeBlocks is utterly ignorant of frameworks on Mac, and won't report framework
// 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),
ProjectPart::HeaderPath::FrameworkPath);
continue;
}
}
part->headerPaths += hp;
}
part->projectDefines += cbt.defines;
// TODO rewrite
CppTools::ProjectFileAdder adder(part->files);
foreach (const QString &file, cbt.files)
adder.maybeAdd(file);
QStringList cxxflags = getCXXFlagsFor(cbt);
part->evaluateToolchain(tc,
cxxflags,
cxxflags,
SysRootKitInformation::sysRoot(k));
setProjectLanguage(ProjectExplorer::Constants::LANG_CXX, !part->files.isEmpty());
pinfo.appendProjectPart(part);
QStringList includePaths = cbt.includeFiles;
includePaths += projectDirectory().toString();
ppBuilder.setIncludePaths(includePaths);
ppBuilder.setCFlags(getCXXFlagsFor(cbt));
ppBuilder.setCxxFlags(getCXXFlagsFor(cbt));
ppBuilder.setDefines(cbt.defines);
ppBuilder.setDisplayName(cbt.title);
const QList<Core::Id> languages = ppBuilder.createProjectPartsForFiles(cbt.files);
foreach (Core::Id language, languages)
setProjectLanguage(language, true);
}
m_codeModelFuture.cancel();
m_codeModelFuture = modelmanager->updateProjectInfo(pinfo);
}
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