CMake: Add finalization to plugins created with qt_add_plugin
Add the MANUAL_FINALIZATION option to qt_add_plugin and run qt_finalize_target like we do for qt_add_executable and qt_add_library. Currently, the only user-visible effect is that resource files are put into a FOLDER and not underneath a XXX_other_files target. Change-Id: I430d87b5357f6d2ed7fe32198a73eb919f393dd8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
de80185575
commit
67de96852d
@ -1984,6 +1984,7 @@ endmacro()
|
||||
|
||||
function(qt6_add_plugin target)
|
||||
_qt_internal_get_add_plugin_keywords(opt_args single_args multi_args)
|
||||
list(APPEND opt_args MANUAL_FINALIZATION)
|
||||
|
||||
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
|
||||
|
||||
@ -2030,6 +2031,7 @@ function(qt6_add_plugin target)
|
||||
endif()
|
||||
|
||||
_qt_internal_add_library(${target} ${type_to_create} ${arg_UNPARSED_ARGUMENTS})
|
||||
set_property(TARGET ${target} PROPERTY _qt_expects_finalization TRUE)
|
||||
|
||||
get_target_property(target_type "${target}" TYPE)
|
||||
if (target_type STREQUAL "STATIC_LIBRARY")
|
||||
@ -2107,6 +2109,23 @@ function(qt6_add_plugin target)
|
||||
endif()
|
||||
add_dependencies(qt_internal_plugins ${target})
|
||||
endif()
|
||||
|
||||
if(arg_MANUAL_FINALIZATION)
|
||||
# Caller says they will call qt6_finalize_target() themselves later
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Defer the finalization if we can. When the caller's project requires
|
||||
# CMake 3.19 or later, this makes the calls to this function concise while
|
||||
# still allowing target property modification before finalization.
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19)
|
||||
# Need to wrap in an EVAL CODE or else ${target} won't be evaluated
|
||||
# due to special behavior of cmake_language() argument handling
|
||||
cmake_language(EVAL CODE "cmake_language(DEFER CALL qt6_finalize_target ${target})")
|
||||
else()
|
||||
set_target_properties("${target}" PROPERTIES _qt_is_immediately_finalized TRUE)
|
||||
qt6_finalize_target("${target}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||
|
@ -51,6 +51,7 @@ library created. The \c{qt_add_library()} command does not consider
|
||||
Any \c{sources} provided will be passed through to the internal call to
|
||||
\c{add_library()}.
|
||||
|
||||
\target qt_add_library finalization
|
||||
\section2 Finalization
|
||||
|
||||
After a target is created, further processing or \e{finalization} steps may be
|
||||
|
@ -21,6 +21,7 @@ qt_add_plugin(target
|
||||
[SHARED | STATIC]
|
||||
[CLASS_NAME class_name]
|
||||
[OUTPUT_TARGETS variable_name]
|
||||
[MANUAL_FINALIZATION]
|
||||
sources...
|
||||
)
|
||||
\endcode
|
||||
@ -67,4 +68,17 @@ project should also install these internal targets. The names of these targets
|
||||
can be obtained by providing the \c OUTPUT_TARGETS option, followed by the name
|
||||
of a variable in which to return the target list.
|
||||
|
||||
\section2 Finalization
|
||||
|
||||
After a target is created, further processing or \e{finalization} steps may be
|
||||
needed. The finalization processing is implemented by the
|
||||
\l{qt6_finalize_target}{qt_finalize_target()} command.
|
||||
|
||||
For details and the meaning of the \c{MANUAL_FINALIZATION} option, refer to the
|
||||
\l{qt_add_library finalization}{finalization documentation} for
|
||||
\c{qt_add_library}.
|
||||
|
||||
\sa {qt6_finalize_target}{qt_finalize_target()},
|
||||
{qt6_add_executable}{qt_add_executable()}
|
||||
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user