From ef236456a4857a25b51688e1fd629a80caee1e34 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 27 May 2020 10:42:35 +0200 Subject: [PATCH] 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 --- mkspecs/features/metatypes.prf | 9 +++++++++ 1 file changed, 9 insertions(+) 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