Index: code/trunk/src/external/bullet/BulletCollision/CMakeLists.txt
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CMakeLists.txt	(revision 8393)
+++ code/trunk/src/external/bullet/BulletCollision/CMakeLists.txt	(revision 8729)
@@ -1,5 +1,3 @@
 ADD_SOURCE_FILES(BULLET_FILES
-
-COMPILATION_BEGIN BulletCollisionCompilation.cpp
 
 	BroadphaseCollision/btAxisSweep3.cpp
@@ -84,12 +82,9 @@
 	NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp
 	NarrowPhaseCollision/btPersistentManifold.cpp
+	NarrowPhaseCollision/btPolyhedralContactClipping.cpp
 	NarrowPhaseCollision/btRaycastCallback.cpp
 	NarrowPhaseCollision/btSubSimplexConvexCast.cpp
 	NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
 
-COMPILATION_END
-
-    # Raises compiler errors when compiled inside the compilation
-	NarrowPhaseCollision/btPolyhedralContactClipping.cpp
 
 	# Headers
Index: code/trunk/src/external/bullet/BulletDynamics/CMakeLists.txt
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/CMakeLists.txt	(revision 8393)
+++ code/trunk/src/external/bullet/BulletDynamics/CMakeLists.txt	(revision 8729)
@@ -1,5 +1,3 @@
 ADD_SOURCE_FILES(BULLET_FILES
-
-COMPILATION_BEGIN BulletDynamicsCompilation.cpp
 
 	Character/btKinematicCharacterController.cpp
@@ -25,6 +23,4 @@
 	Vehicle/btRaycastVehicle.cpp
 	Vehicle/btWheelInfo.cpp
-
-COMPILATION_END
 
 	# Headers
Index: code/trunk/src/external/bullet/CMakeLists.txt
===================================================================
--- code/trunk/src/external/bullet/CMakeLists.txt	(revision 8393)
+++ code/trunk/src/external/bullet/CMakeLists.txt	(revision 8729)
@@ -32,4 +32,6 @@
   VERSION
     2.78
+  EXCLUDE_FROM_BUILD_UNITS
+    BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp
   SOURCE_FILES
     ${BULLET_FILES}
Index: code/trunk/src/external/bullet/LinearMath/CMakeLists.txt
===================================================================
--- code/trunk/src/external/bullet/LinearMath/CMakeLists.txt	(revision 8393)
+++ code/trunk/src/external/bullet/LinearMath/CMakeLists.txt	(revision 8729)
@@ -1,12 +1,10 @@
 ADD_SOURCE_FILES(BULLET_FILES
 
-COMPILATION_BEGIN BulletLinearMathCompilation.cpp
 	btAlignedAllocator.cpp
 	btConvexHull.cpp
-    btConvexHullComputer.cpp
+	btConvexHullComputer.cpp
 	btGeometryUtil.cpp
 	btQuickprof.cpp
 	btSerializer.cpp
-COMPILATION_END
 
 	# Headers
@@ -15,5 +13,5 @@
 	btAlignedObjectArray.h
 	btConvexHull.h
-    btConvexHullComputer.h
+	btConvexHullComputer.h
 	btDefaultMotionState.h
 	btGeometryUtil.h
Index: code/trunk/src/external/enet/CMakeLists.txt
===================================================================
--- code/trunk/src/external/enet/CMakeLists.txt	(revision 8393)
+++ code/trunk/src/external/enet/CMakeLists.txt	(revision 8729)
@@ -29,5 +29,4 @@
     win32.h
 
-COMPILATION_BEGIN ENetCompilation.c
     callbacks.c
     compress.c
@@ -39,5 +38,4 @@
     unix.c
     win32.c
-COMPILATION_END
 )
 
Index: code/trunk/src/external/ogreceguirenderer/CMakeLists.txt
===================================================================
--- code/trunk/src/external/ogreceguirenderer/CMakeLists.txt	(revision 8393)
+++ code/trunk/src/external/ogreceguirenderer/CMakeLists.txt	(revision 8729)
@@ -23,9 +23,7 @@
   OgreCEGUITexture.h
 
-COMPILATION_BEGIN OgreCEGUIRendererCompilation.cpp
   OgreCEGUIRenderer.cpp
   OgreCEGUIResourceProvider.cpp
   OgreCEGUITexture.cpp
-COMPILATION_END
 )
 
Index: code/trunk/src/external/ois/CMakeLists.txt
===================================================================
--- code/trunk/src/external/ois/CMakeLists.txt	(revision 8393)
+++ code/trunk/src/external/ois/CMakeLists.txt	(revision 8729)
@@ -35,5 +35,4 @@
   OISPrereqs.h
 
-#COMPILATION_BEGIN OISCompilation.cpp
   OISEffect.cpp
   OISException.cpp
@@ -43,6 +42,6 @@
   OISKeyboard.cpp
   OISObject.cpp
-#COMPILATION_END
 )
