summaryrefslogtreecommitdiffstats
path: root/src/corelib/Qt6CoreMacros.cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-08-17 16:25:03 +0200
committerAlexey Edelev <alexey.edelev@qt.io>2021-09-09 21:49:37 +0200
commitd20f4ae706559fb7de8db9dd4845f7ce3936061a (patch)
treecd2729521d7aaf72be595de5be0be35f2473b7a5 /src/corelib/Qt6CoreMacros.cmake
parent2b8a6d026d2a9fed48847d9759a1b07ec34418a1 (diff)
Support deploying of libraries from a build tree when building android apk
If the project consists of an executable and multiple libraries that are linked to the executable, currently you need to specify them manually using QT_ANDROID_EXTRA_LIBS target property. This automates deploying of the libraries that are a part of the project build tree. _qt_internal_collect_target_apk_dependencies collects all the known non-imported shared libraries from the project build tree. When running androiddeployqt we specify extra library directories that point to the collected library locations in build tree, to help androiddeployqt resolve shared libraries that are build as a part of the project. The described procedure is running automatically if CMake version is greater than or equal to 3.18 is. For the CMake versions less than 3.18 users need to call a new public qt_finalize_project function at the end of project's top-level CMakeLists.txt Task-number: QTBUG-94714 Change-Id: I400ca4e49e940cfc25ae90d65372e79825bee55a Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/corelib/Qt6CoreMacros.cmake')
-rw-r--r--src/corelib/Qt6CoreMacros.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index acfd196417..d5cffee105 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -2238,7 +2238,28 @@ function(qt6_disable_unicode_defines target)
set_target_properties(${target} PROPERTIES QT_NO_UNICODE_DEFINES TRUE)
endfunction()
+# Finalizer function for the top-level user projects.
+#
+# This function is currently in Technical Preview.
+# Its signature and behavior might change.
+function(qt6_finalize_project)
+ if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
+ message("qt6_finalize_project is called not in the top-level CMakeLists.txt.")
+ endif()
+ if(ANDROID)
+ _qt_internal_collect_target_apk_dependencies()
+ endif()
+endfunction()
+
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
+ function(qt_finalize_project)
+ if(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
+ qt6_finalize_project()
+ else()
+ message(FATAL_ERROR "qt_finalize_project() is only available in Qt 6.")
+ endif()
+ endfunction()
+
function(qt_disable_unicode_defines)
qt6_disable_unicode_defines(${ARGV})
endfunction()