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