diff -ur cmake-2.8.5_orig/bootstrap cmake-2.8.5/bootstrap
--- cmake-2.8.5_orig/bootstrap	2011-07-08 12:21:43.031981568 +0000
+++ cmake-2.8.5/bootstrap	2011-07-09 17:59:50.059768832 +0000
@@ -142,7 +142,9 @@
     cmake_default_prefix="c:/Program Files/CMake"
   fi
 elif ${cmake_system_haiku}; then
-  cmake_default_prefix=`/bin/finddir B_COMMON_DIRECTORY`
+  cmake_default_prefix=`finddir B_COMMON_DIRECTORY`
+  cmake_man_dir="/documentation/man"
+  cmake_doc_dir="/documentation/doc/cmake-${cmake_version}"
 else
   cmake_default_prefix="/usr/local"
 fi
diff -ur cmake-2.8.5_orig/Modules/CheckForPthreads.c cmake-2.8.5/Modules/CheckForPthreads.c
--- cmake-2.8.5_orig/Modules/CheckForPthreads.c	2011-07-08 12:21:44.040632320 +0000
+++ cmake-2.8.5/Modules/CheckForPthreads.c	2011-07-09 17:59:50.060817408 +0000
@@ -16,7 +16,7 @@
   pthread_create(&tid[0], 0, runner, (void*)1);
   pthread_create(&tid[1], 0, runner, (void*)2);
   
-#if defined(__BEOS__) && !defined(__ZETA__)  && !defined(__HAIKU__) // (no usleep on BeOS 5.)
+#if defined(__BEOS__) && !defined(__ZETA__) // (no usleep on BeOS 5.)
   usleep(1); // for strange behavior on single-processor sun
 #endif
 
diff -ur cmake-2.8.5_orig/Modules/CMakeFortranCompilerId.F.in cmake-2.8.5/Modules/CMakeFortranCompilerId.F.in
--- cmake-2.8.5_orig/Modules/CMakeFortranCompilerId.F.in	2011-07-08 12:21:44.047448064 +0000
+++ cmake-2.8.5/Modules/CMakeFortranCompilerId.F.in	2011-07-09 17:59:50.062128128 +0000
@@ -74,12 +74,8 @@
         PRINT *, 'INFO:platform[IRIX]'
 #elif defined(__hpux) || defined(__hpux__)
         PRINT *, 'INFO:platform[HP-UX]'
-#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU)
+#elif defined(__HAIKU__)
         PRINT *, 'INFO:platform[Haiku]'
-#       if 0
-!       Haiku also defines __BEOS__ so we must
-!       put it prior to the check for __BEOS__
-#       endif
 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
         PRINT *, 'INFO:platform[BeOS]'
 #elif defined(__QNX__) || defined(__QNXNTO__)
diff -ur cmake-2.8.5_orig/Modules/CMakePlatformId.h.in cmake-2.8.5/Modules/CMakePlatformId.h.in
--- cmake-2.8.5_orig/Modules/CMakePlatformId.h.in	2011-07-08 12:21:44.048758784 +0000
+++ cmake-2.8.5/Modules/CMakePlatformId.h.in	2011-07-09 17:59:50.063176704 +0000
@@ -35,11 +35,8 @@
 #elif defined(__hpux) || defined(__hpux__)
 # define PLATFORM_ID "HP-UX"
 
-#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU)
+#elif defined(__HAIKU__)
 # define PLATFORM_ID "Haiku"
-/* Haiku also defines __BEOS__ so we must 
-   put it prior to the check for __BEOS__
-*/
 
 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
 # define PLATFORM_ID "BeOS"
diff -ur cmake-2.8.5_orig/Modules/FindGLUT.cmake cmake-2.8.5/Modules/FindGLUT.cmake
--- cmake-2.8.5_orig/Modules/FindGLUT.cmake	2011-07-08 12:21:44.063438848 +0000
+++ cmake-2.8.5/Modules/FindGLUT.cmake	2011-07-09 18:02:18.662437888 +0000
@@ -46,20 +46,22 @@
       /usr/openwin/include
       /opt/graphics/OpenGL/include
       /opt/graphics/OpenGL/contrib/libglut
