diff options
author | Craig Scott <craig.scott@qt.io> | 2021-03-31 13:56:51 +1100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-04-07 14:02:35 +0000 |
commit | bde2716f43e09bb575a11be17950226a19afe09e (patch) | |
tree | 2a21fad815c4d11e131a912e0ddbbdff3c53977d | |
parent | a3316d6c95641b91321ade7fc9a5f88226973b55 (diff) |
Avoid using prohibited target property names with INTERFACE targets
CMake 3.19 removed the restrictions on allowable names for properties
on INTERFACE targets. With earlier CMake versions (back to CMake 3.11),
names for custom properties must begin with either a lowercase letter
or an underscore.
In 5807e1ae81 (Add plugins to Qt tools and executables for static
builds, 2021-03-19), the names QT_REPO_PLUGIN_CLASS_NAMES and
QT_REPO_PLUGINS were used, but in some cases, the targets on which they
were being set are INTERFACE targets. Replace these with names that
are supported with CMake 3.11 or later.
Amends 5807e1ae8168a5702ad0f6890d2b35223cfebdee
Task-number: QTBUG-91915
Change-Id: Ife702a1fb339b190d46a8dafb380253219199ba6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 256dea0df74dc05ded438b33b6be8735048fd402)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | cmake/QtExecutableHelpers.cmake | 4 | ||||
-rw-r--r-- | cmake/QtPluginHelpers.cmake | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/cmake/QtExecutableHelpers.cmake b/cmake/QtExecutableHelpers.cmake index bccab32b87..ebfc85eb8e 100644 --- a/cmake/QtExecutableHelpers.cmake +++ b/cmake/QtExecutableHelpers.cmake @@ -197,7 +197,7 @@ function(qt_internal_add_executable name) endif() string(MAKE_C_IDENTIFIER "${name}_plugin_imports_${lib}" out_file) string(APPEND out_file .cpp) - set(class_names "$<GENEX_EVAL:$<TARGET_PROPERTY:${lib},QT_REPO_PLUGIN_CLASS_NAMES>>") + set(class_names "$<GENEX_EVAL:$<TARGET_PROPERTY:${lib},_qt_repo_plugin_class_names>>") file(GENERATE OUTPUT ${out_file} CONTENT "// This file is auto-generated. Do not edit. #include <QtPlugin> @@ -209,7 +209,7 @@ Q_IMPORT_PLUGIN($<JOIN:${class_names},)\nQ_IMPORT_PLUGIN(>) target_sources(${name} PRIVATE "$<$<NOT:$<STREQUAL:${class_names},>>:${out_file}>" ) - target_link_libraries(${name} PRIVATE "$<TARGET_PROPERTY:${lib},QT_REPO_PLUGINS>") + target_link_libraries(${name} PRIVATE "$<TARGET_PROPERTY:${lib},_qt_repo_plugins>") endforeach() endif() endfunction() diff --git a/cmake/QtPluginHelpers.cmake b/cmake/QtPluginHelpers.cmake index 1eb800cb0b..36c1335f6c 100644 --- a/cmake/QtPluginHelpers.cmake +++ b/cmake/QtPluginHelpers.cmake @@ -169,8 +169,8 @@ function(qt_internal_add_plugin target) DEFINITION PROJECT_NAME ) if(module_project_name STREQUAL PROJECT_NAME) - set_property(TARGET ${qt_module_target} APPEND PROPERTY QT_REPO_PLUGINS "${target}") - set_property(TARGET ${qt_module_target} APPEND PROPERTY QT_REPO_PLUGIN_CLASS_NAMES + set_property(TARGET ${qt_module_target} APPEND PROPERTY _qt_repo_plugins "${target}") + set_property(TARGET ${qt_module_target} APPEND PROPERTY _qt_repo_plugin_class_names "$<TARGET_PROPERTY:${target},QT_PLUGIN_CLASS_NAME>" ) endif() @@ -178,7 +178,7 @@ function(qt_internal_add_plugin target) # TODO: If a repo A provides an internal executable E and a plugin P, with the plugin # type belonging to a Qt module defined in a different repo, and executable E needs to # link to plugin P in a static build, currently that won't happen. The executable E - # will link to plugins mentioned in the Qt module's QT_REPO_PLUGINS property, but that + # will link to plugins mentioned in the Qt module's _qt_repo_plugins property, but that # property will not list P because the Qt module will be an imported target and won't # have a SOURCE_DIR or PROJECT NAME, so the checks above will not be met. # Figure out how to handle such a scenario. |