summaryrefslogtreecommitdiffstats
path: root/mkspecs/features
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-05-27 10:42:35 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-06-09 09:34:18 +0200
commitef236456a4857a25b51688e1fd629a80caee1e34 (patch)
treee1629d87dd9494e70ac5ed808577d8d98b1ec5e1 /mkspecs/features
parentdb1de48291c9ce8316573eac84a9f0e56a8e1ac7 (diff)
Always add an empty json file to MOC_JSON_FILES
This way the metatypes files are generated even if there are no metatypes in the module. This is necessary in order to generate empty QML modules, which in turn is useful if we only want e.g. URL interceptors in a module, but not types. Change-Id: Ief949cfebe831b69353a75d0da15ee347995051c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'mkspecs/features')
-rw-r--r--mkspecs/features/metatypes.prf9
1 files changed, 9 insertions, 0 deletions
diff --git a/mkspecs/features/metatypes.prf b/mkspecs/features/metatypes.prf
index 68c6f1790f..25d05574e6 100644
--- a/mkspecs/features/metatypes.prf
+++ b/mkspecs/features/metatypes.prf
@@ -24,6 +24,15 @@ moc_json_source.depends = $${MOC_JSON_CPP_BASE}${QMAKE_FILE_BASE}$${QMAKE_EXT_CP
moc_json_source.commands = $$escape_expand(\\n) # force creation of rule
moc_json_source.variable_out = MOC_JSON_FILES
+# Add an empty JSON file so that the moc_collect_json rule is executed even if there are no files
+# to run moc on.
+!build_pass {
+ MOC_EMPTY_JSON = "[]"
+ MOC_EMPTY_JSON_FILE = $$OUT_PWD/$${MOC_JSON_H_BASE}$${first(QMAKE_EXT_CPP)}.json
+ write_file($${MOC_EMPTY_JSON_FILE}, MOC_EMPTY_JSON)
+ MOC_JSON_FILES += $${MOC_EMPTY_JSON_FILE}
+}
+
TARGET_BASENAME = $$lower($$basename(TARGET))
TARGET_BASENAME ~= s/\s/_/g