diff options
author | Dominik Holland <dominik.holland@qt.io> | 2022-07-28 10:45:20 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-08-18 01:04:54 +0000 |
commit | 84ff7c8a9c0cc3523a7d99e018754b77cf4a792d (patch) | |
tree | 7b5c17fc35f7b36033c876224fe57e2fc8283da3 | |
parent | 045400ff95ef5c6b849285e66a14865099dc9ba7 (diff) |
ifcodegen: Don't propagate library dependencies for plugins and executables
For plugin templates like 'backend_qtro' or executables template like
'server_qtro' it doesn't make sense to expose public dependencies to
other libraries.
The only case where library dependencies are exposed is for the
'frontend' template as it is used to create a library.
It is still possible to add library dependencies manually as
well by using qt_ifcodegen_import_variables instead of
qt_ifcodegen_extend_target.
Fixes: QTBUG-105218
Change-Id: I1026e7d87647430bd27d9e7342ea8544cb096788
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Robert Griebl <robert.griebl@qt.io>
(cherry picked from commit 21202aeaac0ccb60dcdb04dd42ba40843ca9c487)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
7 files changed, 16 insertions, 34 deletions
diff --git a/src/plugins/ifvehiclefunctions/vehiclefunctions_qtro/CMakeLists.txt b/src/plugins/ifvehiclefunctions/vehiclefunctions_qtro/CMakeLists.txt index af49c41a..daa9009f 100644 --- a/src/plugins/ifvehiclefunctions/vehiclefunctions_qtro/CMakeLists.txt +++ b/src/plugins/ifvehiclefunctions/vehiclefunctions_qtro/CMakeLists.txt @@ -14,19 +14,6 @@ qt_internal_add_plugin(VehicleQtROPlugin Qt::IfVehicleFunctions ) -# Workaround for QTBUG-105215 -# Plugins usually don't take PUBLIC_LIBRARIES, but in this case we have to force the creation -# of a Qt6VehicleQtROPluginDependencies.cmake file to find the Qt6IfRemoteObjectsHelperPrivate -# package because it gets (wrongly) added as a public dependency by qt_ifcodegen_extend_target, -# which causes the library to appear in the plugin's exported INTERFACE_LINK_LIBRARIES. -# Qt only writes find_depednency calls for Qt packages that are specified via -# qt_internal_extend_target, not via target_link_libraries. -# So the dependency specified via qt_ifcodegen_extend_target is not seen. -qt_internal_extend_target(VehicleQtROPlugin - PUBLIC_LIBRARIES - Qt::IfRemoteObjectsHelperPrivate -) - # Interface Framework Generator: qt_ifcodegen_extend_target(VehicleQtROPlugin IDL_FILES ../../../ifvehiclefunctions/ifvehiclefunctions.qface diff --git a/src/tools/ifcodegen/templates/backend_qtro/CMakeLists.txt.tpl b/src/tools/ifcodegen/templates/backend_qtro/CMakeLists.txt.tpl index 72a51156..dc7a4381 100644 --- a/src/tools/ifcodegen/templates/backend_qtro/CMakeLists.txt.tpl +++ b/src/tools/ifcodegen/templates/backend_qtro/CMakeLists.txt.tpl @@ -37,11 +37,11 @@ if (TARGET ${CURRENT_TARGET}) ${${VAR_PREFIX}_REPLICAS} ) - target_link_libraries(${CURRENT_TARGET} PUBLIC + target_link_libraries(${CURRENT_TARGET} PRIVATE ${${VAR_PREFIX}_LIBRARIES} ) - target_include_directories(${CURRENT_TARGET} PUBLIC + target_include_directories(${CURRENT_TARGET} PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> ) endif() diff --git a/src/tools/ifcodegen/templates/backend_simulator/CMakeLists.txt.tpl b/src/tools/ifcodegen/templates/backend_simulator/CMakeLists.txt.tpl index cc3ce750..0f7cb45f 100644 --- a/src/tools/ifcodegen/templates/backend_simulator/CMakeLists.txt.tpl +++ b/src/tools/ifcodegen/templates/backend_simulator/CMakeLists.txt.tpl @@ -25,11 +25,11 @@ if (TARGET ${CURRENT_TARGET}) ${${VAR_PREFIX}_SOURCES} ) - target_include_directories(${CURRENT_TARGET} PUBLIC + target_include_directories(${CURRENT_TARGET} PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> ) - target_link_libraries(${CURRENT_TARGET} PUBLIC + target_link_libraries(${CURRENT_TARGET} PRIVATE ${${VAR_PREFIX}_LIBRARIES} ) endif() diff --git a/src/tools/ifcodegen/templates/qmlplugin/CMakeLists.txt.tpl b/src/tools/ifcodegen/templates/qmlplugin/CMakeLists.txt.tpl index 7d96ff86..82e4df77 100644 --- a/src/tools/ifcodegen/templates/qmlplugin/CMakeLists.txt.tpl +++ b/src/tools/ifcodegen/templates/qmlplugin/CMakeLists.txt.tpl @@ -35,16 +35,11 @@ if (TARGET ${CURRENT_TARGET}) ${${VAR_PREFIX}_SOURCES} ) - target_link_libraries(${CURRENT_TARGET} - PUBLIC - ${${VAR_PREFIX}_LIBRARIES} - ) - - target_include_directories(${CURRENT_TARGET} PUBLIC + target_include_directories(${CURRENT_TARGET} PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> ) - target_link_libraries(${CURRENT_TARGET} PUBLIC + target_link_libraries(${CURRENT_TARGET} PRIVATE ${${VAR_PREFIX}_LIBRARIES} ) endif() diff --git a/src/tools/ifcodegen/templates/server_qtro/CMakeLists.txt.tpl b/src/tools/ifcodegen/templates/server_qtro/CMakeLists.txt.tpl index 3c5d1609..1a069a8a 100644 --- a/src/tools/ifcodegen/templates/server_qtro/CMakeLists.txt.tpl +++ b/src/tools/ifcodegen/templates/server_qtro/CMakeLists.txt.tpl @@ -34,11 +34,11 @@ if (TARGET ${CURRENT_TARGET}) ${${VAR_PREFIX}_REPLICAS} ) - target_link_libraries(${CURRENT_TARGET} PUBLIC - ${${VAR_PREFIX}_LIBRARIES} + target_include_directories(${CURRENT_TARGET} PRIVATE + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> ) - target_include_directories(${CURRENT_TARGET} PUBLIC - $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> + target_link_libraries(${CURRENT_TARGET} PRIVATE + ${${VAR_PREFIX}_LIBRARIES} ) endif() diff --git a/src/tools/ifcodegen/templates/server_qtro_simulator/CMakeLists.txt.tpl b/src/tools/ifcodegen/templates/server_qtro_simulator/CMakeLists.txt.tpl index afdece86..a0c33f73 100644 --- a/src/tools/ifcodegen/templates/server_qtro_simulator/CMakeLists.txt.tpl +++ b/src/tools/ifcodegen/templates/server_qtro_simulator/CMakeLists.txt.tpl @@ -48,11 +48,11 @@ if (TARGET ${CURRENT_TARGET}) ${${VAR_PREFIX}_REPLICAS} ) - target_link_libraries(${CURRENT_TARGET} PUBLIC - ${${VAR_PREFIX}_LIBRARIES} + target_include_directories(${CURRENT_TARGET} PRIVATE + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> ) - target_include_directories(${CURRENT_TARGET} PUBLIC - $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> + target_link_libraries(${CURRENT_TARGET} PRIVATE + ${${VAR_PREFIX}_LIBRARIES} ) endif() diff --git a/src/tools/ifcodegen/templates/test/CMakeLists.txt.tpl b/src/tools/ifcodegen/templates/test/CMakeLists.txt.tpl index 17a89778..6085622e 100644 --- a/src/tools/ifcodegen/templates/test/CMakeLists.txt.tpl +++ b/src/tools/ifcodegen/templates/test/CMakeLists.txt.tpl @@ -22,11 +22,11 @@ if (TARGET ${CURRENT_TARGET}) ${${VAR_PREFIX}_SOURCES} ) - target_include_directories(${CURRENT_TARGET} PUBLIC + target_include_directories(${CURRENT_TARGET} PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> ) - target_link_libraries(${CURRENT_TARGET} PUBLIC + target_link_libraries(${CURRENT_TARGET} PRIVATE ${${VAR_PREFIX}_LIBRARIES} ) endif() |