CMake: Fix framework handling for .pri files

Rather than embedding the full absolute path to the framework, we
should instead write a -framework Foo flag.

qmake seems to do this by specifying QMAKE_LIBS_FOO in the mkspec.
We'll try to get away with just deriving the name of the framework
from the path, to avoid having to introduce a mkspec equivalent
mapping for CMake.

This doesn't currently handle framework include paths, which qmake
also handled by harcoding QMAKE_INCDIR_FOO in the mkspec, and then
sysrootifying it via mkspecs/common/mac/sdk.prf.
Hopefully that's not really needed, given that -framework flag
should imply include paths as well.

Somewhat partially amends c254254c55b24dd0653331e025cdfdbbdcca2a56

Task-number: QTBUG-85240
Task-number: QTBUG-84781
Change-Id: I70ea5021422d7b1f5afa9c4a595d1a9b8a8217d3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-06-25 16:43:39 +02:00
parent 167741717f
commit 3ef14c8943

View File

@ -655,9 +655,13 @@ function(qt_generate_qmake_libraries_pri_content module_name output_root_dir out
list(APPEND lib_libdir "$<TARGET_PROPERTY:${lib_target},INTERFACE_LINK_DIRECTORIES>")
list(APPEND lib_incdir "$<TARGET_PROPERTY:${lib_target},INTERFACE_INCLUDE_DIRECTORIES>")
list(APPEND lib_defines "$<TARGET_PROPERTY:${lib_target},INTERFACE_COMPILE_DEFINITIONS>")
else()
if(lib_target MATCHES "/([^/]+).framework$")
list(APPEND lib_libs "-framework" "${CMAKE_MATCH_1}")
else()
list(APPEND lib_libs "${lib_target}")
endif()
endif()
endwhile()
# Wrap in $<REMOVE_DUPLICATES:...> but not the libs, because