forked from qt-creator/qt-creator
CMakePM: Allow CMAKE_SYSROOT to be taken from the CMake preset probe
One could have a toolchainfile that sets the CMAKE_SYSROOT. We need to be able to read the value later, and not just from the CMake Presets cmakeCache array. Task-number: QTCREATORBUG-29643 Change-Id: I63697219195b043813516c8214329ce583dc0676 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
committed by
Alessandro Portale
parent
0fe891678a
commit
5e3d14e2e9
@@ -264,6 +264,7 @@ static CMakeConfig configurationFromPresetProbe(
|
|||||||
const QString prefixPath = cache.stringValueOf("CMAKE_PREFIX_PATH");
|
const QString prefixPath = cache.stringValueOf("CMAKE_PREFIX_PATH");
|
||||||
const QString findRootPath = cache.stringValueOf("CMAKE_FIND_ROOT_PATH");
|
const QString findRootPath = cache.stringValueOf("CMAKE_FIND_ROOT_PATH");
|
||||||
const QString qtHostPath = cache.stringValueOf("QT_HOST_PATH");
|
const QString qtHostPath = cache.stringValueOf("QT_HOST_PATH");
|
||||||
|
const QString sysRoot = cache.stringValueOf("CMAKE_SYSROOT");
|
||||||
|
|
||||||
if (!cmakeMakeProgram.isEmpty()) {
|
if (!cmakeMakeProgram.isEmpty()) {
|
||||||
args.emplace_back(
|
args.emplace_back(
|
||||||
@@ -282,6 +283,9 @@ static CMakeConfig configurationFromPresetProbe(
|
|||||||
if (!qtHostPath.isEmpty()) {
|
if (!qtHostPath.isEmpty()) {
|
||||||
args.emplace_back(QStringLiteral("-DQT_HOST_PATH=%1").arg(qtHostPath));
|
args.emplace_back(QStringLiteral("-DQT_HOST_PATH=%1").arg(qtHostPath));
|
||||||
}
|
}
|
||||||
|
if (!sysRoot.isEmpty()) {
|
||||||
|
args.emplace_back(QStringLiteral("-DCMAKE_SYSROOT=%1").arg(sysRoot));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qCDebug(cmInputLog) << "CMake probing for compilers: " << cmakeExecutable.toUserOutput()
|
qCDebug(cmInputLog) << "CMake probing for compilers: " << cmakeExecutable.toUserOutput()
|
||||||
@@ -745,9 +749,6 @@ QList<void *> CMakeProjectImporter::examineDirectory(const FilePath &importPath,
|
|||||||
const CMakeConfig cache = configurePreset.cacheVariables
|
const CMakeConfig cache = configurePreset.cacheVariables
|
||||||
? configurePreset.cacheVariables.value()
|
? configurePreset.cacheVariables.value()
|
||||||
: CMakeConfig();
|
: CMakeConfig();
|
||||||
|
|
||||||
data->sysroot = cache.filePathValueOf("CMAKE_SYSROOT");
|
|
||||||
|
|
||||||
CMakeConfig config;
|
CMakeConfig config;
|
||||||
const bool noCompilers = cache.valueOf("CMAKE_C_COMPILER").isEmpty()
|
const bool noCompilers = cache.valueOf("CMAKE_C_COMPILER").isEmpty()
|
||||||
&& cache.valueOf("CMAKE_CXX_COMPILER").isEmpty();
|
&& cache.valueOf("CMAKE_CXX_COMPILER").isEmpty();
|
||||||
@@ -778,6 +779,8 @@ QList<void *> CMakeProjectImporter::examineDirectory(const FilePath &importPath,
|
|||||||
configurePreset.generator.value().toUtf8());
|
configurePreset.generator.value().toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data->sysroot = config.filePathValueOf("CMAKE_SYSROOT");
|
||||||
|
|
||||||
const auto [qmake, cmakePrefixPath] = qtInfoFromCMakeCache(config, env);
|
const auto [qmake, cmakePrefixPath] = qtInfoFromCMakeCache(config, env);
|
||||||
if (!qmake.isEmpty())
|
if (!qmake.isEmpty())
|
||||||
data->qt = findOrCreateQtVersion(qmake);
|
data->qt = findOrCreateQtVersion(qmake);
|
||||||
|
|||||||
Reference in New Issue
Block a user