macro(check_system_bits)

    IF(APPLE)
        SET(HGL_BITS 64)
    ELSE()
        IF(ANDROID)
            if(ANDROID_ABI MATCHES ".*64.*")
                SET(HGL_BITS 64)
            else()
                SET(HGL_BITS 32)
            endif()
        ELSE()
            IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
                SET(HGL_BITS 64)
            ELSE()
                SET(HGL_BITS 32)
            ENDIF()
        endif()
    endif()

    IF(HGL_BITS EQUAL 32)
        add_definitions(-DHGL_32_BITS)
        add_definitions(-DHGL_POINTER_UINT=uint32)
    ELSE()
        add_definitions(-DHGL_64_BITS)
        add_definitions(-DHGL_POINTER_UINT=uint64)
    ENDIF()

    Message("System is ${HGL_BITS} Bit")

endmacro()
