CMakePM: Refactor CMakeLists|Cache.txt as constants

Change-Id: I7165fa1d219a0c59bc519a9af1cd194414c4311c
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2024-01-22 18:10:43 +01:00
parent b953735b22
commit 76a8966739
13 changed files with 39 additions and 25 deletions

View File

@@ -853,7 +853,8 @@ CMakeConfig CMakeBuildSettingsWidget::getQmlDebugCxxFlags()
CMakeConfig changedConfig;
if (enable) {
const FilePath cmakeCache = m_buildConfig->buildDirectory().pathAppended("CMakeCache.txt");
const FilePath cmakeCache = m_buildConfig->buildDirectory().pathAppended(
Constants::CMAKE_CACHE_TXT);
// Only modify the CMAKE_CXX_FLAGS variable if the project was previously configured
// otherwise CMAKE_CXX_FLAGS_INIT will take care of setting the qmlDebug define
@@ -1349,8 +1350,10 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
if (oldDir.isEmpty())
return newDir;
const FilePath oldDirCMakeCache = FilePath::fromUserInput(oldDir).pathAppended("CMakeCache.txt");
const FilePath newDirCMakeCache = FilePath::fromUserInput(newDir).pathAppended("CMakeCache.txt");
const FilePath oldDirCMakeCache = FilePath::fromUserInput(oldDir).pathAppended(
Constants::CMAKE_CACHE_TXT);
const FilePath newDirCMakeCache = FilePath::fromUserInput(newDir).pathAppended(
Constants::CMAKE_CACHE_TXT);
if (oldDirCMakeCache.exists() && !newDirCMakeCache.exists()) {
if (QMessageBox::information(
@@ -2048,7 +2051,8 @@ QString CMakeBuildSystem::cmakeBuildType() const
QString cmakeBuildType = cmakeBuildConfiguration()->buildTypeAspect();
const Utils::FilePath cmakeCacheTxt = buildConfiguration()->buildDirectory().pathAppended("CMakeCache.txt");
const Utils::FilePath cmakeCacheTxt = buildConfiguration()->buildDirectory().pathAppended(
Constants::CMAKE_CACHE_TXT);
const bool hasCMakeCache = cmakeCacheTxt.exists();
CMakeConfig config;