+      /boot/develop/headers/os/opengl
       )
   
     FIND_LIBRARY( GLUT_glut_LIBRARY glut
       /usr/openwin/lib
+      /boot/develop/lib/x86/
       )
-    
-    FIND_LIBRARY( GLUT_Xi_LIBRARY Xi
-      /usr/openwin/lib
-      )
-    
-    FIND_LIBRARY( GLUT_Xmu_LIBRARY Xmu
-      /usr/openwin/lib
-      )
-    
+    IF(NOT BEOS AND NOT HAIKU)
+      FIND_LIBRARY( GLUT_Xi_LIBRARY Xi
+        /usr/openwin/lib
+        )
+
+      FIND_LIBRARY( GLUT_Xmu_LIBRARY Xmu
+        /usr/openwin/lib
+        )
+    ENDIF(NOT BEOS AND NOT HAIKU)
   ENDIF (APPLE)
   
 ENDIF (WIN32)
@@ -69,12 +71,18 @@
   IF(GLUT_glut_LIBRARY)
     # Is -lXi and -lXmu required on all platforms that have it?
     # If not, we need some way to figure out what platform we are on.
-    SET( GLUT_LIBRARIES
-      ${GLUT_glut_LIBRARY}
-      ${GLUT_Xmu_LIBRARY}
-      ${GLUT_Xi_LIBRARY} 
-      ${GLUT_cocoa_LIBRARY}
-      )
+    IF(BEOS OR HAIKU)
+      SET( GLUT_LIBRARIES
+        ${GLUT_glut_LIBRARY}
+        )
+    ELSE(BEOS OR HAIKU)
+      SET( GLUT_LIBRARIES
+        ${GLUT_glut_LIBRARY}
+        ${GLUT_Xmu_LIBRARY}
+        ${GLUT_Xi_LIBRARY} 
+        ${GLUT_cocoa_LIBRARY}
+        )
+    ENDIF(BEOS OR HAIKU)
     SET( GLUT_FOUND "YES" )
     
     #The following deprecated settings are for backwards compatibility with CMake1.4
@@ -84,9 +92,16 @@
   ENDIF(GLUT_glut_LIBRARY)
 ENDIF(GLUT_INCLUDE_DIR)
 
-MARK_AS_ADVANCED(
-  GLUT_INCLUDE_DIR
-  GLUT_glut_LIBRARY
-  GLUT_Xmu_LIBRARY
-  GLUT_Xi_LIBRARY
-  )
+IF(BEOS OR HAIKU)
+  MARK_AS_ADVANCED(
+    GLUT_INCLUDE_DIR
+    GLUT_glut_LIBRARY
+    )
+ELSE(BEOS OR HAIKU)
+  MARK_AS_ADVANCED(
+    GLUT_INCLUDE_DIR
+    GLUT_glut_LIBRARY
+    GLUT_Xmu_LIBRARY
+    GLUT_Xi_LIBRARY
+    )
+ENDIF(BEOS OR HAIKU)
diff -ur cmake-2.8.5_orig/Modules/FindLua51.cmake cmake-2.8.5/Modules/FindLua51.cmake
--- cmake-2.8.5_orig/Modules/FindLua51.cmake	2011-07-08 12:21:44.066060288 +0000
+++ cmake-2.8.5/Modules/FindLua51.cmake	2011-07-09 17:59:50.090439680 +0000
@@ -57,13 +57,13 @@
 
 IF(LUA_LIBRARY)
   # include the math library for Unix
