# This file is part of MXE.
# See index.html for further information.

This patch has been taken from:
http://www.vtk.org/Bug/view.php?id=12686

--- VTK/Utilities/kwsys/CMakeLists.txt	2011-08-24 15:37:12.000000000 +0200
+++ VTK/Utilities/kwsys/CMakeLists.txt	2011-10-30 00:06:06.402085234 +0200
@@ -937,13 +937,20 @@
 # file and build it into the library.  Win9x platforms reproduce the
 # executable into a temporary directory when it is needed.
 IF(KWSYS_USE_Process)
-  IF(NOT UNIX)
+  IF(NOT CMAKE_CROSSCOMPILING)
     # Build the forwarding executable itself and a program that will
     # encode it into a C file.
-    ADD_EXECUTABLE(${KWSYS_NAMESPACE}ProcessFwd9x ProcessFwd9x.c)
     ADD_EXECUTABLE(${KWSYS_NAMESPACE}EncodeExecutable EncodeExecutable.c)
-    KWSYS_SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}ProcessFwd9x PROPERTY LABELS ${KWSYS_LABELS_EXE})
     KWSYS_SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}EncodeExecutable PROPERTY LABELS ${KWSYS_LABELS_EXE})
+    EXPORT(TARGETS ${KWSYS_NAMESPACE}EncodeExecutable FILE ${EXPORT_EXECUTABLES_FILE} NAMESPACE "${EXPORT_EXECUTABLES_NAMESPACE}" APPEND)
+    IF(COMPILE_TOOLS_TARGET)
+      ADD_DEPENDENCIES(${COMPILE_TOOLS_TARGET} ${KWSYS_NAMESPACE}EncodeExecutable)
+    ENDIF(COMPILE_TOOLS_TARGET)
+  ENDIF(NOT CMAKE_CROSSCOMPILING)
+  
+  IF(NOT UNIX)  
+    ADD_EXECUTABLE(${KWSYS_NAMESPACE}ProcessFwd9x ProcessFwd9x.c)
+    KWSYS_SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}ProcessFwd9x PROPERTY LABELS ${KWSYS_LABELS_EXE})
 
     # Construct the location of the executable to be encoded.
     SET(BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
@@ -957,24 +964,23 @@
     ENDIF(CMAKE_BUILD_TOOL MATCHES "make")
 
     # Take advantage of a better custom command syntax if possible.
-    SET(CMD ${BIN_DIR}${CFG_INTDIR}/${KWSYS_NAMESPACE}EncodeExecutable.exe)
     SET(FWD ${BIN_DIR}${CFG_INTDIR}/${KWSYS_NAMESPACE}ProcessFwd9x.exe)
     IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6)
       ADD_CUSTOM_COMMAND(
         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
-        COMMAND ${CMD}
+        COMMAND ${KWSYS_NAMESPACE}EncodeExecutable
         ARGS ${FWD} ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
              ${KWSYS_NAMESPACE} ProcessFwd9x
-        DEPENDS ${CMD} ${FWD})
+        DEPENDS ${KWSYS_NAMESPACE}EncodeExecutable ${FWD})
     ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6)
       ADD_CUSTOM_COMMAND(
         TARGET ${KWSYS_NAMESPACE}
         SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/ProcessFwd9x.c
-        COMMAND ${CMD}
+        COMMAND ${KWSYS_NAMESPACE}EncodeExecutable
         ARGS ${FWD} ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
              ${KWSYS_NAMESPACE} ProcessFwd9x
         OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c
-        DEPENDS ${CMD} ${FWD})
+        DEPENDS ${KWSYS_NAMESPACE}EncodeExecutable ${FWD})
     ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6)
 
     # Make sure build occurs in proper order.
     
--- VTK/Utilities/vtkhdf5/src/CMakeLists.txt	2011-08-24 15:37:13.000000000 +0200
+++ VTK/Utilities/vtkhdf5/src/CMakeLists.txt	2011-10-30 00:13:16.798098058 +0200
@@ -572,34 +572,40 @@
 # Setup the H5Detect utility which generates H5Tinit with platform
 # specific type checks inside
 #-----------------------------------------------------------------------------
