CMake: Fix calling some functions in CMake 3.16

Calling qt_internal_get_framework_info failed when the target was
an INTERFACE_LIBRARY, because it tried to access properties that
aren't allowed on such a target. Interface libraries can't be
frameworks, so just add an early return guard.

Do the same for qt_internal_apply_apple_privacy_manifest.

Change-Id: I85b73449a0d56b92cd01b032d4ce5db905643c9f
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2024-03-07 18:02:56 +01:00
parent a1445670f5
commit 84a9f934b2
2 changed files with 12 additions and 0 deletions

View File

@ -195,6 +195,12 @@ endfunction()
# version, framework bundle version and tailing module name, e.g.
# 'QtCore.framework/Versions/A/Headers/6.0.0/Core'
function(qt_internal_get_framework_info out_var target)
# Avoid "INTERFACE_LIBRARY targets may only have whitelisted properties" error on CMake < 3.17.
get_target_property(target_type ${target} TYPE)
if("${target_type}" STREQUAL "INTERFACE_LIBRARY")
return()
endif()
get_target_property(${out_var}_version ${target} FRAMEWORK_VERSION)
get_target_property(${out_var}_bundle_version ${target} MACOSX_FRAMEWORK_BUNDLE_VERSION)

View File

@ -915,6 +915,12 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
endfunction()
function(qt_internal_apply_apple_privacy_manifest target)
# Avoid "INTERFACE_LIBRARY targets may only have whitelisted properties" error on CMake < 3.17.
get_target_property(target_type ${target} TYPE)
if("${target_type}" STREQUAL "INTERFACE_LIBRARY")
return()
endif()
if(APPLE)
# Privacy manifest
get_target_property(is_framework ${target} FRAMEWORK)