# - Find DirectX SDK installation | |
# Find the DirectX includes and library | |
# This module defines | |
# DirectX_INCLUDE_DIRS, where to find d3d9.h, etc. | |
# DirectX_LIBRARIES, libraries to link against to use DirectX. | |
# DirectX_FOUND, If false, do not try to use DirectX. | |
# DirectX_ROOT_DIR, directory where DirectX was installed. | |
FIND_PATH(DirectX_INCLUDE_DIRS d3d9.h PATHS | |
"$ENV{DXSDK_DIR}/Include" | |
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK*/Include" | |
) | |
GET_FILENAME_COMPONENT(DirectX_ROOT_DIR "${DirectX_INCLUDE_DIRS}/.." ABSOLUTE) | |
IF (CMAKE_CL_64) | |
SET(DirectX_LIBRARY_PATHS "${DirectX_ROOT_DIR}/Lib/x64") | |
ELSE () | |
SET(DirectX_LIBRARY_PATHS "${DirectX_ROOT_DIR}/Lib/x86" "${DirectX_ROOT_DIR}/Lib") | |
ENDIF () | |
FIND_LIBRARY(DirectX_D3D9_LIBRARY d3d9 ${DirectX_LIBRARY_PATHS} NO_DEFAULT_PATH) | |
FIND_LIBRARY(DirectX_D3DX9_LIBRARY d3dx9 ${DirectX_LIBRARY_PATHS} NO_DEFAULT_PATH) | |
SET(DirectX_LIBRARIES ${DirectX_D3D9_LIBRARY} ${DirectX_D3DX9_LIBRARY}) | |
# handle the QUIETLY and REQUIRED arguments and set DirectX_FOUND to TRUE if all listed variables are TRUE | |
INCLUDE(FindPackageHandleStandardArgs) | |
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectX DEFAULT_MSG DirectX_ROOT_DIR DirectX_LIBRARIES DirectX_INCLUDE_DIRS) | |
MARK_AS_ADVANCED(DirectX_INCLUDE_DIRS DirectX_D3D9_LIBRARY DirectX_D3DX9_LIBRARY) |