Index: Portfile
===================================================================
diff --git a/trunk/dports/devel/cmake/Portfile b/trunk/dports/devel/cmake/Portfile
--- a/trunk/dports/devel/cmake/Portfile	(revision 131791)
+++ b/trunk/dports/devel/cmake/Portfile	(working copy)
@@ -5,13 +5,12 @@
 PortGroup           muniversal 1.0
 
 name                cmake
-version             3.0.2
-revision            1
+version             3.1.2
 set branch          [join [lrange [split ${version} .] 0 1] .]
 categories          devel
 license             BSD
 installs_libs       no
-maintainers         css
+maintainers         css michaelld
 description         Cross-platform make
 long_description    An extensible, open-source system that manages the build    \
                     process in an operating system and compiler independent manner. \
@@ -21,8 +20,8 @@
 master_sites        http://www.cmake.org/files/v${branch}/
 platforms           darwin freebsd
 
-checksums           rmd160  b94ea2ed4dced373e289fa5f66674a227135f350 \
-                    sha256  6b4ea61eadbbd9bec0ccb383c29d1f4496eacc121ef7acf37c7a24777805693e
+checksums           rmd160 50caf6ff5de97390decf43446ef0733750a5862c \
+                    sha256 2b210f7d867a1e716c1895357ebe63c7b9ae61fdb5f2d300ab2f01795f085b35
 
 depends_lib-append  port:libidn \
                     port:openssl \
@@ -36,8 +35,12 @@
                     patch-Modules-FindFreetype.cmake.diff \
                     patch-Modules-FindQt4.cmake.diff \
                     patch-Modules-Platform-Darwin.cmake.diff \
+                    patch-Modules-Platform-Darwin-Initialize.cmake.diff \
                     patch-Modules-noArchCheck.diff
 
+# RJVB : fix for the obsolete use of -bundle instead of -dynamiclib in CMAKE_SHARED_MODULE_CREATE
+patchfiles-append   patch-SHARED_BUNDLE_flag.diff
+
 configure.env-append \
                     CMAKE_PREFIX_PATH=${prefix} \
                     CMAKE_INCLUDE_PATH=${prefix}/include/ncurses \
@@ -58,6 +61,7 @@
                     --parallel=${build.jobs} \
                     --init=${worksrcpath}/macports.cmake \
                     --system-libs
+#--sphinx-man --sphinx-build=${prefix}/bin/sphinx-build-3.3
 
 configure.universal_args
 configure.post_args
@@ -112,12 +116,30 @@
         reinplace "s|@PREFIX@|${prefix}|g" ${destroot}${applications_dir}/${app}.app/Contents/Info.plist
         ln -s ${prefix}/bin/cmake-gui ${destroot}${applications_dir}/${app}.app/Contents/MacOS/cmake-gui
         xinstall -m 644 ${worksrcpath}/Source/QtDialog/CMakeSetup.icns ${destroot}${applications_dir}/${app}.app/Contents/Resources/CMakeSetup.icns
+        file delete -force ${destroot}${prefix}/PlugIns
+        file delete -force ${destroot}${prefix}/Resources
     }
 }
 
