Files
qt-creator/src/plugins/cmakeprojectmanager/presetsmacros.h
Cristian Adam 45faec05e5 CMakePM: expand macros for all configure cacheVariables
Fixes: QTCREATORBUG-28982
Change-Id: Iabbf39b815ed7477a9d272a320308f320a31adbc
Reviewed-by: hjk <hjk@qt.io>
2023-04-17 15:03:53 +00:00

81 lines
2.7 KiB
C++

// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <utils/environmentfwd.h>
namespace Utils {
class Environment;
class FilePath;
}
namespace CMakeProjectManager::Internal {
namespace PresetsDetails {
class ConfigurePreset;
}
namespace CMakePresets::Macros {
/**
* Expands the CMakePresets Macros using Utils::Environment as target and source for parent environment values.
* $penv{PATH} is taken from Utils::Environment
*/
template<class PresetType>
void expand(const PresetType &preset,
Utils::Environment &env,
const Utils::FilePath &sourceDirectory);
/**
* Expands the CMakePresets Macros using Utils::Environment as target
* $penv{PATH} is replaced with Qt Creator macros ${PATH}
*/
template<class PresetType>
void expand(const PresetType &preset,
Utils::EnvironmentItems &envItems,
const Utils::FilePath &sourceDirectory);
/**
* Expands the CMakePresets macros inside the @value QString parameter.
*/
template<class PresetType>
void expand(const PresetType &preset,
const Utils::Environment &env,
const Utils::FilePath &sourceDirectory,
QString &value);
/**
* Updates the cacheVariables parameter of the configurePreset with the expandned toolchainFile parameter.
* Including macro expansion and relative paths resolving.
*/
void updateToolchainFile(PresetsDetails::ConfigurePreset &configurePreset,
const Utils::Environment &env,
const Utils::FilePath &sourceDirectory,
const Utils::FilePath &buildDirectory);
/**
* Updates the cacheVariables parameter of the configurePreset with the expanded installDir parameter.
* Including macro expansion and relative paths resolving.
*/
void updateInstallDir(PresetsDetails::ConfigurePreset &configurePreset,
const Utils::Environment &env,
const Utils::FilePath &sourceDirectory);
/**
* Updates the cacheVariables parameter of the configurePreset with the expanded prameter values.
* Including macro expansion and relative paths resolving.
*/
void updateCacheVariables(PresetsDetails::ConfigurePreset &configurePreset,
const Utils::Environment &env,
const Utils::FilePath &sourceDirectory);
/**
* Expands the condition values and then evaluates the condition object of the preset and returns
* the boolean result.
*/
template<class PresetType>
bool evaluatePresetCondition(const PresetType &preset, const Utils::FilePath &sourceDirectory);
} // namespace CMakePresets::Macros
} // namespace CMakeProjectManager::Internal