aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-07-14 23:46:18 +1000
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-20 08:37:41 +0000
commit2f02f108d918d8e43027ed9d04690439d1761839 (patch)
treeaa787b1ee18d32a28c959468c9754e25d86afe79
parentec8c37ee527bfad072ccfa9aec1dbb0e54259e44 (diff)
CMake: Remove OUTPUT_DIRECTORY option from qt6_qml_type_registration()
The output directory is already recorded on the target passed to the command, so use that target property instead. Task-number: QTBUG-94164 Change-Id: I80fe3975338480aa5f3bc2f01443811e0b4c45bc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit f6f767bd9fe01816e3dfe7f1e662eac77e460bbf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/qml/Qt6QmlMacros.cmake15
-rw-r--r--tests/auto/qml/qmltyperegistrar/CMakeLists.txt6
2 files changed, 9 insertions, 12 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake
index 2d9e6b55f3..24a88737ee 100644
--- a/src/qml/Qt6QmlMacros.cmake
+++ b/src/qml/Qt6QmlMacros.cmake
@@ -456,7 +456,7 @@ function(qt6_add_qml_module target)
endforeach()
if(NOT arg_NO_GENERATE_QMLTYPES)
- qt6_qml_type_registration(${target} OUTPUT_DIRECTORY ${arg_OUTPUT_DIRECTORY})
+ qt6_qml_type_registration(${target})
endif()
set(output_targets)
@@ -1484,16 +1484,12 @@ endif()
# properties normally set by qt6_add_qml_module() will be retrieved from this
# target. (REQUIRED)
#
-# OUTPUT_DIRECTORY: Specifies the directory in which to write the generated
-# ${target}.qmltypes file. If not given, it defaults to the binary directory
-# of the target. (OPTIONAL)
-#
# MANUAL_MOC_JSON_FILES: Specifies a list of json files, generated by a manual
# moc call, to extract metatypes. (OPTIONAL)
#
function(qt6_qml_type_registration target)
set(args_option "")
- set(args_single OUTPUT_DIRECTORY)
+ set(args_single "")
set(args_multi MANUAL_MOC_JSON_FILES)
cmake_parse_arguments(PARSE_ARGV 1 arg
@@ -1536,6 +1532,7 @@ function(qt6_qml_type_registration target)
qt6_extract_metatypes(${target} ${meta_types_json_args})
get_target_property(import_version ${target} QT_QML_MODULE_VERSION)
+ get_target_property(output_dir ${target} QT_QML_MODULE_OUTPUT_DIR)
get_target_property(target_source_dir ${target} SOURCE_DIR)
get_target_property(target_binary_dir ${target} BINARY_DIR)
get_target_property(target_metatypes_file ${target} INTERFACE_QT_META_TYPES_BUILD_FILE)
@@ -1543,10 +1540,6 @@ function(qt6_qml_type_registration target)
message(FATAL_ERROR "Target ${target} does not have a meta types file")
endif()
- if(NOT arg_OUTPUT_DIRECTORY)
- set(arg_OUTPUT_DIRECTORY ${target_binary_dir})
- endif()
-
# Extract major and minor version (could also have patch part, but we don't
# need that here)
if (import_version MATCHES "^([0-9]+)\\.([0-9]+)")
@@ -1566,7 +1559,7 @@ function(qt6_qml_type_registration target)
endif()
set(cmd_args)
- set(plugin_types_file "${arg_OUTPUT_DIRECTORY}/${qmltypes_output_name}")
+ set(plugin_types_file "${output_dir}/${qmltypes_output_name}")
set(generated_marker_file "${target_binary_dir}/.generated/${qmltypes_output_name}")
get_filename_component(generated_marker_dir "${generated_marker_file}" DIRECTORY)
set_target_properties(${target} PROPERTIES
diff --git a/tests/auto/qml/qmltyperegistrar/CMakeLists.txt b/tests/auto/qml/qmltyperegistrar/CMakeLists.txt
index 674dc08056..dfd404575b 100644
--- a/tests/auto/qml/qmltyperegistrar/CMakeLists.txt
+++ b/tests/auto/qml/qmltyperegistrar/CMakeLists.txt
@@ -33,12 +33,16 @@ qt_internal_add_test(tst_qmltyperegistrar
## Scopes:
#####################################################################
+# Simulate conditions that qt6_add_qml_module() would normally set up for us
set_target_properties(tst_qmltyperegistrar PROPERTIES
QT_QML_MODULE_VERSION 1.0
QT_QML_PAST_MAJOR_VERSIONS 0
QT_QML_MODULE_URI QmlTypeRegistrarTest
QT_QMLTYPES_FILENAME tst_qmltyperegistrar.qmltypes
+ QT_QML_MODULE_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}
)
-qt6_qml_type_registration(tst_qmltyperegistrar MANUAL_MOC_JSON_FILES ${json_list}) # special case
+# qt6_add_qml_module() doesn't allow us to pass through MANUAL_MOC_JSON_FILES
+# yet, so we have to call it directly to test that code path for now.
+qt6_qml_type_registration(tst_qmltyperegistrar MANUAL_MOC_JSON_FILES ${json_list})
add_subdirectory(foreign)