-variant gui description {Qt4 based cmake-gui} {
+variant qt4 description {Build the Qt4 gui version} {
     PortGroup qt4 1.0
-    patchfiles-append patch-CMakeLists.txt.diff
+}
+
+variant gui description {Qt based cmake-gui} {
+    if {[variant_isset qt4]} {
+        # qt4 being requested we have to make sure CMake doesn't detect and use
+        # qt5 if that happens to be installed too:
+        patchfiles-append   patch-CMakeLists.txt.diff \
+                            patch-CMakeLists-4qt4.diff
+    } else {
+        # this is how cmake checks what Qt version to use:
+        if {[file exists ${prefix}/lib/pkgconfig/Qt5Widgets.pc]} {
+            PortGroup qt5 1.0
+        } else {
+            PortGroup qt4 1.0
+        }
+        patchfiles-append   patch-CMakeLists.txt.diff
+    }
     configure.args-append --qt-gui --qt-qmake=${qt_qmake_cmd}
 }
 
Index: files/patch-CMakeLists-4qt4.diff
===================================================================
diff --git a/trunk/dports/devel/cmake/files/patch-CMakeLists-4qt4.diff b/trunk/dports/devel/cmake/files/patch-CMakeLists-4qt4.diff
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/devel/cmake/files/patch-CMakeLists-4qt4.diff	(working copy)
@@ -0,0 +1,15 @@
+diff --git Source/QtDialog/CMakeLists.txt Source/QtDialog/CMakeLists.txt
+index 03c2fb4..a73a37f 100644
+--- Source/QtDialog/CMakeLists.txt
++++ Source/QtDialog/CMakeLists.txt
+@@ -14,8 +14,8 @@ project(QtDialog)
+ if(POLICY CMP0020)
+   cmake_policy(SET CMP0020 NEW) # Drop when CMake >= 2.8.11 required
+ endif()
+-find_package(Qt5Widgets QUIET)
+-if (Qt5Widgets_FOUND)
++#find_package(Qt5Widgets QUIET)
++if (FALSE)
+   include_directories(${Qt5Widgets_INCLUDE_DIRS})
+   add_definitions(${Qt5Widgets_DEFINITONS})
+   macro(qt4_wrap_ui)
Index: files/patch-CMakeLists.txt.diff
===================================================================
diff --git a/trunk/dports/devel/cmake/files/patch-CMakeLists.txt.diff b/trunk/dports/devel/cmake/files/patch-CMakeLists.txt.diff
--- a/trunk/dports/devel/cmake/files/patch-CMakeLists.txt.diff	(revision 132772)
+++ b/trunk/dports/devel/cmake/files/patch-CMakeLists.txt.diff	(working copy)
@@ -1,26 +1,30 @@
+diff --git CMakeLists.txt CMakeLists.txt
+index 71850de..e25ea4e 100644
 --- CMakeLists.txt
 +++ CMakeLists.txt
-@@ -476,7 +476,7 @@ if(BUILD_CursesDialog)
- endif()
+@@ -501,7 +501,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
+   endif()
  
- if(BUILD_QtDialog)
--  if(APPLE)
-+  if(FALSE)
-     set(CMAKE_BUNDLE_VERSION
-       "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
-     set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}")
+   if(BUILD_QtDialog)
+-    if(APPLE)
++    if(APPLEBUNDLE)
+       set(CMAKE_BUNDLE_VERSION
+         "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
+       set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}")
+diff --git Source/QtDialog/CMakeLists.txt Source/QtDialog/CMakeLists.txt
+index 03c2fb4..eb46fcb 100644
 --- Source/QtDialog/CMakeLists.txt
 +++ Source/QtDialog/CMakeLists.txt
-@@ -99,7 +99,7 @@ set(SRCS ${SRCS} ${UI_SRCS} ${MOC_SRCS} ${RC_SRCS})
+@@ -125,7 +125,7 @@ set(SRCS ${SRCS} ${UI_SRCS} ${MOC_SRCS} ${RC_SRCS})
  if(WIN32)
    set(SRCS ${SRCS} CMakeSetup.rc)
  endif()
 -if(APPLE)
-+if(FALSE)
++if(APPLEBUNDLE)
    set(SRCS ${SRCS} CMakeSetup.icns)
    set(MACOSX_BUNDLE_ICON_FILE CMakeSetup.icns)
    set_source_files_properties(CMakeSetup.icns PROPERTIES
-@@ -115,13 +115,13 @@ endif()
+@@ -141,13 +141,13 @@ endif()
  
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  
@@ -32,25 +36,21 @@
  endif()
  
 -if(APPLE)
-+if(FALSE)
++if(APPLEBUNDLE)
    file(STRINGS "${CMake_SOURCE_DIR}/Copyright.txt" copyright_line
      LIMIT_COUNT 1 REGEX "^Copyright 2000-20[0-9][0-9] Kitware")
  
-@@ -153,7 +153,7 @@ if(UNIX)
-   install(FILES cmakecache.xml DESTINATION share/mime/packages )
- endif()
- 
--if(APPLE)
-+if(FALSE)
-   set(CMAKE_POSTFLIGHT_SCRIPT
-     "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh")
-   set(CMAKE_POSTUPGRADE_SCRIPT
-@@ -166,7 +166,7 @@ if(APPLE)
+@@ -184,11 +184,11 @@ if(APPLE)
                  WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)")
  endif()
  
 -if(APPLE OR WIN32)
-+if(WIN32)
++if(APPLEBUNDLE OR WIN32)
    # install rules for including 3rd party libs such as Qt
    # if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation
    set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}")
+-  if(APPLE)
++  if(APPLEBUNDLE)
+     set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/CMake")
+   endif()
+   install(CODE "
Index: files/patch-Modules-FindFreetype.cmake.diff
===================================================================
diff --git a/trunk/dports/devel/cmake/files/patch-Modules-FindFreetype.cmake.diff b/trunk/dports/devel/cmake/files/patch-Modules-FindFreetype.cmake.diff
--- a/trunk/dports/devel/cmake/files/patch-Modules-FindFreetype.cmake.diff	(revision 132772)
+++ b/trunk/dports/devel/cmake/files/patch-Modules-FindFreetype.cmake.diff	(working copy)
@@ -1,6 +1,6 @@
---- Modules/FindFreetype.cmake.orig
-+++ Modules/FindFreetype.cmake
-@@ -55,10 +55,6 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
+--- Modules/FindFreetype.cmake.orig	2015-02-04 15:36:43.000000000 -0500
++++ Modules/FindFreetype.cmake	2015-02-09 10:34:02.000000000 -0500
+@@ -57,10 +57,6 @@
    HINTS
      ENV FREETYPE_DIR
    PATHS
@@ -11,7 +11,7 @@
      ENV GTKMM_BASEPATH
      [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
      [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
-@@ -72,10 +68,6 @@ find_path(FREETYPE_INCLUDE_DIR_freetype2
+@@ -78,10 +74,6 @@
    HINTS
      ENV FREETYPE_DIR
    PATHS
@@ -22,9 +22,9 @@
      ENV GTKMM_BASEPATH
      [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
      [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
-@@ -88,10 +80,6 @@ find_library(FREETYPE_LIBRARY
+@@ -99,10 +91,6 @@
+   HINTS
      ENV FREETYPE_DIR
-   PATH_SUFFIXES lib
    PATHS
 -    /usr/X11R6
 -    /usr/local/X11R6
Index: files/patch-Modules-FindQt4.cmake.diff
===================================================================
diff --git a/trunk/dports/devel/cmake/files/patch-Modules-FindQt4.cmake.diff b/trunk/dports/devel/cmake/files/patch-Modules-FindQt4.cmake.diff
--- a/trunk/dports/devel/cmake/files/patch-Modules-FindQt4.cmake.diff	(revision 132772)
+++ b/trunk/dports/devel/cmake/files/patch-Modules-FindQt4.cmake.diff	(working copy)
@@ -1,6 +1,6 @@
---- Modules/FindQt4.cmake.orig
-+++ Modules/FindQt4.cmake
-@@ -728,9 +728,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
+--- Modules/FindQt4.cmake.orig	2015-02-04 15:36:43.000000000 -0500
++++ Modules/FindQt4.cmake	2015-02-09 10:34:02.000000000 -0500
+@@ -741,9 +741,7 @@
        find_path(QT_IMPORTS_DIR NAMES Qt
          HINTS ${qt_cross_paths} ${qt_imports_dir}
          DOC "The location of the Qt imports"
Index: files/patch-Modules-Platform-Darwin-Initialize.cmake.diff
===================================================================
diff --git a/trunk/dports/devel/cmake/files/patch-Modules-Platform-Darwin-Initialize.cmake.diff b/trunk/dports/devel/cmake/files/patch-Modules-Platform-Darwin-Initialize.cmake.diff
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/devel/cmake/files/patch-Modules-Platform-Darwin-Initialize.cmake.diff	(working copy)
@@ -0,0 +1,25 @@
+--- Modules/Platform/Darwin-Initialize.cmake.orig	2015-02-09 10:55:45.000000000 -0500
++++ Modules/Platform/Darwin-Initialize.cmake	2015-02-09 10:58:06.000000000 -0500
+@@ -94,11 +94,17 @@
+         NOT CMAKE_OSX_DEPLOYMENT_TARGET VERSION_EQUAL ${_CMAKE_OSX_DEPLOYMENT_TARGET})
+       set(_CMAKE_OSX_SDKS_VER ${CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${CMAKE_OSX_DEPLOYMENT_TARGET}})
+       set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
+-      message(WARNING
+-        "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
+-        "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n"
+-        "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"."
+-        )
++      if(IS_DIRECTORY "${_CMAKE_OSX_SYSROOT_DEFAULT}")
++        if(NOT "${CMAKE_OSX_DEPLOYMENT_TARGET}" STREQUAL "${_CURRENT_OSX_VERSION}")
++	  message(WARNING
++            "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
++            "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n"
++            "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"."
++            )
++	endif()
++      else()
++        set(_CMAKE_OSX_SYSROOT_DEFAULT "")
++      endif()
+     endif()
+   else()
+     # Assume developer files are in root (such as Xcode 4.5 command-line tools).
Index: files/patch-Modules-Platform-Darwin.cmake.diff
===================================================================
diff --git a/trunk/dports/devel/cmake/files/patch-Modules-Platform-Darwin.cmake.diff b/trunk/dports/devel/cmake/files/patch-Modules-Platform-Darwin.cmake.diff
--- a/trunk/dports/devel/cmake/files/patch-Modules-Platform-Darwin.cmake.diff	(revision 132772)
+++ b/trunk/dports/devel/cmake/files/patch-Modules-Platform-Darwin.cmake.diff	(working copy)
@@ -1,36 +1,12 @@
---- Modules/Platform/Darwin.cmake.orig	2014-09-11 23:24:00.000000000 +1000
-+++ Modules/Platform/Darwin.cmake	2014-10-21 14:02:52.000000000 +1100
-@@ -140,12 +140,18 @@
-       else()
-         set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}})
-         set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
--        message(WARNING
--          "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
--          "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n"
--          "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"\n"
--          "matching the host OS X version."
--          )
-+        if(IS_DIRECTORY "${_CMAKE_OSX_SYSROOT_DEFAULT}")
-+          if (NOT "${CMAKE_OSX_DEPLOYMENT_TARGET}" STREQUAL "${_CURRENT_OSX_VERSION}")
-+            message(WARNING
-+              "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
-+              "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n"
-+              "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"\n"
-+              "matching the host OS X version."
-+              )
-+          endif()
-+        else ()
-+          set(_CMAKE_OSX_SYSROOT_DEFAULT "")
-+        endif()
-       endif()
-     else()
-       set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}})
-@@ -207,6 +213,8 @@
+--- Modules/Platform/Darwin.cmake.orig	2015-02-04 15:36:43.000000000 -0500
++++ Modules/Platform/Darwin.cmake	2015-02-09 10:39:29.000000000 -0500
+@@ -70,7 +70,8 @@
      set(_sdk_ver "${CMAKE_MATCH_1}")
    elseif("${_CMAKE_OSX_SYSROOT_ORIG}" MATCHES "^macosx([0-9]+\\.[0-9]+)$")
      set(_sdk_ver "${CMAKE_MATCH_1}")
-+  elseif("${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "/" OR "${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "")
-+    set(_sdk_ver "${_CURRENT_OSX_VERSION}")
+-  elseif("${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "/")
++  elseif("${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "/" OR
++         "${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "")
+     set(_sdk_ver "${_CURRENT_OSX_VERSION}")
    else()
      message(FATAL_ERROR
-       "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
Index: files/patch-SHARED_BUNDLE_flag.diff
===================================================================
diff --git a/trunk/dports/devel/cmake/files/patch-SHARED_BUNDLE_flag.diff b/trunk/dports/devel/cmake/files/patch-SHARED_BUNDLE_flag.diff
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/devel/cmake/files/patch-SHARED_BUNDLE_flag.diff	(working copy)
@@ -0,0 +1,68 @@
+--- ./Modules/Platform/Darwin-Intel.cmake.orig	2014-06-09 17:46:52.000000000 +0200
++++ ./Modules/Platform/Darwin-Intel.cmake	2014-07-03 12:26:08.000000000 +0200
+@@ -21,7 +21,8 @@
+ macro(__darwin_compiler_intel lang)
+   set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output
+   set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+-  set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
++  #set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
++  set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+ 
+   if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0)
+     set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+--- ./Modules/Platform/Darwin-XL-C.cmake.orig	2014-06-09 17:46:52.000000000 +0200
++++ ./Modules/Platform/Darwin-XL-C.cmake	2014-07-03 12:26:15.000000000 +0200
+@@ -1,5 +1,6 @@
+ set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj")
+-set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle")
++#set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle")
++set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-dynamiclib")
+ 
+ # Enable shared library versioning.
+ set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-install_name")
+--- ./Modules/Platform/Darwin-XL-CXX.cmake.orig	2014-06-09 17:46:52.000000000 +0200
++++ ./Modules/Platform/Darwin-XL-CXX.cmake	2014-07-03 12:26:22.000000000 +0200
+@@ -1,5 +1,6 @@
+ set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj")
+-set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "-bundle")
++#set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "-bundle")
++set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "-dynamiclib")
+ 
+ # Enable shared library versioning.
+ set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-install_name")
+--- ./Modules/Platform/Darwin.cmake.orig	2014-06-09 17:46:52.000000000 +0200
++++ ./Modules/Platform/Darwin.cmake	2014-07-03 12:26:31.000000000 +0200
+@@ -50,7 +50,8 @@
+ 
+ set(CMAKE_PLATFORM_HAS_INSTALLNAME 1)
+ set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+-set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names")
++#set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names")
++set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+ set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
+ set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
+--- Modules/Platform/orig.Darwin-GNU.cmake	2015-02-10 21:59:20.000000000 +0100
++++ Modules/Platform/Darwin-GNU.cmake	2015-02-10 22:03:10.000000000 +0100
+@@ -22,7 +22,8 @@
+   set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output
+   # GNU does not have -shared on OS X
+   set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+-  set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
++  #set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
++  set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+ 
+   if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.3)
+     set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
+--- Modules/Platform/orig.Darwin-Clang.cmake	2015-02-10 21:59:20.000000000 +0100
++++ Modules/Platform/Darwin-Clang.cmake	2015-02-10 22:04:52.000000000 +0100
+@@ -21,7 +21,8 @@
+ macro(__darwin_compiler_clang lang)
+   set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output
+   set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+-  set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
++  #set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
++  set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+   set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot")
+   set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=")
+   if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.1)
