From f087e63bf585f51d6c530dd58a57155835e6df2c Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Mon, 2 May 2022 12:48:37 +0200 Subject: CMake: Make possible building Qt tools without the use of core library Replace BOOTSTRAP option with the single value CORE_LIBRARY argument in qt_internal_add_tool and qt_internal_add_executable functions. The introduced argument now may accept 'Bootstap' and 'None' values. Use 'Bootstap' to link Qt::Boostrap library instead Qt::Core or 'None' to avoid any core library linking. This is useful for tools that need to use the CMake deployment routines, but not require the Qt::Core functionality. Task-number: QTBUG-87480 Change-Id: I64a8b17f16ac5fe43c6b385252dc21def0c88d2c Reviewed-by: Alexandru Croitor --- 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 3c6a1462eb..80eb17e164 100644 --- a/cmake/QtExecutableHelpers.cmake +++ b/cmake/QtExecutableHelpers.cmake @@ -1,6 +1,13 @@ # This function creates a CMake target for a generic console or GUI binary. # Please consider to use a more specific version target like the one created # by qt_add_test or qt_add_tool below. +# One-value Arguments: +# CORE_LIBRARY +# The argument accepts 'Bootstrap' or 'None' values. If the argument value is set to +# 'Bootstrap' the Qt::Bootstrap library is linked to the executable instead of Qt::Core. +# The 'None' value points that core library is not necessary and avoids linking neither +# Qt::Core or Qt::Bootstrap libraries. Otherwise the Qt::Core library will be publically +# linked to the executable target by default. function(qt_internal_add_executable name) qt_parse_all_arguments(arg "qt_internal_add_executable" "${__qt_internal_add_executable_optional_args}" @@ -85,8 +92,10 @@ function(qt_internal_add_executable name) qt_skip_warnings_are_errors_when_repo_unclean("${name}") set(extra_libraries "") - if(NOT arg_BOOTSTRAP) - set(extra_libraries "Qt::Core") + if(arg_CORE_LIBRARY STREQUAL "Bootstrap") + list(APPEND extra_libraries ${QT_CMAKE_EXPORT_NAMESPACE}::Bootstrap) + elseif(NOT arg_CORE_LIBRARY STREQUAL "None") + list(APPEND extra_libraries ${QT_CMAKE_EXPORT_NAMESPACE}::Core) endif() set(private_includes -- cgit v1.2.3