CMake 2.8.1-rc5

Fix Qt with OpenGL on the Mac.
Add .git .bzr and .hg to the list of default CPack ignore directories.
Bump RC number
Update ChangeLog.manual
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1eb558b..93d6c43 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -329,7 +329,7 @@
 SET(CMake_VERSION_MAJOR 2)
 SET(CMake_VERSION_MINOR 8)
 SET(CMake_VERSION_PATCH 1)
-SET(CMake_VERSION_RC 4)
+SET(CMake_VERSION_RC 5)
 
 # We use odd minor numbers for development versions.
 # Use a date for the development patch level.
diff --git a/ChangeLog.manual b/ChangeLog.manual
index 9145d21..147c263 100644
--- a/ChangeLog.manual
+++ b/ChangeLog.manual
@@ -1,3 +1,7 @@
+Changes in CMake 2.8.1 RC 5
+- Fix FindQt4 to work with OpenGL on the mac
+- Add .git .bzr and .hg to the list of default CPack ignore directories.
+
 Changes in CMake 2.8.1 RC 4
 - CTest: Do not hide test GUI windows (fixes 2.8.0 regression)
 - Documentation: Clarify CMAKE_MODULE_PATH variable
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 6e682b4..2991ada 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -926,7 +926,7 @@
 cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME
   "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source")
 cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES
-  "/CVS/;/\\\\\\\\.svn/;\\\\\\\\.swp$;\\\\\\\\.#;/#")
+  "/CVS/;/\\\\\\\\.svn/;/\\\\\\\\.bzr/;/\\\\\\\\.hg/;/\\\\\\\\.git/;\\\\\\\\.swp$;\\\\\\\\.#;/#")
 SET(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}")
 SET(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}")
 SET(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}")
diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake
index 1331f41..1c5293d 100644
--- a/Modules/Qt4ConfigDependentSettings.cmake
+++ b/Modules/Qt4ConfigDependentSettings.cmake
@@ -63,7 +63,21 @@
 
 # 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})