forked from qt-creator/qt-creator
CMakePM: Expand cache variables for the preset probe
This way the CMAKE_PREFIX_PATH set to $env{HOME}/Qt (Linux) or $env{SystemDrive}/Qt (Windows) would work as expected. Change-Id: I03a9102d6d1da2a8740cab738577c47c44166c6c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -197,19 +197,27 @@ static CMakeConfig configurationFromPresetProbe(
|
|||||||
const CMakeConfig cache = configurePreset.cacheVariables
|
const CMakeConfig cache = configurePreset.cacheVariables
|
||||||
? configurePreset.cacheVariables.value()
|
? configurePreset.cacheVariables.value()
|
||||||
: CMakeConfig();
|
: CMakeConfig();
|
||||||
const FilePath cmakeMakeProgram = cache.filePathValueOf(QByteArray("CMAKE_MAKE_PROGRAM"));
|
|
||||||
const FilePath toolchainFile = cache.filePathValueOf(QByteArray("CMAKE_TOOLCHAIN_FILE"));
|
auto expandCacheValue =
|
||||||
const QString prefixPath = cache.stringValueOf(QByteArray("CMAKE_PREFIX_PATH"));
|
[configurePreset, env, importPath, cache](const QString &key) -> QString {
|
||||||
const QString findRootPath = cache.stringValueOf(QByteArray("CMAKE_FIND_ROOT_PATH"));
|
QString result = cache.stringValueOf(key.toUtf8());
|
||||||
const QString qtHostPath = cache.stringValueOf(QByteArray("QT_HOST_PATH"));
|
CMakePresets::Macros::expand(configurePreset, env, importPath, result);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
const QString cmakeMakeProgram = expandCacheValue("CMAKE_MAKE_PROGRAM");
|
||||||
|
const QString toolchainFile = expandCacheValue("CMAKE_TOOLCHAIN_FILE");
|
||||||
|
const QString prefixPath = expandCacheValue("CMAKE_PREFIX_PATH");
|
||||||
|
const QString findRootPath = expandCacheValue("CMAKE_FIND_ROOT_PATH");
|
||||||
|
const QString qtHostPath = expandCacheValue("QT_HOST_PATH");
|
||||||
|
|
||||||
if (!cmakeMakeProgram.isEmpty()) {
|
if (!cmakeMakeProgram.isEmpty()) {
|
||||||
args.emplace_back(
|
args.emplace_back(
|
||||||
QStringLiteral("-DCMAKE_MAKE_PROGRAM=%1").arg(cmakeMakeProgram.toString()));
|
QStringLiteral("-DCMAKE_MAKE_PROGRAM=%1").arg(cmakeMakeProgram));
|
||||||
}
|
}
|
||||||
if (!toolchainFile.isEmpty()) {
|
if (!toolchainFile.isEmpty()) {
|
||||||
args.emplace_back(
|
args.emplace_back(
|
||||||
QStringLiteral("-DCMAKE_TOOLCHAIN_FILE=%1").arg(toolchainFile.toString()));
|
QStringLiteral("-DCMAKE_TOOLCHAIN_FILE=%1").arg(toolchainFile));
|
||||||
}
|
}
|
||||||
if (!prefixPath.isEmpty()) {
|
if (!prefixPath.isEmpty()) {
|
||||||
args.emplace_back(QStringLiteral("-DCMAKE_PREFIX_PATH=%1").arg(prefixPath));
|
args.emplace_back(QStringLiteral("-DCMAKE_PREFIX_PATH=%1").arg(prefixPath));
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
"generator": "Ninja",
|
"generator": "Ninja",
|
||||||
"installDir": "../inst-${presetName}",
|
"installDir": "../inst-${presetName}",
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_PREFIX_PATH": "c:/Qt/6.3.2/mingw_64"
|
"CMAKE_PREFIX_PATH": "$env{SystemDrive}/Qt/6.3.2/mingw_64"
|
||||||
},
|
},
|
||||||
"condition": {
|
"condition": {
|
||||||
"type": "equals",
|
"type": "equals",
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"rhs": "Windows"
|
"rhs": "Windows"
|
||||||
},
|
},
|
||||||
"environment": {
|
"environment": {
|
||||||
"PATH": "c:/Qt/Tools/mingw1120_64/bin;$penv{PATH}"
|
"PATH": "$env{SystemDrive}/Qt/Tools/mingw1120_64/bin;$penv{PATH}"
|
||||||
},
|
},
|
||||||
"debug" : {
|
"debug" : {
|
||||||
"find" : true
|
"find" : true
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
"inherits" : "mingw",
|
"inherits" : "mingw",
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_BUILD_TYPE": "Release",
|
"CMAKE_BUILD_TYPE": "Release",
|
||||||
"CMAKE_PREFIX_PATH": "c:/Qt/6.3.2/mingw_64"
|
"CMAKE_PREFIX_PATH": "$env{SystemDrive}/Qt/6.3.2/mingw_64"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user