forked from qt-creator/qt-creator
cmake: Add support for custom startup programs for executable targets
CMake supports the use of custom startup programs that are provided in the IDE to simplify execution. If the build system provides launchers, these are provided as an additional selection field of the run configuration including an entry without launcher. As of cmake version 3.29, the start programs are extracted from the API of the cmake file. For older cmake versions, a launcher is initialized from the cmake variable CMAKE_CROSSCOMPILING_EMULATOR, if available. Fixes: QTCREATORBUG-29880 Change-Id: I4345b56c9ca5befb5876a361e7da4675590399ca Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -1977,6 +1977,9 @@ static FilePaths librarySearchPaths(const CMakeBuildSystem *bs, const QString &b
|
||||
|
||||
const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
|
||||
{
|
||||
const CMakeConfig &cm = configurationFromCMake();
|
||||
QString emulator = cm.stringValueOf("CMAKE_CROSSCOMPILING_EMULATOR");
|
||||
|
||||
QList<BuildTargetInfo> appTargetList;
|
||||
const bool forAndroid = DeviceTypeKitAspect::deviceTypeId(kit())
|
||||
== Android::Constants::ANDROID_DEVICE_TYPE;
|
||||
@@ -1989,6 +1992,15 @@ const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
|
||||
|
||||
BuildTargetInfo bti;
|
||||
bti.displayName = ct.title;
|
||||
if (ct.launchers.size() > 0)
|
||||
bti.launchers = ct.launchers;
|
||||
else if (!emulator.isEmpty()) {
|
||||
// fallback for cmake < 3.29
|
||||
QStringList args = emulator.split(";");
|
||||
FilePath command = FilePath::fromString(args.takeFirst());
|
||||
LauncherInfo launcherInfo = { "emulator", command, args };
|
||||
bti.launchers.append(Launcher(launcherInfo, ct.sourceDirectory));
|
||||
}
|
||||
bti.targetFilePath = ct.executable;
|
||||
bti.projectFilePath = ct.sourceDirectory.cleanPath();
|
||||
bti.workingDirectory = ct.workingDirectory;
|
||||
|
||||
Reference in New Issue
Block a user