set(DOC_STRING "Enable 3Dconnexion SpaceMouse support (currently Windows on Visual Studio only)")
option(BESPOKE_SPACEMOUSE_SUPPORT "${DOC_STRING}" ${MSVC})

if(BESPOKE_SPACEMOUSE_SUPPORT AND NOT MSVC)
    message(WARNING "Not on Visual Studio, disabling 3Dconnexion SpaceMouse support")
    set(BESPOKE_SPACEMOUSE_SUPPORT OFF CACHE BOOL "${DOC_STRING}" FORCE)
endif()

if(BESPOKE_SPACEMOUSE_SUPPORT)
    message(STATUS "3Dconnexion SpaceMouse support enabled")
    add_library(3dxware STATIC IMPORTED GLOBAL)
    if (${CMAKE_SIZEOF_VOID_P} EQUAL 4)
        set_property(TARGET 3dxware PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/windows/x86/siapp.lib")
    else()
        set_property(TARGET 3dxware PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/windows/x64/siapp.lib")
    endif()
    target_include_directories(3dxware INTERFACE include)
else()
    message(STATUS "3Dconnexion SpaceMouse support disabled")
    add_library(3dxware INTERFACE)
endif()
target_compile_definitions(3dxware INTERFACE BESPOKE_SPACEMOUSE_SUPPORT=$<BOOL:${BESPOKE_SPACEMOUSE_SUPPORT}>)
add_library(bespoke::3dxware ALIAS 3dxware)
