@@ -79,8 +79,8 @@ macro(export_qmlfiles PLUGIN PATH)
7979endmacro()
8080
8181
82−# Creates a target for generating the typeinfo file for a QML plugin and optionally installs
83−# additional targets.
82+# Creates a target for generating the typeinfo file for a QML plugin and/or installs the plugin
83+# targets.
8484#
8585# Files will be copied into ${BINARY_DIR}/${path} or ${CMAKE_CURRENT_BINARY_DIR} and installed
8686# into ${DESTINATION}/${path}. If you don't pass BINARY_DIR, it's assumed that current source
@@ -94,6 +94,7 @@ endmacro()
9494# [TARGET_PREFIX string] # Will be prefixed to the target name
9595# [ENVIRONMENT string] # Will be added to qmlplugindump's env
9696# [TARGETS target1 [target2 ...]] # Targets to depend on and install (e.g. the plugin shared object)
97+# [NO_TYPES] # Do not create the qmltypes target
9798# )
9899#
99100# Created target:
@@ -101,9 +102,10 @@ endmacro()
101102# It will be made a dependency of the "qmltypes" target.
102103
103104macro(export_qmlplugin PLUGIN VERSION PATH)
105+ set(options NO_TYPES)
104106 set(single BINARY_DIR DESTINATION TARGET_PREFIX ENVIRONMENT)
105107 set(multi TARGETS)
106− cmake_parse_arguments(QMLPLUGIN "" "${single}" "${multi}" ${ARGN})
108+ cmake_parse_arguments(QMLPLUGIN "${options}" "${single}" "${multi}" ${ARGN})
107109
108110 get_target_property(qmlplugindump_executable qmlplugindump LOCATION)
109111
@@ -115,21 +117,23 @@ macro(export_qmlplugin PLUGIN VERSION PATH)
115117 set(qmlplugin_dir ${CMAKE_CURRENT_BINARY_DIR})
116118 endif()
117119
118− # Relative path for the module
119− string(REPLACE "${CMAKE_BINARY_DIR}/" "" QMLPLUGIN_MODULE_DIR "${QMLPLUGIN_BINARY_DIR}")
120+ if(NOT QMLPLUGIN_NO_TYPES)
121+ # Relative path for the module
122+ string(REPLACE "${CMAKE_BINARY_DIR}/" "" QMLPLUGIN_MODULE_DIR "${QMLPLUGIN_BINARY_DIR}")
120123
121− # Find the last segment of the plugin name to use as qmltypes basename
122− string(REGEX MATCH "[^.]+$" plugin_suffix ${PLUGIN})
123− set(target_prefix ${QMLPLUGIN_TARGET_PREFIX}${PLUGIN})
124− set(qmltypes_path ${CMAKE_CURRENT_SOURCE_DIR}/${plugin_suffix}.qmltypes)
124+ # Find the last segment of the plugin name to use as qmltypes basename
125+ string(REGEX MATCH "[^.]+$" plugin_suffix ${PLUGIN})
126+ set(target_prefix ${QMLPLUGIN_TARGET_PREFIX}${PLUGIN})
127+ set(qmltypes_path ${CMAKE_CURRENT_SOURCE_DIR}/${plugin_suffix}.qmltypes)
125128
126− add_custom_target(${target_prefix}-qmltypes
127− COMMAND env ${QMLPLUGIN_ENVIRONMENT} ${qmlplugindump_executable} -notrelocatable
128− ${PLUGIN} ${VERSION} ${QMLPLUGIN_MODULE_DIR} > ${qmltypes_path}
129− WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
130− )
131− add_dependencies(${target_prefix}-qmltypes ${target_prefix}-qmlfiles ${QMLPLUGIN_TARGETS})
132− add_dependencies(qmltypes ${target_prefix}-qmltypes)
129+ add_custom_target(${target_prefix}-qmltypes
130+ COMMAND env ${QMLPLUGIN_ENVIRONMENT} ${qmlplugindump_executable} -notrelocatable
131+ ${PLUGIN} ${VERSION} ${QMLPLUGIN_MODULE_DIR} > ${qmltypes_path}
132+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
133+ )
134+ add_dependencies(${target_prefix}-qmltypes ${target_prefix}-qmlfiles ${QMLPLUGIN_TARGETS})
135+ add_dependencies(qmltypes ${target_prefix}-qmltypes)
136+ endif()
133137
134138 set_target_properties(${QMLPLUGIN_TARGETS} PROPERTIES
135139 ARCHIVE_OUTPUT_DIRECTORY ${qmlplugin_dir}