forked from qt-creator/qt-creator
CMakePM: Fix Qt detection for Presets with toolchain file
When CMAKE_TOOLCHAIN_FILE and CMAKE_PREFIX_PATH were both set, the later was ignored. This resulted in Kits being created without Qt and without Qml Debugging. Task-number: QTCREATORBUG-28982 Change-Id: Ib45b4ac8335391f85a0b9c321196597d1c0a7a3f Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -330,6 +330,7 @@ static FilePath qmakeFromCMakeCache(const CMakeConfig &config)
|
|||||||
FilePath cmakeExecutable = config.filePathValueOf(QByteArray("CMAKE_COMMAND"));
|
FilePath cmakeExecutable = config.filePathValueOf(QByteArray("CMAKE_COMMAND"));
|
||||||
FilePath cmakeMakeProgram = config.filePathValueOf(QByteArray("CMAKE_MAKE_PROGRAM"));
|
FilePath cmakeMakeProgram = config.filePathValueOf(QByteArray("CMAKE_MAKE_PROGRAM"));
|
||||||
FilePath hostPath = config.filePathValueOf(QByteArray("QT_HOST_PATH"));
|
FilePath hostPath = config.filePathValueOf(QByteArray("QT_HOST_PATH"));
|
||||||
|
const QString findRootPath = config.stringValueOf("CMAKE_FIND_ROOT_PATH");
|
||||||
|
|
||||||
QStringList args;
|
QStringList args;
|
||||||
args.push_back("-S");
|
args.push_back("-S");
|
||||||
@@ -350,13 +351,16 @@ static FilePath qmakeFromCMakeCache(const CMakeConfig &config)
|
|||||||
if (!cmakeMakeProgram.isEmpty()) {
|
if (!cmakeMakeProgram.isEmpty()) {
|
||||||
args.push_back(QStringLiteral("-DCMAKE_MAKE_PROGRAM=%1").arg(cmakeMakeProgram.toString()));
|
args.push_back(QStringLiteral("-DCMAKE_MAKE_PROGRAM=%1").arg(cmakeMakeProgram.toString()));
|
||||||
}
|
}
|
||||||
if (toolchainFile.isEmpty()) {
|
|
||||||
args.push_back(QStringLiteral("-DCMAKE_PREFIX_PATH=%1").arg(prefixPath));
|
if (!toolchainFile.isEmpty()) {
|
||||||
} else {
|
|
||||||
if (!prefixPath.isEmpty())
|
|
||||||
args.push_back(QStringLiteral("-DCMAKE_FIND_ROOT_PATH=%1").arg(prefixPath));
|
|
||||||
args.push_back(QStringLiteral("-DCMAKE_TOOLCHAIN_FILE=%1").arg(toolchainFile.toString()));
|
args.push_back(QStringLiteral("-DCMAKE_TOOLCHAIN_FILE=%1").arg(toolchainFile.toString()));
|
||||||
}
|
}
|
||||||
|
if (!prefixPath.isEmpty()) {
|
||||||
|
args.push_back(QStringLiteral("-DCMAKE_PREFIX_PATH=%1").arg(prefixPath));
|
||||||
|
}
|
||||||
|
if (!findRootPath.isEmpty()) {
|
||||||
|
args.push_back(QStringLiteral("-DCMAKE_FIND_ROOT_PATH=%1").arg(findRootPath));
|
||||||
|
}
|
||||||
if (!hostPath.isEmpty()) {
|
if (!hostPath.isEmpty()) {
|
||||||
args.push_back(QStringLiteral("-DQT_HOST_PATH=%1").arg(hostPath.toString()));
|
args.push_back(QStringLiteral("-DQT_HOST_PATH=%1").arg(hostPath.toString()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user