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)
|
||||
{
|
||||
Q_UNUSED(errorMessage)
|
||||
const QList<CMakeBuildTarget> result = transform(m_targets, [](const Target *t) -> CMakeBuildTarget {
|
||||
CMakeBuildTarget ct;
|
||||
ct.title = t->name;
|
||||
ct.executable = t->artifacts.isEmpty() ? FilePath() : t->artifacts.at(0);
|
||||
TargetType type = UtilityType;
|
||||
if (t->type == "EXECUTABLE")
|
||||
type = ExecutableType;
|
||||
else if (t->type == "STATIC_LIBRARY")
|
||||
type = StaticLibraryType;
|
||||
else if (t->type == "OBJECT_LIBRARY")
|
||||
type = ObjectLibraryType;
|
||||
else if (t->type == "MODULE_LIBRARY" || t->type == "SHARED_LIBRARY"
|
||||
|| t->type == "INTERFACE_LIBRARY")
|
||||
type = DynamicLibraryType;
|
||||
else
|
||||
type = UtilityType;
|
||||
ct.targetType = type;
|
||||
if (t->artifacts.isEmpty()) {
|
||||
ct.workingDirectory = t->buildDirectory;
|
||||
} else {
|
||||
ct.workingDirectory = Utils::FilePath::fromString(t->artifacts.at(0).toFileInfo().absolutePath());
|
||||
}
|
||||
ct.sourceDirectory = t->sourceDirectory;
|
||||
return ct;
|
||||
});
|
||||
QDir topSourceDir(m_parameters.sourceDirectory.toString());
|
||||
const QList<CMakeBuildTarget> result
|
||||
= transform(m_targets, [&topSourceDir](const Target *t) -> CMakeBuildTarget {
|
||||
CMakeBuildTarget ct;
|
||||
ct.title = t->name;
|
||||
ct.executable = t->artifacts.isEmpty() ? FilePath() : t->artifacts.at(0);
|
||||
TargetType type = UtilityType;
|
||||
if (t->type == "EXECUTABLE")
|
||||
type = ExecutableType;
|
||||
else if (t->type == "STATIC_LIBRARY")
|
||||
type = StaticLibraryType;
|
||||
else if (t->type == "OBJECT_LIBRARY")
|
||||
type = ObjectLibraryType;
|
||||
else if (t->type == "MODULE_LIBRARY" || t->type == "SHARED_LIBRARY"
|
||||
|| t->type == "INTERFACE_LIBRARY")
|
||||
type = DynamicLibraryType;
|
||||
else
|
||||
type = UtilityType;
|
||||
ct.targetType = type;
|
||||
if (t->artifacts.isEmpty()) {
|
||||
ct.workingDirectory = t->buildDirectory;
|
||||
} else {
|
||||
ct.workingDirectory = Utils::FilePath::fromString(
|
||||
t->artifacts.at(0).toFileInfo().absolutePath());
|
||||
}
|
||||
ct.sourceDirectory = FilePath::fromString(
|
||||
QDir::cleanPath(topSourceDir.absoluteFilePath(t->sourceDirectory.toString())));
|
||||
return ct;
|
||||
});
|
||||
m_targets.clear();
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user