set(cmake_common_args
    -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
    -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
    -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
    -DLIB_SUFFIX:STRING=${LIB_SUFFIX}
    -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/INSTALL
)

ExternalProject_Add(
  vrpn
  GIT_REPOSITORY git://github.com/vrpn/vrpn
  CMAKE_ARGS
    ${cmake_common_args}
    -DVRPN_BUILD_CLIENTS:BOOL=OFF
    -DVRPN_BUILD_SERVERS:BOOL=OFF
    -DVRPN_BUILD_JAVA:BOOL=OFF
    -DVRPN_BUILD_PYTHON:BOOL=OFF
    -DVRPN_BUILD_PYTHON_HANDCODED_2X:BOOL=OFF
    -DVRPN_BUILD_PYTHON_HANDCODED_3X:BOOL=OFF
    -DVRPN_USE_HID:BOOL=OFF
    -DVRPN_USE_LIBUSB_1_0:BOOL=OFF
    -DVRPN_USE_DIRECTINPUT:BOOL=OFF
    -DVRPN_USE_STD_CHRONO:BOOL=ON
  INSTALL_DIR ${CMAKE_BINARY_DIR}/INSTALL
)

ExternalProject_Add (
  vr_latency_test
  SOURCE_DIR "${CMAKE_SOURCE_DIR}"
  CMAKE_ARGS
    ${cmake_common_args}
    -DUSE_SUPERBUILD:BOOL=OFF
    -DVRPN_ROOT_DIR=${CMAKE_BINARY_DIR}/INSTALL
  INSTALL_DIR ${CMAKE_BINARY_DIR}/INSTALL
  DEPENDS vrpn
)

