summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2023-09-11 14:48:32 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-09-12 22:59:28 +0000
commitb055169f76acb509a4e3ce5c90ae2b18b8e8f2f5 (patch)
tree6c2506caf3fd38b17db180372a9368b45edc8c0c
parenta746d3011195a34f5bfe977a799706991be9baa5 (diff)
CMake: Fix build with CMake 3.28 on macOS
FindWrapOpenGL.cmake assumed that IMPORTED_LOCATION is the absolute path of the library within the framework. That's not the case with CMake 3.28 anymore. There, IMPORTED_LOCATION is the absolute path of the framework directory. The relevant upstream CMake change is 6b01a27f901b5eb392955fea322cde44a1b782a3. Pick-to: 6.2 Change-Id: I6b702a28318e0978c56dec83c398965aa77ef020 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 0efea8020c1d221635aaa0a71529edb392cfe3cc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 9dbb4a8f8113310e209aaba334fbfdfd688e703c)
-rw-r--r--cmake/FindWrapOpenGL.cmake8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmake/FindWrapOpenGL.cmake b/cmake/FindWrapOpenGL.cmake
index c4e0fe5d3e..48bc8fe22d 100644
--- a/cmake/FindWrapOpenGL.cmake
+++ b/cmake/FindWrapOpenGL.cmake
@@ -17,14 +17,18 @@ if (OpenGL_FOUND)
add_library(WrapOpenGL::WrapOpenGL INTERFACE IMPORTED)
if(APPLE)
+ # CMake 3.27 and older:
# On Darwin platforms FindOpenGL sets IMPORTED_LOCATION to the absolute path of the library
# within the framework. This ends up as an absolute path link flag, which we don't want,
# because that makes our .prl files un-relocatable.
# Extract the framework path instead, and use that in INTERFACE_LINK_LIBRARIES,
- # which CMake ends up transforming into a reloctable -framework flag.
+ # which CMake ends up transforming into a relocatable -framework flag.
# See https://gitlab.kitware.com/cmake/cmake/-/issues/20871 for details.
+ #
+ # CMake 3.28 and above:
+ # IMPORTED_LOCATION is the absolute path the the OpenGL.framework folder.
get_target_property(__opengl_fw_lib_path OpenGL::GL IMPORTED_LOCATION)
- if(__opengl_fw_lib_path)
+ if(__opengl_fw_lib_path AND NOT __opengl_fw_lib_path MATCHES "/([^/]+)\\.framework$")
get_filename_component(__opengl_fw_path "${__opengl_fw_lib_path}" DIRECTORY)
endif()