IF(APPLE)
  IF(CMAKE_COMPILER_IS_GNUCC)
    INCLUDE(GET_GCC_VERSION)
  ENDIF(CMAKE_COMPILER_IS_GNUCC)
  # only adjust sysroot if not cross compiling
  IF(NOT REDIRECT_INIT)
   #  IF(NOT CMAKE_FIND_ROOT_PATH)  
   #       # switch off by default
   #       OPTION(DOUNIVERSAL "configure for cross compilation producing universal" OFF )
   #       IF(CMAKE_OSX_SYSROOT AND DOUNIVERSAL)
   #         IF(_CMAKE_OSX_MACHINE)
   #           IF("${_CMAKE_OSX_MACHINE}" STREQUAL "ppc")
   #             SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
   #           ELSE("${_CMAKE_OSX_MACHINE}" STREQUAL "ppc")
   #             SET(CMAKE_OSX_ARCHITECTURES "i386;ppc" CACHE STRING "Build architectures for OSX" FORCE)
   #           ENDIF("${_CMAKE_OSX_MACHINE}" STREQUAL "ppc")
   #         ELSE(_CMAKE_OSX_MACHINE)
   #           SET( CMAKE_OSX_ARCHITECTURES  "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
   #         ENDIF(_CMAKE_OSX_MACHINE)
   #       ELSE(CMAKE_OSX_SYSROOT AND DOUNIVERSAL)
   #         IF(DOUNIVERSAL)
   #           MESSAGE(FATAL_ERROR "Universal binaries can only created if the SDK MacOSX10.4u.sdk is installed")
   #         ENDIF(DOUNIVERSAL)
   #         IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk )
   #           IF(NOT "$ENV{CMAKE_OSX_SYSROOT}" STREQUAL "") 
   #             SET(SYSROOT "$ENV{CMAKE_OSX_SYSROOT}")
   #           ELSE(NOT "$ENV{CMAKE_OSX_SYSROOT}" STREQUAL "") 
   #             SET(SYSROOT MacOSX10.4u.sdk)          
   #           ENDIF(NOT "$ENV{CMAKE_OSX_SYSROOT}" STREQUAL "") 
   #           SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/${SYSROOT}" CACHE STRING  "isysroot used for universal binary support" FORCE)
   #           SET(MACOSX_DEPLOYMENT_TARGET 10.4 CACHE STRING "min macosx version to run on")
   #         ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk )          
   #       ENDIF(CMAKE_OSX_SYSROOT AND DOUNIVERSAL)
   
   #       IF(MACOSX_DEPLOYMENT_TARGET)
   #         IF(GCCVERSIONMAJ GREATER 3)
   #           ADD_DEFINITIONS (-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET})
   #           # compiler flags not given with ADD_DEFINITIONS will be used on the link command line
   #           SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}")
   #           SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}")          
   #         ENDIF(GCCVERSIONMAJ GREATER 3)
   #       ENDIF(MACOSX_DEPLOYMENT_TARGET)
   #     ENDIF(NOT CMAKE_FIND_ROOT_PATH) 
   SET(REDIRECT_INIT ON)
  ENDIF(NOT REDIRECT_INIT)
ENDIF(APPLE)

