cmake build/macOS: Fix installing when built with Qt6

In a framework the actual library can be accessed via two different
paths:

- Foo.framework/Foo
- Foo.framework/Versions/A/Foo

It happens that Qt5 exports the first variant for the framework LOCATION
and Qt6 exports the second variant.
We want to cut the whole "Foo.framework" part for the framework's location,
so actually do that.

Amends 98db9774f2

Change-Id: Idad12e92f2bfbdc480256a832320c4dec76a0e5f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2020-11-18 10:55:21 +01:00
parent f88deb5b70
commit 2422a90f1e

View File

@@ -687,7 +687,8 @@ function(add_qtc_executable name)
get_target_property(_location ${_lib} LOCATION)
get_target_property(_is_framework ${_lib} FRAMEWORK)
if (_is_framework)
set(_location ${_location}/../..)
# get rid of the whole Foo.framework/* part whereever it is
string(REGEX REPLACE "/[^/]*[.]framework/.*" "" _location ${_location})
endif()
get_filename_component(_abs_location ${_location} ABSOLUTE)
list(APPEND _rpaths_to_remove "${_abs_location}")