-  IF(UNIX AND NOT APPLE)
+  IF(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
     FIND_LIBRARY(LUA_MATH_LIBRARY m)
     SET( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
   # For Windows and Mac, don't need to explicitly include the math library
   ELSE(UNIX AND NOT APPLE)
     SET( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
-  ENDIF(UNIX AND NOT APPLE)
+  ENDIF(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
 ENDIF(LUA_LIBRARY)
 
 INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff -ur cmake-2.8.5_orig/Modules/FindOpenGL.cmake cmake-2.8.5/Modules/FindOpenGL.cmake
--- cmake-2.8.5_orig/Modules/FindOpenGL.cmake	2011-07-08 12:21:44.066846720 +0000
+++ cmake-2.8.5/Modules/FindOpenGL.cmake	2011-07-09 17:59:50.091488256 +0000
@@ -80,6 +80,7 @@
       /usr/share/doc/NVIDIA_GLX-1.0/include
       /usr/openwin/share/include
       /opt/graphics/OpenGL/include /usr/X11R6/include
+      /boot/develop/headers/os/opengl
     )
 
     FIND_PATH(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
@@ -94,6 +95,7 @@
             /usr/openwin/lib
             /usr/shlib /usr/X11R6/lib
             ${HPUX_IA_OPENGL_LIB_PATH}
+            /boot/develop/lib/x86/
     )
 
     # On Unix OpenGL most certainly always requires X11.
diff -ur cmake-2.8.5_orig/Modules/Platform/Haiku.cmake cmake-2.8.5/Modules/Platform/Haiku.cmake
--- cmake-2.8.5_orig/Modules/Platform/Haiku.cmake	2011-07-08 12:21:44.016777216 +0000
+++ cmake-2.8.5/Modules/Platform/Haiku.cmake	2011-07-10 23:52:01.025952256 +0000
@@ -1,18 +1,25 @@
-SET(BEOS 1)
+SET(HAIKU 1)
+SET(UNIX 1)
 
-SET(CMAKE_DL_LIBS root be)
+SET(CMAKE_DL_LIBS "")
 SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
-SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart")
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
 SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
 SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
 SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
 
-INCLUDE(Platform/UnixPaths)
-LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH /boot/common)
-LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/common/include)
-LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/common/lib)
-LIST(APPEND CMAKE_SYSTEM_PROGRAM_PATH /boot/common/bin)
-LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /boot/common/lib)
+LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH
+  /boot/common/non-packaged
+  /boot/common
+  /boot/system
+  )
+LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+  /boot/common/non-packaged/lib
+  /boot/common/lib
+  /boot/develop/lib/x86
+  )
 LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/develop/headers/3rdparty)
 LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/develop/lib/x86)
 
diff -ur cmake-2.8.5_orig/Source/cmCTest.cxx cmake-2.8.5/Source/cmCTest.cxx
--- cmake-2.8.5_orig/Source/cmCTest.cxx	2011-07-08 12:21:45.037486592 +0000
+++ cmake-2.8.5/Source/cmCTest.cxx	2011-07-09 17:59:50.095682560 +0000
@@ -53,7 +53,7 @@
 #include <cm_zlib.h>
 #include <cmsys/Base64.h>
 
-#if defined(__BEOS__) && !defined(__HAIKU__)
+#if defined(__BEOS__)
 #include <be/kernel/OS.h>   /* disable_debugger() API. */
 #endif
 
diff -ur cmake-2.8.5_orig/Source/cmExportCommand.cxx cmake-2.8.5/Source/cmExportCommand.cxx
--- cmake-2.8.5_orig/Source/cmExportCommand.cxx	2011-07-08 12:21:45.046923776 +0000
+++ cmake-2.8.5/Source/cmExportCommand.cxx	2011-07-09 18:36:22.770179072 +0000
@@ -20,7 +20,8 @@
 #include "cmExportBuildFileGenerator.h"
 
 #if defined(__HAIKU__)
-#include <StorageKit.h>
+#include <FindDirectory.h>
+#include <StorageDefs.h>
 #endif
 
 cmExportCommand::cmExportCommand()
@@ -297,14 +298,15 @@
                                               const char* hash)
 {
 #if defined(__HAIKU__)
-  BPath dir;
-  if (find_directory(B_USER_SETTINGS_DIRECTORY, &dir) != B_OK)
+  char dir[B_PATH_NAME_LENGTH];
+  if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, dir, sizeof(dir)) !=
+      B_OK)
     {
     return;
     }
