forked from qt-creator/qt-creator
CMake generator: Include qt control configuration file in executable
Task-number: QDS-5815 Change-Id: I8ea049c60ce2f0217e3598e2a2a92dad7a776449 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -576,6 +576,8 @@ bool generateMainCpp(const FilePath &dir)
|
||||
for (EnvironmentItem &envItem : buildSystem->environment()) {
|
||||
QString key = envItem.name;
|
||||
QString value = envItem.value;
|
||||
if (isFileResource(value))
|
||||
value.prepend(":/");
|
||||
environment.append(QString(ENV_HEADER_VARIABLE_LINE).arg(key).arg(value));
|
||||
}
|
||||
QString envHeaderContent = GenerateCmake::readTemplate(ENV_HEADER_TEMPLATE_PATH)
|
||||
@@ -597,7 +599,17 @@ bool generateMainQml(const FilePath &dir)
|
||||
return GenerateCmake::queueFile(filePath, content);
|
||||
}
|
||||
|
||||
const QStringList resourceFileLocations = {"qtquickcontrols2.conf"};
|
||||
|
||||
bool isFileResource(QString &relativeFilePath)
|
||||
{
|
||||
if (resourceFileLocations.contains(relativeFilePath))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
} //GenerateEntryPoints
|
||||
|
||||
} //QmlDesigner
|
||||
|
||||
|
||||
@@ -68,5 +68,6 @@ namespace GenerateEntryPoints {
|
||||
bool generateEntryPointFiles(const Utils::FilePath &dir);
|
||||
bool generateMainCpp(const Utils::FilePath &dir);
|
||||
bool generateMainQml(const Utils::FilePath &dir);
|
||||
bool isFileResource(const QString &relativeFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,12 @@ set(CMAKE_AUTOMOC ON)
|
||||
find_package(Qt6 COMPONENTS Gui Qml Quick)
|
||||
add_executable(%1 src/main.cpp)
|
||||
|
||||
qt_add_resources(%1 "configuration"
|
||||
PREFIX "/"
|
||||
FILES
|
||||
qtquickcontrols2.conf
|
||||
)
|
||||
|
||||
target_link_libraries(%1 PRIVATE
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
|
||||
Reference in New Issue
Block a user