Skip to content

Commit

Permalink
Always add an empty json file to MOC_JSON_FILES
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Ulf Hermann committed Jun 9, 2020
1 parent db1de48 commit ef23645
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mkspecs/features/metatypes.prf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ef23645

Please sign in to comment.