-  dir.Append("cmake/packages");
-  dir.Append(package.c_str());
-  std::string fname = dir.Path();
+  std::string fname = dir;
+  fname += "/cmake/packages/";
+  fname += package;
 #else
   const char* home = cmSystemTools::GetEnv("HOME");
   if(!home)
diff -ur cmake-2.8.5_orig/Source/cmFindPackageCommand.cxx cmake-2.8.5/Source/cmFindPackageCommand.cxx
--- cmake-2.8.5_orig/Source/cmFindPackageCommand.cxx	2011-07-08 12:21:46.051118080 +0000
+++ cmake-2.8.5/Source/cmFindPackageCommand.cxx	2011-07-09 18:26:27.005242880 +0000
@@ -19,7 +19,9 @@
 #endif
 
 #if defined(__HAIKU__)
-#include <StorageKit.h>
+#include <string.h>
+#include <FindDirectory.h>
+#include <StorageDefs.h>
 #endif
 
 void cmFindPackageNeedBackwardsCompatibility(const std::string& variable,
@@ -1292,12 +1294,13 @@
 #if defined(_WIN32) && !defined(__CYGWIN__)
   this->LoadPackageRegistryWinUser();
 #elif defined(__HAIKU__)
-  BPath dir;
-  if (find_directory(B_USER_SETTINGS_DIRECTORY, &dir) == B_OK)
+  char dir[B_PATH_NAME_LENGTH];
+  if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, dir, sizeof(dir)) ==
+      B_OK)
     {
-    dir.Append("cmake/packages");
-    dir.Append(this->Name.c_str());
-    this->LoadPackageRegistryDir(dir.Path());
+    strlcat(dir, "/cmake/packages/", sizeof(dir));
+    strlcat(dir, this->Name.c_str(), sizeof(dir));
+    this->LoadPackageRegistryDir(dir);
     }
 #else
   if(const char* home = cmSystemTools::GetEnv("HOME"))
diff -ur cmake-2.8.5_orig/Source/cmLocalGenerator.cxx cmake-2.8.5/Source/cmLocalGenerator.cxx
--- cmake-2.8.5_orig/Source/cmLocalGenerator.cxx	2011-07-08 12:21:46.065273856 +0000
+++ cmake-2.8.5/Source/cmLocalGenerator.cxx	2011-07-09 18:30:30.565182464 +0000
@@ -37,7 +37,8 @@
 #include <assert.h>
 
 #if defined(__HAIKU__)
-#include <StorageKit.h>
+#include <FindDirectory.h>
+#include <StorageDefs.h>
 #endif
 
 cmLocalGenerator::cmLocalGenerator()
@@ -354,12 +355,12 @@
     prefix = prefix_win32.c_str();
     }
 #elif defined(__HAIKU__)
