summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/Qt6CoreMacros.cmake35
-rw-r--r--src/corelib/doc/snippets/cmake-macros/examples.cmake2
-rw-r--r--src/corelib/doc/src/cmake-macros.qdoc22
-rw-r--r--tests/auto/cmake/test_import_plugins/CMakeLists.txt2
4 files changed, 35 insertions, 26 deletions
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index d05688c596..73a2db1b25 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -475,7 +475,7 @@ function(qt6_add_executable target)
_qt_internal_create_executable("${target}" ${arg_UNPARSED_ARGUMENTS})
if(arg_MANUAL_FINALIZATION)
- # Caller says they will call qt6_finalize_executable() themselves later
+ # Caller says they will call qt6_finalize_target() themselves later
return()
endif()
@@ -485,10 +485,10 @@ function(qt6_add_executable target)
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_executable ${target})")
+ 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_executable("${target}")
+ qt6_finalize_target("${target}")
endif()
endfunction()
@@ -512,13 +512,11 @@ function(_qt_internal_create_executable target)
target_link_libraries("${target}" PRIVATE Qt6::Core)
endfunction()
-# This function is currently in Technical Preview.
-# It's signature and behavior might change.
-function(qt6_finalize_executable target)
+function(_qt_internal_finalize_executable target)
get_target_property(is_finalized "${target}" _qt_executable_is_finalized)
if(is_finalized)
message(AUTHOR_WARNING
- "Tried to call qt6_finalize_executable twice on executable: '${target}'. \
+ "Tried to call qt6_finalize_target twice on executable: '${target}'. \
Did you forget to specify MANUAL_FINALIZATION to qt6_add_executable?")
return()
endif()
@@ -589,6 +587,17 @@ function(qt6_finalize_executable target)
set_target_properties(${target} PROPERTIES _qt_executable_is_finalized TRUE)
endfunction()
+function(qt6_finalize_target target)
+ if(NOT TARGET "${target}")
+ message(FATAL_ERROR "No target '${target}' found in current scope.")
+ endif()
+
+ get_target_property(target_type ${target} TYPE)
+ if(target_type STREQUAL "EXECUTABLE")
+ _qt_internal_finalize_executable(${ARGV})
+ endif()
+endfunction()
+
function(_qt_internal_find_ios_development_team_id out_var)
get_property(team_id GLOBAL PROPERTY _qt_internal_ios_development_team_id)
get_property(team_id_computed GLOBAL PROPERTY _qt_internal_ios_development_team_id_computed)
@@ -728,8 +737,8 @@ if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
function(qt_add_executable)
qt6_add_executable(${ARGV})
endfunction()
- function(qt_finalize_executable)
- qt6_finalize_executable(${ARGV})
+ function(qt_finalize_target)
+ qt6_finalize_target(${ARGV})
endfunction()
endif()
@@ -847,10 +856,10 @@ function(qt6_import_plugins target)
# If the project called qt_import_plugins, use this as an event to enable finalizer mode for
# plugin importing.
#
- # This is done in addition to the code in qt_finalize_executable, to ensure pre-existing
+ # This is done in addition to the code in qt_finalize_target, to ensure pre-existing
# projects that use qt_import_plugins activate finalizer mode even with an older CMake version
# that doesn't support deferred calls (and projects that don't explicitly call
- # qt_finalize_executable).
+ # qt_finalize_target).
__qt_internal_apply_plugin_imports_finalizer_mode(${target})
endfunction()
@@ -877,9 +886,9 @@ endif()
#
# Finalizer mode is enabled by default if:
# - the project calls qt_import_plugins explicitly or
-# - the project calls qt_finalize_executable explicitly or
+# - the project calls qt_finalize_target explicitly or
# - the project uses qt_add_executable and a CMake version greater than or equal to 3.19
-# (which will DEFER CALL qt_finalize_executable)
+# (which will DEFER CALL qt_finalize_target)
function(qt6_enable_import_plugins_finalizer_mode target enabled)
if(enabled)
set(enabled "TRUE")
diff --git a/src/corelib/doc/snippets/cmake-macros/examples.cmake b/src/corelib/doc/snippets/cmake-macros/examples.cmake
index c02f5c783d..56d667914d 100644
--- a/src/corelib/doc/snippets/cmake-macros/examples.cmake
+++ b/src/corelib/doc/snippets/cmake-macros/examples.cmake
@@ -88,7 +88,7 @@ qt_add_executable(simpleapp main.cpp)
#! [qt_add_executable_deferred]
qt_add_executable(complexapp MANUAL_FINALIZATION complex.cpp)
set_target_properties(complexapp PROPERTIES OUTPUT_NAME Complexify)
-qt_finalize_executable(complexapp)
+qt_finalize_target(complexapp)
#! [qt_add_executable_deferred]
#! [qt_android_deploy_basic]
diff --git a/src/corelib/doc/src/cmake-macros.qdoc b/src/corelib/doc/src/cmake-macros.qdoc
index 833aeaff86..9b486712f7 100644
--- a/src/corelib/doc/src/cmake-macros.qdoc
+++ b/src/corelib/doc/src/cmake-macros.qdoc
@@ -421,7 +421,7 @@ for you as a convenience.
After a target is created, further processing or \e{finalization} steps are
commonly needed. The steps to perform depend on the platform and on various
properties of the target. The finalization processing is implemented by the
-\l{qt6_finalize_executable}{qt_finalize_executable()} command.
+\l{qt6_finalize_target}{qt_finalize_target()} command.
Finalization can occur either as part of this call or be deferred to sometime
after this command returns (but it should still be in the same directory scope).
@@ -432,11 +432,11 @@ CMake versions earlier than 3.19, automatic deferral isn't supported. In that
case, finalization is performed immediately before this command returns.
Regardless of the CMake version, the \c{MANUAL_FINALIZATION} keyword can be given to
-indicate that you will explicitly call \l{qt6_finalize_executable}{qt_finalize_executable()}
+indicate that you will explicitly call \l{qt6_finalize_target}{qt_finalize_target()}
yourself instead at some later time. In general, \c MANUAL_FINALIZATION should
not be needed unless the project has to support CMake 3.18 or earlier.
-\sa {qt6_finalize_executable}{qt_finalize_executable()}
+\sa {qt6_finalize_target}{qt_finalize_target()}
\section1 Examples
@@ -457,11 +457,11 @@ for finalizing the target by adding the \c{MANUAL_FINALIZATION} keyword.
*/
/*!
-\page qt_finalize_executable.html
+\page qt_finalize_target.html
\ingroup cmake-macros-qtcore
-\title qt_finalize_executable
-\target qt6_finalize_executable
+\title qt_finalize_target
+\target qt6_finalize_target
\brief Handles various common platform-specific tasks associated with Qt targets.
@@ -470,9 +470,9 @@ for finalizing the target by adding the \c{MANUAL_FINALIZATION} keyword.
\section1 Synopsis
\badcode
-qt_finalize_executable(target)
+qt_finalize_target(target)
-qt6_finalize_executable(target)
+qt6_finalize_target(target)
\endcode
\section1 Description
@@ -573,7 +573,7 @@ Some are provided by Qt, others by CMake or the Android NDK.
The properties below will be read from the specified \c{target}. Note that this
command is called as part of target finalization (see
-\l{qt6_finalize_executable}{qt_finalize_executable()}). If you are using
+\l{qt6_finalize_target}{qt_finalize_target()}). If you are using
\l{qt6_add_executable}{qt_add_executable()} to create the target and you need to
modify some of these target properties, you need to ensure that target
finalization is deferred. See \l{qt6_add_executable}{qt_add_executable()} for
@@ -597,7 +597,7 @@ Upon return, the \c{QT_ANDROID_DEPLOYMENT_SETTINGS_FILE} target property will
contain the location of the generated deployment settings file.
\sa {qt6_android_add_apk_target}{qt_android_add_apk_target()},
- {qt6_finalize_executable}{qt_finalize_executable()}
+ {qt6_finalize_target}{qt_finalize_target()}
\section1 Example
@@ -639,7 +639,7 @@ the \c{apk} build target, which will be created if it doesn't already exist.
This can be disabled by setting the \c{QT_NO_GLOBAL_APK_TARGET} variable to true.
\sa {qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()},
- {qt6_finalize_executable}{qt_finalize_executable()}
+ {qt6_finalize_target}{qt_finalize_target()}
\section1 Example
diff --git a/tests/auto/cmake/test_import_plugins/CMakeLists.txt b/tests/auto/cmake/test_import_plugins/CMakeLists.txt
index bc3580760f..bdb6261762 100644
--- a/tests/auto/cmake/test_import_plugins/CMakeLists.txt
+++ b/tests/auto/cmake/test_import_plugins/CMakeLists.txt
@@ -153,7 +153,7 @@ create_test_executable(default_qt_add_executable_manually_finalized
FINALIZER_MODE QT_WRAPPER
ADD_EXECUTABLE_ARGS MANUAL_FINALIZATION)
-qt_finalize_executable(${target})
+qt_finalize_target(${target})
# Check that plugin importing with automatic finalization works when the CMake version is high
# enough.