+
 IF(WIN32)
   ADD_SUBDIRECTORY(win32)
@@ -56,4 +55,9 @@
 IF(MINGW)
   INCLUDE_DIRECTORIES(${WMI_INCLUDE_DIR})
+ENDIF()
+
+# Apple has problems with OIS and build units
+IF(APPLE)
+  SET(USE_BUILD_UNITS NO_BUILD_UNITS)
 ENDIF()
 
@@ -72,4 +76,5 @@
   LINK_LIBS_LINUX
     X11
+  ${USE_BUILD_UNITS}
   SOURCE_FILES
     ${OIS_FILES}
Index: code/trunk/src/external/ois/linux/CMakeLists.txt
===================================================================
--- code/trunk/src/external/ois/linux/CMakeLists.txt	(revision 8393)
+++ code/trunk/src/external/ois/linux/CMakeLists.txt	(revision 8729)
@@ -8,5 +8,4 @@
   LinuxPrereqs.h
 
-COMPILATION_BEGIN OISLinuxCompilation.cpp
   EventHelpers.cpp
   LinuxForceFeedback.cpp
@@ -15,4 +14,3 @@
   LinuxKeyboard.cpp
   LinuxMouse.cpp
-COMPILATION_END
 )
Index: code/trunk/src/external/ois/mac/CMakeLists.txt
===================================================================
--- code/trunk/src/external/ois/mac/CMakeLists.txt	(revision 8393)
+++ code/trunk/src/external/ois/mac/CMakeLists.txt	(revision 8729)
@@ -8,5 +8,4 @@
   MacPrereqs.h
 
-#COMPILATION_BEGIN OISMacCompilation.cpp
   MacHelpers.cpp
   MacHIDManager.cpp
@@ -15,4 +14,3 @@
   MacKeyboard.cpp
   MacMouse.cpp
-#COMPILATION_END
 )
Index: code/trunk/src/external/ois/win32/CMakeLists.txt
===================================================================
--- code/trunk/src/external/ois/win32/CMakeLists.txt	(revision 8393)
+++ code/trunk/src/external/ois/win32/CMakeLists.txt	(revision 8729)
@@ -7,5 +7,4 @@
   Win32Prereqs.h
 
-COMPILATION_BEGIN OISWin32Compilation.cpp
   Win32ForceFeedback.cpp
   Win32InputManager.cpp
@@ -13,4 +12,3 @@
   Win32KeyBoard.cpp
   Win32Mouse.cpp
-COMPILATION_END
 )
Index: code/trunk/src/external/tinyxml/CMakeLists.txt
===================================================================
--- code/trunk/src/external/tinyxml/CMakeLists.txt	(revision 8393)
+++ code/trunk/src/external/tinyxml/CMakeLists.txt	(revision 8729)
@@ -24,5 +24,4 @@
   tinyxml.h
 
-COMPILATION_BEGIN TicppCompilation.cpp
   ticpp.cpp
   tinystr.cpp
@@ -30,5 +29,4 @@
   tinyxmlerror.cpp
   tinyxmlparser.cpp
-COMPILATION_END
 )
 
Index: code/trunk/src/external/tolua/lua/basic.lua
===================================================================
--- code/trunk/src/external/tolua/lua/basic.lua	(revision 8393)
+++ code/trunk/src/external/tolua/lua/basic.lua	(revision 8729)
@@ -354,3 +354,5 @@
 end
 
-
+-- called after all the required C++ includes have been written
+function post_include_hook(package_name)
+end
Index: code/trunk/src/external/tolua/lua/package.lua
===================================================================
--- code/trunk/src/external/tolua/lua/package.lua	(revision 8393)
+++ code/trunk/src/external/tolua/lua/package.lua	(revision 8729)
@@ -135,4 +135,6 @@
         i = i+1
     end
+
+    post_include_hook(self.name)
 
     output('\n')
