summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-07-01 12:42:31 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2022-07-05 12:24:51 +0300
commit282ce3e3cc21189e9e916ced7a0e3c10d10413fe (patch)
treed86658acd76aa7485797cf9b78efd837c8e675b1
parent427d2c096679f940799eeea5b34e2b4f5ae5c896 (diff)
CMake: Fix qml plugin prl files not to have hardcoded paths
The previous fix 754512a64dffa20165e5b08b77e34b82c072f7f8 did not handle qml plugins, which meant that they would still have hardcoded paths and see warnings like the one below when generating the prl files CMake Warning (dev) at cmake/QtFinishPrlFile.cmake:103 (message): Could not determine relative path for library qml/QtQml/WorkerScript/libworkerscriptplugin_debug.a when generating prl file contents. An absolute path will be embedded, which will cause issues if the Qt installation is relocated. Handle qml plugins as well. Amends 754512a64dffa20165e5b08b77e34b82c072f7f8 Amends f4e998125981038e5e50dab8cc56039faaa0b750 Fixes: QTBUG-104708 Task-number: QTBUG-104396 Change-Id: Icfb1069d1cb0a39a35004b20e58ee6e386d14f3b Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 9ea2f7f4b1192f3429aa2d3e278097008bc773bb) Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--cmake/QtFinishPrlFile.cmake6
-rw-r--r--cmake/QtPrlHelpers.cmake7
2 files changed, 13 insertions, 0 deletions
diff --git a/cmake/QtFinishPrlFile.cmake b/cmake/QtFinishPrlFile.cmake
index 9c93bd49a1..32169e418c 100644
--- a/cmake/QtFinishPrlFile.cmake
+++ b/cmake/QtFinishPrlFile.cmake
@@ -96,6 +96,10 @@ foreach(line ${lines})
"${target_library_path}" "${QT_PLUGIN_DIRS}" lib_is_a_qt_plugin relative_lib)
endif()
if(NOT lib_is_a_qt_module AND NOT lib_is_a_qt_plugin)
+ qt_internal_path_is_relative_to_qt_lib_path(
+ "${target_library_path}" "${QT_QML_DIRS}" lib_is_a_qt_qml_plugin relative_lib)
+ endif()
+ if(NOT lib_is_a_qt_module AND NOT lib_is_a_qt_plugin AND NOT lib_is_a_qt_qml_plugin)
message(AUTHOR_WARNING
"Could not determine relative path for library ${target_library_path} when "
"generating prl file contents. An absolute path will be embedded, which "
@@ -107,6 +111,8 @@ foreach(line ${lines})
set(qmake_lib_path_prefix "$$[QT_INSTALL_LIBS]")
elseif(lib_is_a_qt_plugin)
set(qmake_lib_path_prefix "$$[QT_INSTALL_PLUGINS]")
+ elseif(lib_is_a_qt_qml_plugin)
+ set(qmake_lib_path_prefix "$$[QT_INSTALL_QML]")
endif()
qt_strip_library_version_suffix(relative_lib "${relative_lib}")
list(APPEND libs_to_prepend "${qmake_lib_path_prefix}/${relative_lib}")
diff --git a/cmake/QtPrlHelpers.cmake b/cmake/QtPrlHelpers.cmake
index 52f7854f16..298bc44c9b 100644
--- a/cmake/QtPrlHelpers.cmake
+++ b/cmake/QtPrlHelpers.cmake
@@ -145,6 +145,12 @@ ${prl_step1_content_libs}
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_PLUGINSDIR}")
endif()
+ set(qt_qml_dirs "${QT_BUILD_DIR}/${INSTALL_QMLDIR}")
+ if(QT_WILL_INSTALL)
+ list(APPEND qt_qml_dirs
+ "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_QMLDIR}")
+ endif()
+
foreach(config ${configs})
# Output file for dependency tracking, and which will contain the final content.
qt_path_join(prl_step2_path
@@ -180,6 +186,7 @@ ${prl_step1_content_libs}
"-DLINK_LIBRARY_FLAG=${link_library_flag}"
"-DQT_LIB_DIRS=${qt_lib_dirs}"
"-DQT_PLUGIN_DIRS=${qt_plugin_dirs}"
+ "-DQT_QML_DIRS=${qt_qml_dirs}"
"-DIMPLICIT_LINK_DIRECTORIES=${implicit_link_directories}"
-P "${QT_CMAKE_DIR}/QtFinishPrlFile.cmake"
VERBATIM