+  char dir[B_PATH_NAME_LENGTH];
   if (!prefix)
     {
-    BPath dir;
-    if (find_directory(B_COMMON_DIRECTORY, &dir) == B_OK)
+    if (find_directory(B_COMMON_DIRECTORY, -1, false, dir, sizeof(dir)) == B_OK)
       {
-      prefix = dir.Path();
+      prefix = dir;
       }
     else
       {
diff -ur cmake-2.8.5_orig/Source/CPack/cmCPackGenerator.cxx cmake-2.8.5/Source/CPack/cmCPackGenerator.cxx
--- cmake-2.8.5_orig/Source/CPack/cmCPackGenerator.cxx	2011-07-08 12:21:47.017563648 +0000
+++ cmake-2.8.5/Source/CPack/cmCPackGenerator.cxx	2011-07-09 18:33:59.244842496 +0000
@@ -27,7 +27,8 @@
 #include <algorithm>
 
 #if defined(__HAIKU__)
-#include <StorageKit.h>
+#include <FindDirectory.h>
+#include <StorageDefs.h>
 #endif
 
 //----------------------------------------------------------------------
@@ -1206,10 +1207,10 @@
   this->InstallPath += "-";
   this->InstallPath += this->GetOption("CPACK_PACKAGE_VERSION");
 #elif defined(__HAIKU__)
-  BPath dir;
-  if (find_directory(B_COMMON_DIRECTORY, &dir) == B_OK)
+  char dir[B_PATH_NAME_LENGTH];
+  if (find_directory(B_COMMON_DIRECTORY, -1, false, dir, sizeof(dir)) == B_OK)
     {
-    this->InstallPath = dir.Path();
+    this->InstallPath = dir;
     }
   else
     {
diff -ur cmake-2.8.5_orig/Source/CPack/cmCPackGeneratorFactory.cxx cmake-2.8.5/Source/CPack/cmCPackGeneratorFactory.cxx
--- cmake-2.8.5_orig/Source/CPack/cmCPackGeneratorFactory.cxx	2011-07-08 12:21:47.017825792 +0000
+++ cmake-2.8.5/Source/CPack/cmCPackGeneratorFactory.cxx	2011-07-09 17:59:50.096731136 +0000
@@ -32,7 +32,7 @@
 #endif
 
 #if !defined(_WIN32) && !defined(__APPLE__) \
- && !defined(__QNXNTO__) && !defined(__BEOS__)
+ && !defined(__QNXNTO__) && !defined(__BEOS__) && !defined(__HAIKU__)
 #  include "cmCPackDebGenerator.h"
 #  include "cmCPackRPMGenerator.h"
 #endif
@@ -73,7 +73,7 @@
     cmCPackOSXX11Generator::CreateGenerator);
 #endif
 #if !defined(_WIN32) && !defined(__APPLE__) \
-  && !defined(__QNXNTO__) && !defined(__BEOS__)
+  && !defined(__QNXNTO__) && !defined(__BEOS__) && !defined(__HAIKU__)
   this->RegisterGenerator("DEB", "Debian packages",
     cmCPackDebGenerator::CreateGenerator);
   this->RegisterGenerator("RPM", "RPM packages",
diff -ur cmake-2.8.5_orig/Source/kwsys/ProcessUNIX.c cmake-2.8.5/Source/kwsys/ProcessUNIX.c
--- cmake-2.8.5_orig/Source/kwsys/ProcessUNIX.c	2011-07-08 12:21:48.042729472 +0000
+++ cmake-2.8.5/Source/kwsys/ProcessUNIX.c	2011-07-09 17:59:50.100401152 +0000
@@ -63,10 +63,6 @@
 #include <dirent.h>    /* DIR, dirent */
 #include <ctype.h>     /* isspace */
 
-#ifdef __HAIKU__
-#undef __BEOS__
-#endif
-
 #if defined(__VMS)
 # define KWSYSPE_VMS_NONBLOCK , O_NONBLOCK
 #else
diff -ur cmake-2.8.5_orig/Source/kwsys/SystemTools.cxx cmake-2.8.5/Source/kwsys/SystemTools.cxx
--- cmake-2.8.5_orig/Source/kwsys/SystemTools.cxx	2011-07-08 12:21:48.044826624 +0000
+++ cmake-2.8.5/Source/kwsys/SystemTools.cxx	2011-07-09 17:59:50.103284736 +0000
@@ -150,7 +150,7 @@
 #include <os/storage/Path.h>
 #endif
 
-#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__)
+#if defined(__BEOS__) && !defined(__ZETA__)
 #include <be/kernel/OS.h>
 #include <be/storage/Path.h>
 
diff -ur cmake-2.8.5_orig/Source/kwsys/testDynamicLoader.cxx cmake-2.8.5/Source/kwsys/testDynamicLoader.cxx
--- cmake-2.8.5_orig/Source/kwsys/testDynamicLoader.cxx	2011-07-08 12:21:49.045613056 +0000
+++ cmake-2.8.5/Source/kwsys/testDynamicLoader.cxx	2011-07-09 17:59:50.105119744 +0000
@@ -15,7 +15,7 @@
 #include KWSYS_HEADER(ios/iostream)
 #include KWSYS_HEADER(stl/string)
 
-#if defined(__BEOS__) && !defined(__HAIKU__)
+#if defined(__BEOS__)
 #include <be/kernel/OS.h>  /* disable_debugger() API. */
 #endif
 
diff -ur cmake-2.8.5_orig/Source/kwsys/testProcess.c cmake-2.8.5/Source/kwsys/testProcess.c
--- cmake-2.8.5_orig/Source/kwsys/testProcess.c	2011-07-08 12:21:49.046399488 +0000
+++ cmake-2.8.5/Source/kwsys/testProcess.c	2011-07-09 17:59:50.108265472 +0000
@@ -32,7 +32,7 @@
 # pragma warn -8060 /* possibly incorrect assignment */
 #endif
 
-#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__)
+#if defined(__BEOS__) && !defined(__ZETA__)
 /* BeOS 5 doesn't have usleep(), but it has snooze(), which is identical. */
 # include <be/kernel/OS.h>
 static inline void testProcess_usleep(unsigned int msec)
diff -ur cmake-2.8.5_orig/Tests/Complex/Library/CMakeLists.txt cmake-2.8.5/Tests/Complex/Library/CMakeLists.txt
--- cmake-2.8.5_orig/Tests/Complex/Library/CMakeLists.txt	2011-07-08 12:21:50.003670016 +0000
+++ cmake-2.8.5/Tests/Complex/Library/CMakeLists.txt	2011-07-09 17:59:50.114294784 +0000
@@ -52,9 +52,9 @@
   FULL_DOCS "A simple etst proerty that means nothign and is used for nothing"
   )
 SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES FOO BAR)
-IF(NOT BEOS AND NOT WIN32)  # No libm on BeOS.
+IF(NOT BEOS AND NOT WIN32 AND NOT HAIKU)  # No libm on BeOS.
   SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm")
-ENDIF(NOT BEOS AND NOT WIN32)
+ENDIF(NOT BEOS AND NOT WIN32 AND NOT HAIKU)
 GET_TARGET_PROPERTY(FOO_BAR_VAR CMakeTestCLibraryShared FOO)
 IF(${FOO_BAR_VAR} MATCHES "BAR")
 ELSE(${FOO_BAR_VAR} MATCHES "BAR")
diff -ur cmake-2.8.5_orig/Tests/ComplexOneConfig/Library/CMakeLists.txt cmake-2.8.5/Tests/ComplexOneConfig/Library/CMakeLists.txt
--- cmake-2.8.5_orig/Tests/ComplexOneConfig/Library/CMakeLists.txt	2011-07-08 12:21:50.007864320 +0000
+++ cmake-2.8.5/Tests/ComplexOneConfig/Library/CMakeLists.txt	2011-07-09 17:59:50.116654080 +0000
@@ -52,9 +52,9 @@
   FULL_DOCS "A simple etst proerty that means nothign and is used for nothing"
   )
 SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES FOO BAR)
