diff options
author | Craig Scott <craig.scott@qt.io> | 2021-08-30 18:57:02 +1000 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-31 06:49:39 +0000 |
commit | 0cca1f27fe32fdf62850b2037509ff1d516a6309 (patch) | |
tree | 76b8fb5f53f38147787c8387a1c43aa5de1a77ac | |
parent | 73482435a4404c567ad2cd82415b9394a2c6409c (diff) |
Catch using the same output directory for different QML modules
Fixes: QTBUG-95207
Change-Id: I1d967e15652b004c792737f92490544f4fabb908
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 2a374f15a8b40da008b3fa6d868359e49c2bae06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/qml/Qt6QmlMacros.cmake | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index a47737d3bc..83d7393335 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -275,6 +275,24 @@ function(qt6_add_qml_module target) endif() endif() + # Sanity check that we are not trying to have two different QML modules use + # the same output directory. + get_property(dirs GLOBAL PROPERTY _qt_all_qml_output_dirs) + if(dirs) + list(FIND dirs "${arg_OUTPUT_DIRECTORY}" index) + if(NOT index EQUAL -1) + get_property(qml_targets GLOBAL PROPERTY _qt_all_qml_targets) + list(GET qml_targets ${index} other_target) + message(FATAL_ERROR + "Output directory for target \"${target}\" is already used by " + "another QML module (target \"${other_target}\"). " + "Output directory is:\n ${arg_OUTPUT_DIRECTORY}\n" + ) + endif() + endif() + set_property(GLOBAL APPEND PROPERTY _qt_all_qml_output_dirs ${arg_OUTPUT_DIRECTORY}) + set_property(GLOBAL APPEND PROPERTY _qt_all_qml_targets ${target}) + # TODO: Support for old keyword, remove once all repos no longer use CLASSNAME if(arg_CLASSNAME) if(arg_CLASS_NAME AND NOT arg_CLASSNAME STREQUAL arg_CLASS_NAME) |