forked from qt-creator/qt-creator
CMake server-mode: Make sure the target's source dir is absolute
Change-Id: I3c74e3a0ee9c854e4b97826a4397579d4755d8e0 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -195,31 +195,35 @@ bool ServerModeReader::isParsing() const
|
|||||||
QList<CMakeBuildTarget> ServerModeReader::takeBuildTargets(QString &errorMessage)
|
QList<CMakeBuildTarget> ServerModeReader::takeBuildTargets(QString &errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
const QList<CMakeBuildTarget> result = transform(m_targets, [](const Target *t) -> CMakeBuildTarget {
|
QDir topSourceDir(m_parameters.sourceDirectory.toString());
|
||||||
CMakeBuildTarget ct;
|
const QList<CMakeBuildTarget> result
|
||||||
ct.title = t->name;
|
= transform(m_targets, [&topSourceDir](const Target *t) -> CMakeBuildTarget {
|
||||||
ct.executable = t->artifacts.isEmpty() ? FilePath() : t->artifacts.at(0);
|
CMakeBuildTarget ct;
|
||||||
TargetType type = UtilityType;
|
ct.title = t->name;
|
||||||
if (t->type == "EXECUTABLE")
|
ct.executable = t->artifacts.isEmpty() ? FilePath() : t->artifacts.at(0);
|
||||||
type = ExecutableType;
|
TargetType type = UtilityType;
|
||||||
else if (t->type == "STATIC_LIBRARY")
|
if (t->type == "EXECUTABLE")
|
||||||
type = StaticLibraryType;
|
type = ExecutableType;
|
||||||
else if (t->type == "OBJECT_LIBRARY")
|
else if (t->type == "STATIC_LIBRARY")
|
||||||
type = ObjectLibraryType;
|
type = StaticLibraryType;
|
||||||
else if (t->type == "MODULE_LIBRARY" || t->type == "SHARED_LIBRARY"
|
else if (t->type == "OBJECT_LIBRARY")
|
||||||
|| t->type == "INTERFACE_LIBRARY")
|
type = ObjectLibraryType;
|
||||||
type = DynamicLibraryType;
|
else if (t->type == "MODULE_LIBRARY" || t->type == "SHARED_LIBRARY"
|
||||||
else
|
|| t->type == "INTERFACE_LIBRARY")
|
||||||
type = UtilityType;
|
type = DynamicLibraryType;
|
||||||
ct.targetType = type;
|
else
|
||||||
if (t->artifacts.isEmpty()) {
|
type = UtilityType;
|
||||||
ct.workingDirectory = t->buildDirectory;
|
ct.targetType = type;
|
||||||
} else {
|
if (t->artifacts.isEmpty()) {
|
||||||
ct.workingDirectory = Utils::FilePath::fromString(t->artifacts.at(0).toFileInfo().absolutePath());
|
ct.workingDirectory = t->buildDirectory;
|
||||||
}
|
} else {
|
||||||
ct.sourceDirectory = t->sourceDirectory;
|
ct.workingDirectory = Utils::FilePath::fromString(
|
||||||
return ct;
|
t->artifacts.at(0).toFileInfo().absolutePath());
|
||||||
});
|
}
|
||||||
|
ct.sourceDirectory = FilePath::fromString(
|
||||||
|
QDir::cleanPath(topSourceDir.absoluteFilePath(t->sourceDirectory.toString())));
|
||||||
|
return ct;
|
||||||
|
});
|
||||||
m_targets.clear();
|
m_targets.clear();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user