# First set all things which don't depend on the specific operating system
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
    set(XBUILD_PLATFORM_BITS64 ON)
else()
    set(XBUILD_PLATFORM_BITS32 ON)
endif()

set(CMAKE_CONFIGURATION_TYPES "Debug;Optimized;Release" CACHE STRING "" FORCE)

# Then include operating system specific CMake module, so it can make use of
# os-independent variables.
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
    set(XBUILD_PLATFORM_LINUX ON)
    include($ENV{XBUILDROOT}/cmake/xbuild-platform-linux.cmake)
elseif(ANDROID)
    set(XBUILD_PLATFORM_ANDROID ON)
    include($ENV{XBUILDROOT}/cmake/xbuild-platform-android.cmake)
elseif(APPLE)
    if(IOS)
        set(XBUILD_PLATFORM_IOS ON)
        include($ENV{XBUILDROOT}/cmake/xbuild-platform-ios.cmake)
    else()
        set(XBUILD_PLATFORM_MACOS ON)
        include($ENV{XBUILDROOT}/cmake/xbuild-platform-macos.cmake)
    endif()
elseif(WIN32)
    set(XBUILD_PLATFORM_WIN32 ON)
    include($ENV{XBUILDROOT}/cmake/xbuild-platform-windows.cmake)
else()
    message(FATAL_ERROR "Unsupported platform.")
endif()