-IF(NOT BEOS AND NOT WIN32)  # No libm on BeOS.
+IF(NOT BEOS AND NOT WIN32 AND NOT HAIKU)  # No libm on BeOS.
   SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm")
-ENDIF(NOT BEOS AND NOT WIN32)
+ENDIF(NOT BEOS AND NOT WIN32 AND NOT HAIKU)
 GET_TARGET_PROPERTY(FOO_BAR_VAR CMakeTestCLibraryShared FOO)
 IF(${FOO_BAR_VAR} MATCHES "BAR")
 ELSE(${FOO_BAR_VAR} MATCHES "BAR")
diff -ur cmake-2.8.5_orig/Tests/ComplexRelativePaths/Library/CMakeLists.txt cmake-2.8.5/Tests/ComplexRelativePaths/Library/CMakeLists.txt
--- cmake-2.8.5_orig/Tests/ComplexRelativePaths/Library/CMakeLists.txt	2011-07-08 12:21:50.012320768 +0000
+++ cmake-2.8.5/Tests/ComplexRelativePaths/Library/CMakeLists.txt	2011-07-09 17:59:50.119013376 +0000
@@ -52,9 +52,9 @@
   FULL_DOCS "A simple etst proerty that means nothign and is used for nothing"
   )
 SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES FOO BAR)
-IF(NOT BEOS AND NOT WIN32)  # No libm on BeOS.
+IF(NOT BEOS AND NOT WIN32 AND NOT HAIKU)  # No libm on BeOS.
   SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm")
-ENDIF(NOT BEOS AND NOT WIN32)
+ENDIF(NOT BEOS AND NOT WIN32 AND NOT HAIKU)
 GET_TARGET_PROPERTY(FOO_BAR_VAR CMakeTestCLibraryShared FOO)
 IF(${FOO_BAR_VAR} MATCHES "BAR")
 ELSE(${FOO_BAR_VAR} MATCHES "BAR")
diff -ur cmake-2.8.5_orig/Utilities/cmcurl/CMake/CurlTests.c cmake-2.8.5/Utilities/cmcurl/CMake/CurlTests.c
--- cmake-2.8.5_orig/Utilities/cmcurl/CMake/CurlTests.c	2011-07-08 12:21:54.052953088 +0000
+++ cmake-2.8.5/Utilities/cmcurl/CMake/CurlTests.c	2011-07-09 17:59:50.122421248 +0000
@@ -38,7 +38,7 @@
 # define PLATFORM_AIX_V3
 #endif
 
-#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || (defined(__BEOS__) && !defined(__HAIKU__))
+#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
 #error "O_NONBLOCK does not work on this platform"
 #endif
   int socket;
diff -ur cmake-2.8.5_orig/Utilities/cmcurl/select.c cmake-2.8.5/Utilities/cmcurl/select.c
--- cmake-2.8.5_orig/Utilities/cmcurl/select.c	2011-07-08 12:21:55.063176704 +0000
+++ cmake-2.8.5/Utilities/cmcurl/select.c	2011-07-09 17:59:50.125829120 +0000
@@ -39,7 +39,7 @@
 #error "We can't compile without select() support!"
 #endif
 
-#if defined(__BEOS__) && !defined(__HAIKU__)
+#if defined(__BEOS__)
 /* BeOS has FD_SET defined in socket.h */
 #include <socket.h>
 #endif
diff -ur cmake-2.8.5_orig/Utilities/cmzlib/zconf.h cmake-2.8.5/Utilities/cmzlib/zconf.h
--- cmake-2.8.5_orig/Utilities/cmzlib/zconf.h	2011-07-08 12:21:58.054001664 +0000
+++ cmake-2.8.5/Utilities/cmzlib/zconf.h	2011-07-09 17:59:50.128712704 +0000
@@ -237,7 +237,7 @@
 #  endif
 #endif
 
-#if defined (__BEOS__) && !defined (__HAIKU__)
+#if defined (__BEOS__)
 #  ifdef ZLIB_DLL
 #    ifdef ZLIB_INTERNAL
 #      define ZEXPORT   __declspec(dllexport)
diff -ur cmake-2.8.5_orig/Utilities/cmzlib/zutil.h cmake-2.8.5/Utilities/cmzlib/zutil.h
--- cmake-2.8.5_orig/Utilities/cmzlib/zutil.h	2011-07-08 12:21:58.054525952 +0000
+++ cmake-2.8.5/Utilities/cmzlib/zutil.h	2011-07-09 17:59:50.129761280 +0000
@@ -147,12 +147,6 @@
 #  define OS_CODE  0x0f
 #endif
 
-/* Haiku defines both __HAIKU__ and __BEOS__ (for now) */
-/* many BeOS workarounds are no longer needed in Haiku */
-#if defined(__HAIKU__) && defined(__BEOS__)
-#undef __BEOS__
-#endif
-
 #if defined(_BEOS_) || defined(RISCOS) 
 #  define fdopen(fd,mode) NULL /* No fdopen() */
 #endif
