On Friday 05 March 2010, Alexander Neundorf wrote:
...
> QT_QUERY_QMAKE seems to return "-framework OpenGL -framework AGL". Then
> SEPARATE_ARGUMENTS() is called on this string. This turns it into a list:
> -framework;OpenGL;-framework;AGL.
> This is then appended to QT_QTOPENGL_LIB_DEPENDENCIES which is then later
> on used with TARGET_LINK_LIBRARIES(), which keeps the "-framework"
> arguments as they are, but adds a "-l" before the "OpenGL" and "AGL"
> arguments, and so you get a broken link command.
>
> I'll do something so that on Mac with frameworks this is handled correctly.
Attached is a patch which should do this.
It should be enough if you apply this to your installed
Qt4ConfigDependentSettings.cmake file.
Please let me know if that makes it work for you.
Alex
Index: Qt4ConfigDependentSettings.cmake
===================================================================
--- Qt4ConfigDependentSettings.cmake (revision 1099551)
+++ Qt4ConfigDependentSettings.cmake (working copy)
@@ -77,7 +77,18 @@
# QtOpenGL dependencies
QT_QUERY_QMAKE(QMAKE_LIBS_OPENGL "QMAKE_LIBS_OPENGL")
-SEPARATE_ARGUMENTS(QMAKE_LIBS_OPENGL)
+IF(Q_WS_MAC)
+# On the Mac OpenGL is probably frameworks and QMAKE_LIBS_OPENGL can be e.g. "-framework OpenGL -framework AGL".
+# The separate_arguments() call in the other branch makes "-framework;-OpenGL;-framework;-lAGL" appear in the
+# linker command. So we need to protect the "-framework foo" as non-separatable strings.
+# We do this by replacing the space after "-framework" with an underscore, then calling separate_arguments(),
+# and then we replace the underscores again with spaces. So we get proper linker commands. Alex
+ STRING(REGEX REPLACE "-framework +" "-framework_" QMAKE_LIBS_OPENGL "${QMAKE_LIBS_OPENGL}")
+ SEPARATE_ARGUMENTS(QMAKE_LIBS_OPENGL)
+ STRING(REGEX REPLACE "-framework_" "-framework " QMAKE_LIBS_OPENGL "${QMAKE_LIBS_OPENGL}")
+ELSE(Q_WS_MAC)
+ SEPARATE_ARGUMENTS(QMAKE_LIBS_OPENGL)
+ENDIF(Q_WS_MAC)
SET (QT_QTOPENGL_LIB_DEPENDENCIES ${QT_QTOPENGL_LIB_DEPENDENCIES} ${QMAKE_LIBS_OPENGL})
_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem