forked from qt-creator/qt-creator
iOS/CMake: Fix running non-Xcode targets and targets in subdirectories
Improve support for running iOS bundle built with CMake introduced in
3a294f670d.
Currently it supports only Xcode generator and does not work if target is
created in a subdirectory.
This patch adds support for non-Xcode generators (tested with Ninja) and
targets created in a subdirectories with any generators.
The solution is not pretty due to the need to keep qmake compatibility.
Would be glad to refactor if there's more correct approach.
Change-Id: Ieaf7e3186ab55cadc643d9bd3d94442f9ac72228
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -156,8 +156,19 @@ QVariant CMakeTargetNode::data(Utils::Id role) const
|
||||
return m_artifact.fileName();
|
||||
}
|
||||
|
||||
if (role == Ios::Constants::IosBuildDir)
|
||||
return {}; // defaults to build configuration build directory
|
||||
if (role == Ios::Constants::IosBuildDir) {
|
||||
// This is a path relative to root build directory.
|
||||
// When generating Xcode project, CMake may put here a "${EFFECTIVE_PLATFORM_NAME}" macro,
|
||||
// which is expanded by Xcode at build time.
|
||||
// To get an actual executable path, iOS plugin replaces this macro with either "-iphoneos"
|
||||
// or "-iphonesimulator" depending on the device type (which is unavailable here).
|
||||
|
||||
// dir/target.app/target -> dir
|
||||
return m_artifact.parentDir().parentDir().toString();
|
||||
}
|
||||
|
||||
if (role == Ios::Constants::IosCmakeGenerator)
|
||||
return value("CMAKE_GENERATOR");
|
||||
|
||||
QTC_ASSERT(false, qDebug() << "Unknown role" << role.toString());
|
||||
// Better guess than "not present".
|
||||
|
||||
Reference in New Issue
Block a user