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>
This commit is contained in:
Ulf Hermann 2020-05-27 10:42:35 +02:00
parent db1de48291
commit ef236456a4

View File

@ -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