summaryrefslogtreecommitdiff
path: root/Modules/Qt4ConfigDependentSettings.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2010-03-08 12:38:15 -0500
committerBill Hoffman <bill.hoffman@kitware.com>2010-03-10 13:51:17 -0500
commitb461a687865197384b6986eb21c425a76c35a1d0 (patch)
treefdaab39b7fd26be2b7d0113b3c2f1bb76177e282 /Modules/Qt4ConfigDependentSettings.cmake
parenta61c5ab6e59a458ad34383e64d0679a7fe898c61 (diff)
downloadcmake-b461a687865197384b6986eb21c425a76c35a1d0.tar.gz
Fix Qt with OpenGL on the Mac.
Diffstat (limited to 'Modules/Qt4ConfigDependentSettings.cmake')
-rw-r--r--Modules/Qt4ConfigDependentSettings.cmake16
1 files changed, 15 insertions, 1 deletions
diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake
index 1331f4191f..1c5293d1a6 100644
--- a/Modules/Qt4ConfigDependentSettings.cmake
+++ b/Modules/Qt4ConfigDependentSettings.cmake
@@ -63,7 +63,21 @@ ENDIF(WIN32 AND NOT QT_IS_STATIC)
# 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})