-SET (CMD ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${CFG_INIT}/H5detect${EXE_EXT})
-IF (XCODE)
-  SET (CMD "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/\${CONFIGURATION}/H5detect")
-ENDIF (XCODE)
-ADD_EXECUTABLE (H5detect ${HDF5_SRC_DIR}/H5detect.c)
-IF (WIN32)
-  TARGET_LINK_LIBRARIES (H5detect "ws2_32.lib")
-ENDIF (WIN32)
+IF(NOT CMAKE_CROSSCOMPILING)
+  ADD_EXECUTABLE (H5detect ${HDF5_SRC_DIR}/H5detect.c)
+  IF (WIN32)
+    TARGET_LINK_LIBRARIES (H5detect "ws2_32.lib")
+  ENDIF (WIN32)
+
+  EXPORT(TARGETS H5detect FILE ${EXPORT_EXECUTABLES_FILE} NAMESPACE "${EXPORT_EXECUTABLES_NAMESPACE}" APPEND)
+  IF(COMPILE_TOOLS_TARGET)
+    ADD_DEPENDENCIES(${COMPILE_TOOLS_TARGET} H5detect)
+  ENDIF(COMPILE_TOOLS_TARGET)
+ENDIF(NOT CMAKE_CROSSCOMPILING)
 
 ADD_CUSTOM_COMMAND (
     OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c
-    COMMAND ${CMD}
+    COMMAND H5detect
     ARGS > ${HDF5_BINARY_DIR}/H5Tinit.c
     DEPENDS H5detect
 )
 
-SET (CMDL ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${CFG_INIT}/H5make_libsettings${EXE_EXT})
-IF (XCODE)
-  SET (CMDL "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/\${CONFIGURATION}/H5make_libsettings")
-ENDIF (XCODE)
-ADD_EXECUTABLE (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c)
-IF (WIN32)
-  TARGET_LINK_LIBRARIES (H5make_libsettings "ws2_32.lib")
-ENDIF (WIN32)
+IF(NOT CMAKE_CROSSCOMPILING)
+  ADD_EXECUTABLE (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c)
+  IF (WIN32)
+    TARGET_LINK_LIBRARIES (H5make_libsettings "ws2_32.lib")
+  ENDIF (WIN32)
 
+  EXPORT(TARGETS H5make_libsettings FILE ${EXPORT_EXECUTABLES_FILE} NAMESPACE "${EXPORT_EXECUTABLES_NAMESPACE}" APPEND)
+  IF(COMPILE_TOOLS_TARGET)
+    ADD_DEPENDENCIES(${COMPILE_TOOLS_TARGET} H5make_libsettings)
+  ENDIF(COMPILE_TOOLS_TARGET)
+ENDIF(NOT CMAKE_CROSSCOMPILING)
+  
 ADD_CUSTOM_COMMAND (
     OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c
-    COMMAND ${CMDL}
+    COMMAND H5make_libsettings
     ARGS > ${HDF5_BINARY_DIR}/H5lib_settings.c
     DEPENDS H5make_libsettings
 )
 
--- VTK/CMakeLists.txt	2011-08-24 15:37:07.000000000 +0200
+++ VTK/CMakeLists.txt	2011-10-31 09:12:59.451958504 +0100
@@ -42,8 +42,13 @@
   FILE(WRITE "${EXPORT_EXECUTABLES_FILE}" "#generated by VTK, do not edit\n")
 ENDIF(NOT EXPORT_EXECUTABLES_FILE)
 
+# Add a target for building only the compile tools
+ADD_CUSTOM_TARGET(CompileTools)
+SET(COMPILE_TOOLS_TARGET "CompileTools")
+
 GET_PROPERTY(VTK_TARGET_SUPPORTS_SHARED_LIBS
   GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
+  
 
 # Warn when using "old style" CMake install commands... But only when
 # building VTK itself.
