From ea8645d8468c9647e6b5847d9787ca0da1f3262c Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 19 Jul 2022 19:56:22 +0200 Subject: CMake: Deprecate _add_app/executable/test/tool PUBLIC_LIBRARIES option Warn projects not to use it because PUBLIC_LIBRARIES don't make sense for executable targets and it also led to some issues in the internal functions where some of them did not expect to receive PUBLIC_LIBRARIES. To ensure builds don't needlessly break, treat PUBLIC_LIBRARIES values as regular LIBRARIES. In the future we might add an error instead. Using PUBLIC_LIBRARIES in qt_internal_add_app, etc, accidentally worked because the option name and the values following it were parsed as values of the "previous" option, like SOURCES or INCLUDE_DIRECTORIES or LIBRARIES, and when those got passed through to qt_internal_extend_target, things magically worked. We have a lot of projects using PUBLIC_LIBRARIES, mostly due to the way qmake pro files were written and how pro2cmake converted them. We'll have to clean up each repo. Change-Id: I69e09d34afdf98f0d47c08d324643fc986f8131c Reviewed-by: Alexey Edelev --- cmake/QtExecutableHelpers.cmake | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'cmake/QtExecutableHelpers.cmake') diff --git a/cmake/QtExecutableHelpers.cmake b/cmake/QtExecutableHelpers.cmake index ef6800fa7b..c9129d3b5e 100644 --- a/cmake/QtExecutableHelpers.cmake +++ b/cmake/QtExecutableHelpers.cmake @@ -104,12 +104,21 @@ function(qt_internal_add_executable name) ${arg_INCLUDE_DIRECTORIES} ) + if(arg_PUBLIC_LIBRARIES) + message(WARNING + "qt_internal_add_executable's PUBLIC_LIBRARIES option is deprecated, and will be " + "removed in a future Qt version. Use the LIBRARIES option instead.") + endif() + qt_internal_extend_target("${name}" SOURCES ${arg_SOURCES} INCLUDE_DIRECTORIES ${private_includes} DEFINES ${arg_DEFINES} - LIBRARIES ${arg_LIBRARIES} Qt::PlatformCommonInternal - PUBLIC_LIBRARIES ${extra_libraries} ${arg_PUBLIC_LIBRARIES} + LIBRARIES + ${arg_LIBRARIES} + ${arg_PUBLIC_LIBRARIES} + Qt::PlatformCommonInternal + ${extra_libraries} DBUS_ADAPTOR_SOURCES "${arg_DBUS_ADAPTOR_SOURCES}" DBUS_ADAPTOR_FLAGS "${arg_DBUS_ADAPTOR_FLAGS}" DBUS_INTERFACE_SOURCES "${arg_DBUS_INTERFACE_SOURCES}" -- cgit v1.2.3