diff options
author | Cristian Adam <cristian.adam@qt.io> | 2023-05-19 15:21:51 +0200 |
---|---|---|
committer | Cristian Adam <cristian.adam@qt.io> | 2023-05-24 13:59:14 +0000 |
commit | 0d3d4892c636239d8e136d1bc9531f0b3438b48f (patch) | |
tree | 97c4d28bf63ba67b95b1a23e87b170a48decc787 | |
parent | bf4934feb982f6440c697cd3f5a1482570677e3f (diff) |
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>
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp index dc752f0a9f..a2abd9cacf 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp @@ -330,6 +330,7 @@ static FilePath qmakeFromCMakeCache(const CMakeConfig &config) FilePath cmakeExecutable = config.filePathValueOf(QByteArray("CMAKE_COMMAND")); FilePath cmakeMakeProgram = config.filePathValueOf(QByteArray("CMAKE_MAKE_PROGRAM")); FilePath hostPath = config.filePathValueOf(QByteArray("QT_HOST_PATH")); + const QString findRootPath = config.stringValueOf("CMAKE_FIND_ROOT_PATH"); QStringList args; args.push_back("-S"); @@ -350,13 +351,16 @@ static FilePath qmakeFromCMakeCache(const CMakeConfig &config) if (!cmakeMakeProgram.isEmpty()) { args.push_back(QStringLiteral("-DCMAKE_MAKE_PROGRAM=%1").arg(cmakeMakeProgram.toString())); } - if (toolchainFile.isEmpty()) { - args.push_back(QStringLiteral("-DCMAKE_PREFIX_PATH=%1").arg(prefixPath)); - } else { - if (!prefixPath.isEmpty()) - args.push_back(QStringLiteral("-DCMAKE_FIND_ROOT_PATH=%1").arg(prefixPath)); + + if (!toolchainFile.isEmpty()) { 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()) { args.push_back(QStringLiteral("-DQT_HOST_PATH=%1").arg(hostPath.toString())); } |