CMake: Use correct framework link flags in scripts and .pri files

target_link_libraries expects a quoted string like
"-framework CoreFoundation" when linking frameworks and not 2
different arguments like "-framework" "CoreFoundation".

Fix that in the FindWrapOpenGL and FindGLESv2 find modules.

Make sure to not quote the framework link flags when generating
.pri files even if there are spaces, otherwise building apps
with qmake fails.

Amends 7fcc9cf05500fd3a0a1ba5c2f90a8ad3bcd8e5b0
Amends 2ed63e587eefb246dba9e69aa01fdb2abb2def13
Amends 55a15a1c1b93d36d705fc69e44b5c806b807dd55
Amends 2a767ab4bb7de8c29d2a8365212244ed944e9aeb

Task-number: QTBUG-85240
Change-Id: I66ba36760ad704d65e712072a528d9e25c336dfa
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-06-30 13:56:54 +02:00
parent 1685b0540d
commit 868c7016e0
3 changed files with 4 additions and 5 deletions

View File

@ -60,8 +60,7 @@ if(GLESv2_FOUND AND NOT TARGET GLESv2::GLESv2)
# For simulator_and_device builds we can't specify the full library path, because
# it's specific to either the device or the simulator. Resort to passing a link
# flag instead.
set_target_properties(GLESv2::GLESv2 PROPERTIES
INTERFACE_LINK_LIBRARIES "-framework OpenGLES")
target_link_libraries(GLESv2::GLESv2 INTERFACE "-framework OpenGLES")
endif()
else()
add_library(GLESv2::GLESv2 UNKNOWN IMPORTED)

View File

@ -27,7 +27,7 @@ if (OpenGL_FOUND)
if(NOT __opengl_fw_path)
# Just a safety measure in case if no OpenGL::GL target exists.
set(__opengl_fw_path "-framework" "OpenGL")
set(__opengl_fw_path "-framework OpenGL")
endif()
find_library(WrapOpenGL_AGL NAMES AGL)
@ -35,7 +35,7 @@ if (OpenGL_FOUND)
set(__opengl_agl_fw_path "${WrapOpenGL_AGL}")
endif()
if(NOT __opengl_agl_fw_path)
set(__opengl_agl_fw_path "-framework" "AGL")
set(__opengl_agl_fw_path "-framework AGL")
endif()
target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE ${__opengl_fw_path})

View File

@ -23,7 +23,7 @@ function(qmake_list out_var)
# Surround values that contain spaces with double quotes.
foreach(v ${ARGN})
if(v MATCHES " ")
if(v MATCHES " " AND NOT MATCHES "^-framework")
set(v "\"${v}\"")
endif()
list(APPEND result ${v})