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 <alexandru.croitor@qt.io>
This commit is contained in:
parent
a1437ce162
commit
f087e63bf5
@ -484,7 +484,6 @@ set(__default_target_info_args
|
|||||||
# and qt_internal_add_test_helper.
|
# and qt_internal_add_test_helper.
|
||||||
set(__qt_internal_add_executable_optional_args
|
set(__qt_internal_add_executable_optional_args
|
||||||
GUI
|
GUI
|
||||||
BOOTSTRAP
|
|
||||||
NO_INSTALL
|
NO_INSTALL
|
||||||
EXCEPTIONS
|
EXCEPTIONS
|
||||||
DELAY_RC
|
DELAY_RC
|
||||||
@ -492,6 +491,7 @@ set(__qt_internal_add_executable_optional_args
|
|||||||
QT_APP
|
QT_APP
|
||||||
)
|
)
|
||||||
set(__qt_internal_add_executable_single_args
|
set(__qt_internal_add_executable_single_args
|
||||||
|
CORE_LIBRARY
|
||||||
OUTPUT_DIRECTORY
|
OUTPUT_DIRECTORY
|
||||||
INSTALL_DIRECTORY
|
INSTALL_DIRECTORY
|
||||||
VERSION
|
VERSION
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
# This function creates a CMake target for a generic console or GUI binary.
|
# 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
|
# Please consider to use a more specific version target like the one created
|
||||||
# by qt_add_test or qt_add_tool below.
|
# 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)
|
function(qt_internal_add_executable name)
|
||||||
qt_parse_all_arguments(arg "qt_internal_add_executable"
|
qt_parse_all_arguments(arg "qt_internal_add_executable"
|
||||||
"${__qt_internal_add_executable_optional_args}"
|
"${__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}")
|
qt_skip_warnings_are_errors_when_repo_unclean("${name}")
|
||||||
|
|
||||||
set(extra_libraries "")
|
set(extra_libraries "")
|
||||||
if(NOT arg_BOOTSTRAP)
|
if(arg_CORE_LIBRARY STREQUAL "Bootstrap")
|
||||||
set(extra_libraries "Qt::Core")
|
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()
|
endif()
|
||||||
|
|
||||||
set(private_includes
|
set(private_includes
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# This function is used to define a "Qt tool", such as moc, uic or rcc.
|
# This function is used to define a "Qt tool", such as moc, uic or rcc.
|
||||||
# The BOOTSTRAP option allows building it as standalone program, otherwise
|
|
||||||
# it will be linked against QtCore.
|
|
||||||
#
|
#
|
||||||
# USER_FACING can be passed to mark the tool as a program that is supposed to be
|
# USER_FACING can be passed to mark the tool as a program that is supposed to be
|
||||||
# started directly by users.
|
# started directly by users.
|
||||||
@ -28,13 +26,19 @@
|
|||||||
# TOOLS_TARGET
|
# TOOLS_TARGET
|
||||||
# Specifies the module this tool belongs to. The module's Qt6${module}Tools.cmake file
|
# Specifies the module this tool belongs to. The module's Qt6${module}Tools.cmake file
|
||||||
# will then contain targets for this tool.
|
# will then contain targets for this tool.
|
||||||
#
|
# 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_tool target_name)
|
function(qt_internal_add_tool target_name)
|
||||||
qt_tool_target_to_name(name ${target_name})
|
qt_tool_target_to_name(name ${target_name})
|
||||||
set(option_keywords BOOTSTRAP NO_INSTALL USER_FACING INSTALL_VERSIONED_LINK EXCEPTIONS)
|
set(option_keywords NO_INSTALL USER_FACING INSTALL_VERSIONED_LINK EXCEPTIONS)
|
||||||
set(one_value_keywords
|
set(one_value_keywords
|
||||||
TOOLS_TARGET
|
TOOLS_TARGET
|
||||||
INSTALL_DIR
|
INSTALL_DIR
|
||||||
|
CORE_LIBRARY
|
||||||
${__default_target_info_args})
|
${__default_target_info_args})
|
||||||
set(multi_value_keywords
|
set(multi_value_keywords
|
||||||
EXTRA_CMAKE_FILES
|
EXTRA_CMAKE_FILES
|
||||||
@ -172,16 +176,10 @@ function(qt_internal_add_tool target_name)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(disable_autogen_tools "${arg_DISABLE_AUTOGEN_TOOLS}")
|
set(disable_autogen_tools "${arg_DISABLE_AUTOGEN_TOOLS}")
|
||||||
if (arg_BOOTSTRAP)
|
set(corelib "")
|
||||||
set(corelib ${QT_CMAKE_EXPORT_NAMESPACE}::Bootstrap)
|
if(arg_CORE_LIBRARY STREQUAL "Bootstrap" OR arg_CORE_LIBRARY STREQUAL "None")
|
||||||
|
set(corelib CORE_LIBRARY ${arg_CORE_LIBRARY})
|
||||||
list(APPEND disable_autogen_tools "uic" "moc" "rcc")
|
list(APPEND disable_autogen_tools "uic" "moc" "rcc")
|
||||||
else()
|
|
||||||
set(corelib ${QT_CMAKE_EXPORT_NAMESPACE}::Core)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(bootstrap "")
|
|
||||||
if(arg_BOOTSTRAP)
|
|
||||||
set(bootstrap BOOTSTRAP)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(exceptions "")
|
set(exceptions "")
|
||||||
@ -198,7 +196,6 @@ function(qt_internal_add_tool target_name)
|
|||||||
|
|
||||||
qt_internal_add_executable("${target_name}"
|
qt_internal_add_executable("${target_name}"
|
||||||
OUTPUT_DIRECTORY "${output_dir}"
|
OUTPUT_DIRECTORY "${output_dir}"
|
||||||
${bootstrap}
|
|
||||||
${exceptions}
|
${exceptions}
|
||||||
NO_INSTALL
|
NO_INSTALL
|
||||||
SOURCES ${arg_SOURCES}
|
SOURCES ${arg_SOURCES}
|
||||||
@ -207,7 +204,7 @@ function(qt_internal_add_tool target_name)
|
|||||||
DEFINES
|
DEFINES
|
||||||
QT_USE_QSTRINGBUILDER
|
QT_USE_QSTRINGBUILDER
|
||||||
${arg_DEFINES}
|
${arg_DEFINES}
|
||||||
PUBLIC_LIBRARIES ${corelib}
|
${corelib}
|
||||||
LIBRARIES ${arg_LIBRARIES} Qt::PlatformToolInternal
|
LIBRARIES ${arg_LIBRARIES} Qt::PlatformToolInternal
|
||||||
COMPILE_OPTIONS ${arg_COMPILE_OPTIONS}
|
COMPILE_OPTIONS ${arg_COMPILE_OPTIONS}
|
||||||
LINK_OPTIONS ${arg_LINK_OPTIONS}
|
LINK_OPTIONS ${arg_LINK_OPTIONS}
|
||||||
@ -237,7 +234,7 @@ function(qt_internal_add_tool target_name)
|
|||||||
|
|
||||||
if(TARGET host_tools)
|
if(TARGET host_tools)
|
||||||
add_dependencies(host_tools "${target_name}")
|
add_dependencies(host_tools "${target_name}")
|
||||||
if(bootstrap)
|
if(arg_CORE_LIBRARY STREQUAL "Bootstrap")
|
||||||
add_dependencies(bootstrap_tools "${target_name}")
|
add_dependencies(bootstrap_tools "${target_name}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
qt_get_tool_target_name(target_name cmake_automoc_parser)
|
qt_get_tool_target_name(target_name cmake_automoc_parser)
|
||||||
qt_internal_add_tool(${target_name}
|
qt_internal_add_tool(${target_name}
|
||||||
BOOTSTRAP
|
CORE_LIBRARY Bootstrap
|
||||||
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
|
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
|
||||||
TOOLS_TARGET Core # special case
|
TOOLS_TARGET Core # special case
|
||||||
SOURCES
|
SOURCES
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
qt_get_tool_target_name(target_name moc)
|
qt_get_tool_target_name(target_name moc)
|
||||||
qt_internal_add_tool(${target_name}
|
qt_internal_add_tool(${target_name}
|
||||||
BOOTSTRAP
|
CORE_LIBRARY Bootstrap
|
||||||
TARGET_DESCRIPTION "Qt Meta Object Compiler"
|
TARGET_DESCRIPTION "Qt Meta Object Compiler"
|
||||||
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
|
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
|
||||||
TOOLS_TARGET Core # special case
|
TOOLS_TARGET Core # special case
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
qt_get_tool_target_name(target_name tracegen)
|
qt_get_tool_target_name(target_name tracegen)
|
||||||
qt_internal_add_tool(${target_name}
|
qt_internal_add_tool(${target_name}
|
||||||
BOOTSTRAP
|
CORE_LIBRARY Bootstrap
|
||||||
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
|
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
|
||||||
TOOLS_TARGET Core # special case
|
TOOLS_TARGET Core # special case
|
||||||
SOURCES
|
SOURCES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user