diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4e78e6d50a..d372e490c7f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -164,6 +164,11 @@ IF (WIN32)
ELSE (WIN32)
+ IF (APPLE)
+ # for Mac OS X, everything is put inside an application bundle
+ SET (CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/qgis.app/Contents/MacOS)
+ ENDIF (APPLE)
+
# common for MAC and UNIX
SET (QGIS_BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin)
SET (QGIS_DATA_DIR ${CMAKE_INSTALL_PREFIX}/share/qgis)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 81230a68516..ef94cebd220 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,2 +1,6 @@
SUBDIRS(core ui gui app providers plugins helpviewer)
+
+IF (APPLE)
+ SUBDIRS(mac)
+ENDIF(APPLE)
diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt
index f09108d8626..cf2f099d986 100644
--- a/src/app/CMakeLists.txt
+++ b/src/app/CMakeLists.txt
@@ -218,4 +218,9 @@ IF (POSTGRES_FOUND)
TARGET_LINK_LIBRARIES (qgis ${POSTGRES_LIBRARY})
ENDIF (POSTGRES_FOUND)
-INSTALL(TARGETS qgis RUNTIME DESTINATION ${QGIS_BIN_DIR})
+IF (APPLE)
+ # For Mac OS X, the executable must be at the root of the bundle's executable folder
+ INSTALL(TARGETS qgis RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
+ELSE (APPLE)
+ INSTALL(TARGETS qgis RUNTIME DESTINATION ${QGIS_BIN_DIR})
+ENDIF (APPLE)
diff --git a/src/helpviewer/CMakeLists.txt b/src/helpviewer/CMakeLists.txt
index dbec669437d..083f2b9d246 100644
--- a/src/helpviewer/CMakeLists.txt
+++ b/src/helpviewer/CMakeLists.txt
@@ -27,7 +27,7 @@ QT4_WRAP_CPP (HELP_MOC_SRCS ${HELP_MOC_HDRS})
#QT4_ADD_RESOURCES(HELP_RCC_SRCS ${HELP_RCCS})
-ADD_EXECUTABLE (qgis_help ${HELP_SRCS} ${HELP_MOC_SRCS} ${HELP_UIS_H})
+ADD_EXECUTABLE (qgis_help MACOSX_BUNDLE ${HELP_SRCS} ${HELP_MOC_SRCS} ${HELP_UIS_H})
INCLUDE_DIRECTORIES(.
${CMAKE_CURRENT_BINARY_DIR}
diff --git a/src/mac/CMakeLists.txt b/src/mac/CMakeLists.txt
new file mode 100644
index 00000000000..0fab7ca2ee1
--- /dev/null
+++ b/src/mac/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+SUBDIRS(Contents)
diff --git a/src/mac/Contents/CMakeLists.txt b/src/mac/Contents/CMakeLists.txt
new file mode 100644
index 00000000000..fb9797d58d3
--- /dev/null
+++ b/src/mac/Contents/CMakeLists.txt
@@ -0,0 +1,32 @@
+
+#############################################################
+# create Info.plist
+
+EXECUTE_PROCESS(COMMAND grep VERSION ${CMAKE_SOURCE_DIR}/qgsconfig.h
+ OUTPUT_VARIABLE VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+STRING(REGEX REPLACE "#define VERSION \"(.*)\"" "\\1" VERSION ${VERSION})
+
+EXECUTE_PROCESS(COMMAND grep SVNVERSION ${CMAKE_SOURCE_DIR}/qgssvnversion.h
+ OUTPUT_VARIABLE SVNVERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+STRING(REGEX REPLACE "#define QGSSVNVERSION \"(.*)\"" "\\1" SVNVERSION ${SVNVERSION})
+
+SET(SHORTVERSION ${VERSION})
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
+ ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
+
+#############################################################
+# process subdirs
+
+SUBDIRS(Resources)
+
+#############################################################
+# install
+
+INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/..)
+
+# Update bundle modification date so Finder scans latest plist
+INSTALL (CODE "EXECUTE_PROCESS(COMMAND touch ${CMAKE_INSTALL_PREFIX}/../../.)")
diff --git a/src/mac/Contents/Info.plist.in b/src/mac/Contents/Info.plist.in
index efdc560b7dc..1d7839ceb18 100644
--- a/src/mac/Contents/Info.plist.in
+++ b/src/mac/Contents/Info.plist.in
@@ -11,11 +11,11 @@
CFBundleSignature
QGIS
CFBundleGetInfoString
- QGIS @VERSION (@SVNVERSION), © 2002-2006 QGIS Development Team
+ QGIS ${VERSION} (${SVNVERSION}), © 2002-2007 QGIS Development Team
CFBundleShortVersionString
- @SHORTVERSION (@SVNVERSION)
+ ${SHORTVERSION} (${SVNVERSION})
CFBundleVersion
- @VERSION
+ ${VERSION}
CFBundleIconFile
qgis.icns
CFBundleDocumentTypes
diff --git a/src/mac/Contents/Resources/CMakeLists.txt b/src/mac/Contents/Resources/CMakeLists.txt
new file mode 100644
index 00000000000..a59ad76d7b8
--- /dev/null
+++ b/src/mac/Contents/Resources/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+FILE (GLOB ICONS *.icns)
+INSTALL (FILES ${ICONS}
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/../Resources)
diff --git a/tools/mapserver_export/CMakeLists.txt b/tools/mapserver_export/CMakeLists.txt
index 5481d1412ad..e6cea361eda 100644
--- a/tools/mapserver_export/CMakeLists.txt
+++ b/tools/mapserver_export/CMakeLists.txt
@@ -25,7 +25,7 @@ INCLUDE_DIRECTORIES (
${PYTHON_INCLUDE_PATH}
)
-ADD_EXECUTABLE (msexport ${MSEXPORT_SRCS} ${MSEXPORT_MOC_SRCS})
+ADD_EXECUTABLE (msexport MACOSX_BUNDLE ${MSEXPORT_SRCS} ${MSEXPORT_MOC_SRCS})
TARGET_LINK_LIBRARIES (msexport
${QT_LIBRARIES}