aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmltc/main.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-09-08 16:18:34 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-09-09 15:40:40 +0200
commit2f583eeab254edbb0e1b42213e9d48ce6ad3f04e (patch)
tree5b2065196d1f566ab496e909e50e20fa07ab3d42 /tools/qmltc/main.cpp
parent3a35b57269519bfed2418e27ed9daf69f27576a0 (diff)
Add --bare option to qmltc and qmlcachegen
We need those to prevent usage of the host Qt's import path when building QML files for the target. Task-number: QTBUG-106365 Pick-to: 6.4 6.4.0 Change-Id: I34499af850fb759603206cb429ff97633c76054d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tools/qmltc/main.cpp')
-rw-r--r--tools/qmltc/main.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/qmltc/main.cpp b/tools/qmltc/main.cpp
index d3ba670ada..5314b1a2c0 100644
--- a/tools/qmltc/main.cpp
+++ b/tools/qmltc/main.cpp
@@ -53,6 +53,14 @@ int main(int argc, char **argv)
parser.addHelpOption();
parser.addVersionOption();
+ QCommandLineOption bareOption {
+ u"bare"_s,
+ QCoreApplication::translate(
+ "main", "Do not include default import directories. This may be used to run "
+ "qmltc on a project using a different Qt version.")
+ };
+ parser.addOption(bareOption);
+
QCommandLineOption importPathOption {
u"I"_s, QCoreApplication::translate("main", "Look for QML modules in specified directory"),
QCoreApplication::translate("main", "import directory")
@@ -124,7 +132,8 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
QStringList importPaths = parser.values(importPathOption);
- importPaths.append(QLibraryInfo::path(QLibraryInfo::QmlImportsPath));
+ if (!parser.isSet(bareOption))
+ importPaths.append(QLibraryInfo::path(QLibraryInfo::QmlImportsPath));
QStringList qmldirFiles = parser.values(qmldirOption);
QString outputCppFile;