Only add --automoc-json to AUTOMOC_OPTIONS for metatypes targets

Change-Id: I7c2e859a83ea78c2a6cf2ad59c175c1b29a74621
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Leander Beernaert 2020-01-29 16:25:06 +01:00 committed by Alexandru Croitor
parent 274a61d096
commit f47efdac1d
2 changed files with 5 additions and 1 deletions

View File

@ -1147,7 +1147,6 @@ function(qt_extend_target target)
${private_visibility_option} ${arg_LINK_OPTIONS})
if(NOT arg_HEADER_MODULE)
list(APPEND arg_MOC_OPTIONS "--output-json")
set_target_properties("${target}" PROPERTIES
AUTOMOC_MOC_OPTIONS "${arg_MOC_OPTIONS}"
_qt_target_deps "${target_deps}"

View File

@ -707,6 +707,11 @@ function(qt6_generate_meta_types_json_file target)
endif()
endif()
# Tell automoc to output json files
set_property(TARGET "${target}" APPEND PROPERTY
AUTOMOC_MOC_OPTIONS "--output-json"
)
get_target_property(target_type ${target} TYPE)
if (target_type STREQUAL "INTERFACE_LIBRARY" OR CMAKE_VERSION VERSION_LESS "3.16.0")
# interface libraries not supported or cmake version is not high enough