CMake: Fix location of iOS framework prl files

iOS prl files for static frameworks were previously placed at a path
like
  6.8.3/ios/lib/QtCore.framework/Versions/A/Resources/QtCore.prl

This caused qmake to silently fail to find iOS framework prl files.
The failure could only be seen when calling qmake with -d -d:

  DEBUG 2: QMakeMetaInfo: Cannot find info file for
    6.8.3/ios/lib/QtCore.framework/Resources/QtCore.prl

This in turn can lead to various build failures if a different non-iOS
prl file is found in a system path.

Place the prl file into the root of each framework, e.g. at
  6.8.3/ios/lib/QtCore.framework/QtCore.prl

We didn't have this issue in 6.7 and earlier, because by default iOS
was built with static libraries rather than static frameworks.

Amends 291817b0bf

Fixes: QTBUG-137297
Change-Id: Idff8e808e9bfc009f82d2a59e5e6752ed8a55714
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 89e7facc2e3095684e64f16103cfce017235e504)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit d12cdac9bd2e7694da598f20ebf566a439f1aaaa)
(cherry picked from commit adeb6090a0eb0cc5568d64a362382b138aba3383)
This commit is contained in:
Alexandru Croitor
2025-06-05 08:22:30 +00:00
committed by Qt Cherry-pick Bot
parent 677e58d5d6
commit 85dc76a6c1
+10 -2
View File
@@ -65,9 +65,17 @@ function(qt_generate_prl_file target install_dir)
set(prefix_for_final_prl_name "$<TARGET_FILE_PREFIX:${target}>")
endif()
# For frameworks, the prl file should be placed under the Resources subdir.
# For macOS frameworks, the prl file should be placed under the Resources subdir.
# For iOS, visionOS, watchOS, tvOS, there is no Resources subdir, and the contents needs to
# be placed directly in the framework root, as described at
# https://developer.apple.com/documentation/bundleresources/placing-content-in-a-bundle?language=objc
get_target_property(is_framework ${target} FRAMEWORK)
if(is_framework)
if(APPLE AND (NOT CMAKE_SYSTEM_NAME OR CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
set(is_macos TRUE)
else()
set(is_macos FALSE)
endif()
if(is_framework AND is_macos)
get_target_property(fw_version ${target} FRAMEWORK_VERSION)
string(APPEND prefix_for_final_prl_name "Versions/${fw_version}/Resources/")
endif()