=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2014-11-13 02:09:47 +0000
+++ CMakeLists.txt	2014-11-26 20:06:52 +0000
@@ -226,8 +226,8 @@
 
     if( APPLE )
 
-        set( CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -D__ASSERTMACROS__ -mmacosx-version-min=10.5" )
-        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__ASSERTMACROS__ -mmacosx-version-min=10.5" )
+        set( CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -D__ASSERTMACROS__" )
+        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__ASSERTMACROS__" )
 
         # Allows .dylib relocation in the future - needed by fixbundle
         set( CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -headerpad_max_install_names")
@@ -240,6 +240,12 @@
             EXEC_PROGRAM( wx-config ARGS --cxx OUTPUT_VARIABLE CMAKE_CXX_COMPILER )
         endif()
 
+        # There seems to be no consistent behavior when -mmacosx-min-version is
+        # not specified, so force user to set minimum OSX version to build for
+        if( NOT CMAKE_OSX_DEPLOYMENT_TARGET )
+            message( FATAL_ERROR "Please specify target OS X version using -DCMAKE_OSX_DEPLOYMENT_TARGET=10.x" )
+        endif()
+
     endif()
 
 endif( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )

=== modified file 'CMakeModules/download_boost.cmake'
--- CMakeModules/download_boost.cmake	2014-08-23 15:22:50 +0000
+++ CMakeModules/download_boost.cmake	2014-11-26 20:06:52 +0000
@@ -140,11 +140,8 @@
 
 
 if( APPLE )
-    # I set this to being compatible with wxWidgets
-    # wxWidgets still using libstdc++ (gcc), meanwhile OSX
-    # has switched to libc++ (llvm) by default
-    set( BOOST_CXXFLAGS  "cxxflags=-mmacosx-version-min=10.5  -fno-common" )
-    set( BOOST_LINKFLAGS "linkflags=-mmacosx-version-min=10.5 -fno-common" )
+    set( BOOST_CXXFLAGS  "cxxflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -fno-common" )
+    set( BOOST_LINKFLAGS "linkflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -fno-common" )
     set( BOOST_TOOLSET   "toolset=darwin" )
 
     if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )

=== modified file 'Documentation/compiling/mac-osx.txt'
--- Documentation/compiling/mac-osx.txt	2014-10-17 17:45:33 +0000
+++ Documentation/compiling/mac-osx.txt	2014-11-26 20:06:52 +0000
@@ -1,9 +1,9 @@
 Compiling KiCad on Apple Mac OS X
 =================================
 
-Building on OSX is very similar to building on Linux. This document will provide
-a complete walk-through on what to do but it will focus on OSX specific things.
-See general documentation on non-OSX specific KiCad build switches, etc.
+Building on OS X is very similar to building on Linux. This document will provide
+a complete walk-through on what to do but it will focus on OS X specific things.
+See general documentation on non OS X specific KiCad build switches, etc.
 
 
 Prerequisites
@@ -24,6 +24,7 @@
    OR
   wxPython  - A blending of the wxWidgets C++ class library with the Python
               programming language
+* SWIG      - Interface compiler (only needed for scripting/wxPython builds)
 
 Optional library dependencies, depends on used KiCad features
 * OpenSSL - The Open Source toolkit for SSL/TLS
@@ -31,7 +32,7 @@
 
 All tools (except XCode, of course) and all dependencies except wxWidgets/wxPython
 can be compiled manually, but it is advised to install them using your favorite
-package manager for OSX like MacPorts or Homebrew.
+package manager for OS X like MacPorts or Homebrew.
 Depending on the package manager the development packages of the library
 dependencies may have to be installed (usually something like <pkg>-dev or
 <pkg>-devel).
@@ -44,7 +45,7 @@
 IMPORTANT:
 At the moment you *must not* use a wxWidgets/wxPython version installed by any
 package manager.
-KiCad on OSX needs overlay support and some other fixes, which are not yet
+KiCad on OS X needs overlay support and some other fixes, which are not yet
 contained in mainline wxWidgets/wxPython sources and builds.
 If you don't use a patched wxWidgets you will get graphical artifacts (something
 like a magnifying glass effect in the upper left corner of KiCad windows) or
@@ -92,13 +93,15 @@
 
 There is a little helper script osx_build_wx.sh in kicad/scripts that does all
 the patching/configuring/compiling of wxWidgets or wxPython for you.
-Go to your working root "KiCad" and run:
-  # kicad/scripts/osx_build_wx.sh wx-src wx-bin kicad "-j4"
+Go to your working root "KiCad" and for example run:
+  # kicad/scripts/osx_build_wx.sh wx-src wx-bin kicad 10.7 "-j4"
 
 First parameter is the source folder of wxWidgets/wxPython, second parameter the
-target folder for compiled binaries, third parameter is the kicad folder, and
-the last optional parameter are make options used during the build (in this
-case for building with 4 jobs in parallel).
+target folder for compiled binaries, and third parameter is the kicad folder.
+The fourth parameter is the minimum OS X version you are building for (see the
+section about compiling KiCad for further notes on minimum OS X version).
+The last parameter is optional and contains make options used during the build
+(in this example for building with 4 jobs in parallel).
 The script will automatically detect if you are compiling wxWidgets or wxPython.
 NOTE: All paths are assumed to be relative to the current directory, i.e., the
 working root you are in.
@@ -132,10 +135,8 @@
       --with-zlib=builtin \
       --with-expat=builtin \
       --without-liblzma \
-      --with-macosx-version-min=10.5 \
+      --with-macosx-version-min=<osxtarget> \
       --enable-universal-binary=i386,x86_64 \
-      CPPFLAGS="-stdlib=libstdc++" \
-      LDFLAGS="-stdlib=libstdc++" \
       CC=clang \
       CXX=clang++
 If you know what you are doing, you can of course use different settings.
@@ -152,6 +153,7 @@
   # cmake ../kicad \
       -DCMAKE_C_COMPILER=clang \
       -DCMAKE_CXX_COMPILER=clang++ \
+      -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 \
       -DwxWidgets_CONFIG_EXECUTABLE=../wx-bin/bin/wx-config \
       -DKICAD_SCRIPTING=OFF \
       -DKICAD_SCRIPTING_MODULES=OFF \
@@ -163,6 +165,7 @@
   # cmake ../kicad \
       -DCMAKE_C_COMPILER=clang \
       -DCMAKE_CXX_COMPILER=clang++ \
+      -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 \
       -DwxWidgets_CONFIG_EXECUTABLE=../wx-bin/bin/wx-config \
       -DPYTHON_EXECUTABLE=`which python` \
       -DPYTHON_SITE_PACKAGE_PATH=`pwd`/../wx-bin/lib/python2.7/site-packages \
@@ -177,6 +180,18 @@
 python, you can also specify it via "-DPYTHON_EXECUTABLE" instead of using
 `which python` (this one will just detect/use you default python).
 
+The parameter "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.x" is mandatory, you have to
+specify the (minimum) OS X version you intend to build for. It is important that
+at least wxWidgets/wxPython and KiCad (and boost, if you use an external build)
+are built using the same or compatible settings. If not, you might get linker
+errors, because this parameter influences which standard C++ library is being
+used (libstdc++ vs. libc++).
+If you don't know what to use and you are only building for your machine, just
+set it to your current OS X version (e.g., MacPorts always builds this way).
+Binaries built with a target OS X version <10.7 are known to show strange
+behavior in some situations on recent systems (maybe because libc++ is standard
+on everything >= 10.7 and problems arise due to mixing libstdc++/libc++).
+
 Now KiCad is configured using default features/build-switches.
 See Documentation/compiling/build-config.txt for a list of all CMake options
 available when compiling KiCad.

=== modified file 'scripts/osx_build_wx.sh'
--- scripts/osx_build_wx.sh	2014-10-08 18:41:36 +0000
+++ scripts/osx_build_wx.sh	2014-11-26 20:06:52 +0000
@@ -6,7 +6,8 @@
 #   $1  wxWidgets/wxPython source folder (relative to current dir)
 #   $2  Target bin folder
 #   $3  KiCad source folder (relative to current dir)
-#   $4  Make options (e.g., "-j4")
+#   $4  OSX target version (e.g., "10.8")
+#   $5  Extra make options (e.g., "-j4")
 
 createPaths() {
     echo "*** Creating/wiping build and bin folder..."
@@ -59,10 +60,8 @@
         --with-zlib=builtin \
         --with-expat=builtin \
         --without-liblzma \
-        --with-macosx-version-min=10.5 \
+        --with-macosx-version-min=$3 \
         --enable-universal-binary=i386,x86_64 \
-        CPPFLAGS="-stdlib=libstdc++" \
-        LDFLAGS="-stdlib=libstdc++" \
         CC=clang \
         CXX=clang++
     if [ $? -ne 0 ];
@@ -119,16 +118,17 @@
 
 
 # check parameters
-if [ "$#" -lt 3 ];
+if [ "$#" -lt 4 ];
 then
     echo "OSX wxWidgets/wxPython build script"
     echo
     echo "Usage:"
-    echo "  osx_build_wx.sh <src> <bin> <kicad> <makeopts>"
+    echo "  osx_build_wx.sh <src> <bin> <kicad> <osxtarget> [makeopts]"
     echo "    <src>       wxWidgets/wxPython source folder"
     echo "    <bin>       Destination folder"
     echo "    <kicad>     KiCad folder"
-    echo "    <makeopts>  Optional: make options for building wxWidgets (e.g., -j4)"
+    echo "    <osxtarget> OSX target (e.g., 10.7)"
+    echo "    [makeopts]  Optional: make options for building wxWidgets (e.g., -j4)"
     exit 1
 fi
 
@@ -142,8 +142,8 @@
 doPatch "$1" "$3/patches/wxwidgets-3.0.0_macosx_soname.patch"
 
 # configure and build wxWidgets
-wxWidgets_configure "$1" "$2"
-wxWidgets_buildInst "$4"
+wxWidgets_configure "$1" "$2" "$4"
+wxWidgets_buildInst "$5"
 
 # check if source is wxPython
 if [ -d $1/wxPython ];

