forked from qt-creator/qt-creator
Import library target from cmake project.
Added library flag to CMakeBuildTarget struct which is set when parsing the cbp file. This flag is then used to make sure no runconfiguration is created for library targets. Merge-request: 136 Reviewed-by: dt <qtc-committer@nokia.com>
This commit is contained in:
@@ -222,7 +222,7 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
//qDebug()<<"Adding Targets";
|
//qDebug()<<"Adding Targets";
|
||||||
m_buildTargets = cbpparser.buildTargets();
|
m_buildTargets = cbpparser.buildTargets();
|
||||||
// qDebug()<<"Printing targets";
|
// qDebug()<<"Printing targets";
|
||||||
// foreach(CMakeTarget ct, m_targets) {
|
// foreach(CMakeBuildTarget ct, m_buildTargets) {
|
||||||
// qDebug()<<ct.title<<" with executable:"<<ct.executable;
|
// qDebug()<<ct.title<<" with executable:"<<ct.executable;
|
||||||
// qDebug()<<"WD:"<<ct.workingDirectory;
|
// qDebug()<<"WD:"<<ct.workingDirectory;
|
||||||
// qDebug()<<ct.makeCommand<<ct.makeCleanCommand;
|
// qDebug()<<ct.makeCommand<<ct.makeCleanCommand;
|
||||||
@@ -754,12 +754,16 @@ void CMakeCbpParser::parseBuildTarget()
|
|||||||
|
|
||||||
void CMakeCbpParser::parseBuildTargetOption()
|
void CMakeCbpParser::parseBuildTargetOption()
|
||||||
{
|
{
|
||||||
if (attributes().hasAttribute("output"))
|
if (attributes().hasAttribute("output")) {
|
||||||
m_buildTarget.executable = attributes().value("output").toString();
|
m_buildTarget.executable = attributes().value("output").toString();
|
||||||
else if (attributes().hasAttribute("type") && (attributes().value("type") == "1" || attributes().value("type") == "0"))
|
} else if (attributes().hasAttribute("type") && (attributes().value("type") == "1" || attributes().value("type") == "0")) {
|
||||||
m_buildTargetType = true;
|
m_buildTargetType = true;
|
||||||
else if (attributes().hasAttribute("working_dir"))
|
} else if (attributes().hasAttribute("type") && (attributes().value("type") == "3" || attributes().value("type") == "2")) {
|
||||||
|
m_buildTargetType = true;
|
||||||
|
m_buildTarget.library = true;
|
||||||
|
} else if (attributes().hasAttribute("working_dir")) {
|
||||||
m_buildTarget.workingDirectory = attributes().value("working_dir").toString();
|
m_buildTarget.workingDirectory = attributes().value("working_dir").toString();
|
||||||
|
}
|
||||||
while (!atEnd()) {
|
while (!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
if (isEndElement()) {
|
if (isEndElement()) {
|
||||||
@@ -963,5 +967,6 @@ void CMakeBuildTarget::clear()
|
|||||||
makeCleanCommand.clear();
|
makeCleanCommand.clear();
|
||||||
workingDirectory.clear();
|
workingDirectory.clear();
|
||||||
title.clear();
|
title.clear();
|
||||||
|
library = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ class CMakeBuildSettingsWidget;
|
|||||||
struct CMakeBuildTarget
|
struct CMakeBuildTarget
|
||||||
{
|
{
|
||||||
QString title;
|
QString title;
|
||||||
QString executable;
|
QString executable; // TODO: rename to output?
|
||||||
|
bool library;
|
||||||
QString workingDirectory;
|
QString workingDirectory;
|
||||||
QString makeCommand;
|
QString makeCommand;
|
||||||
QString makeCleanCommand;
|
QString makeCleanCommand;
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ void CMakeTarget::updateRunConfigurations()
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach(const CMakeBuildTarget &ct, cmakeProject()->buildTargets()) {
|
foreach(const CMakeBuildTarget &ct, cmakeProject()->buildTargets()) {
|
||||||
|
if (ct.library)
|
||||||
|
continue;
|
||||||
if (ct.executable.isEmpty())
|
if (ct.executable.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
if (ct.title.endsWith("/fast"))
|
if (ct.title.endsWith("/fast"))
|
||||||
|
|||||||
Reference in New Issue
Block a user