1# - Find DirectInput
2# Find the DirectInput includes and libraries
3#
4#  DINPUT_INCLUDE_DIR - where to find dinput.h
5#  DINPUT_LIBRARIES   - List of libraries when using dinput.
6#  DINPUT_FOUND       - True if dinput found.
7
8if(DINPUT_INCLUDE_DIR)
9    # Already in cache, be silent
10    set(DINPUT_FIND_QUIETLY TRUE)
11endif(DINPUT_INCLUDE_DIR)
12
13# Makes my life easier.
14if(MSVC)
15    set(HINT_INCLUDE "C:/Program Files/Microsoft DirectX SDK (August 2008)/Include")
16    set(HINT_LIB "C:/Program Files/Microsoft DirectX SDK (August 2008)/Lib")
17endif(MSVC)
18
19find_path(DINPUT_INCLUDE_DIR dinput.h
20    PATH ${HINT_INCLUDE}
21    )
22
23find_library(DINPUT_LIBRARY
24    NAMES dinput dinput8
25    PATHS ${HINT_LIB}
26    PATH_SUFFIXES x86 x64
27    )
28
29# Handle the QUIETLY and REQUIRED arguments and set DINPUT_FOUND to TRUE if
30# all listed variables are TRUE.
31include(FindPackageHandleStandardArgs)
32find_package_handle_standard_args(DINPUT DEFAULT_MSG
33    DINPUT_INCLUDE_DIR DINPUT_LIBRARY)
34
35if(DINPUT_FOUND)
36    set(DINPUT_LIBRARIES ${DINPUT_LIBRARY})
37else(DINPUT_FOUND)
38    set(DINPUT_LIBRARIES)
39endif(DINPUT_FOUND)
40
41mark_as_advanced(DINPUT_INCLUDE_DIR DINPUT_LIBRARY)
42