summaryrefslogtreecommitdiffstats
path: root/util/cmake/pro2cmake.py
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2020-04-21 13:28:57 +0200
committerLeander Beernaert <leander.beernaert@qt.io>2020-04-22 09:51:12 +0200
commit6fbeef4c6b2323fc4b7856520c0f38f8139c9c54 (patch)
tree9457cdde24cfd8beeddbcf71d294a7af22457dc3 /util/cmake/pro2cmake.py
parent26a0a8942135fed725ec3067ba05bae31bb4e645 (diff)
CMake: Add qt6_add_plugin public API
This patch adds a publicly callable qt6_add_plugin() API to create plugins. This API is meant to cover cases such as the plugandpaint example. This patch also renames qt_add_plugin to qt_internal_add_plugin in order to avoid clashes with the public API. To avoid breaking the existing projects, a compatibility wrapper function is enabled by default unless QT_DISABLE_QT_ADD_PLUGIN_COMPATIBILITY is specified. Fixes: QTBUG-82961 Change-Id: If5b564a8406c90434f1bdad0b8df76d3e6626b5f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'util/cmake/pro2cmake.py')
-rwxr-xr-xutil/cmake/pro2cmake.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 9e183a4b13..4d7c6960cf 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -339,7 +339,7 @@ def set_up_cmake_api_calls():
api[2]["qt_extend_target"] = "qt_extend_target"
api[2]["qt_add_module"] = "qt_add_module"
- api[2]["qt_add_plugin"] = "qt_add_plugin"
+ api[2]["qt_add_plugin"] = "qt_internal_add_plugin"
api[2]["qt_add_tool"] = "qt_add_tool"
api[2]["qt_add_test"] = "qt_add_test"
api[2]["qt_add_test_helper"] = "qt_add_test_helper"
@@ -3396,7 +3396,11 @@ def write_example(
add_target += " INSTALL_LOCATION ${INSTALL_EXAMPLEDIR}\n)\n\n"
add_target += f"target_sources({binary_name} PRIVATE"
else:
- add_target = f"add_library({binary_name} MODULE"
+ add_target = f"qt_add_plugin({binary_name}"
+ if "static" in scope.get("CONFIG"):
+ add_target += " STATIC"
+ add_target += ")\n"
+ add_target += f"target_sources({binary_name} PRIVATE"
else:
add_target = f'add_{"qt_gui_" if gui else ""}executable({binary_name}'