diff options
author | José Fonseca <jfonseca@vmware.com> | 2014-06-23 18:25:55 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2014-06-23 18:25:55 +0100 |
commit | 070a063d1e95640198fd50dd1ff76ad0634d1191 (patch) | |
tree | 3eb9485ebfa9d891cb972e06c2407e95308511d1 /cmake | |
parent | 317a36037daebed9c52eef84c13460d34e0d4445 (diff) |
cmake: Fix build with Visual Studio toolchain for XP.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindDirectX.cmake | 70 |
1 files changed, 49 insertions, 21 deletions
diff --git a/cmake/FindDirectX.cmake b/cmake/FindDirectX.cmake index fd23d6db..60100df8 100644 --- a/cmake/FindDirectX.cmake +++ b/cmake/FindDirectX.cmake @@ -18,29 +18,57 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") # - http://msdn.microsoft.com/en-us/library/windows/desktop/ee663275.aspx # TODO: Allow using DirectX SDK with VS 2011 if (DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700) - find_path (WIN8_SDK_ROOT_DIR - Include/um/windows.h - PATHS - "$ENV{ProgramFiles(x86)}/Windows Kits/8.1" - "$ENV{ProgramFiles}/Windows Kits/8.1" - "$ENV{ProgramFiles(x86)}/Windows Kits/8.0" - "$ENV{ProgramFiles}/Windows Kits/8.0" - DOC "Windows 8 SDK root directory" - ) - - if (WIN8_SDK_ROOT_DIR) - # We don't add the include search paths, as VS predefines the - # Windows SDK include paths, and we can get into errors errors if - # we happen to add wrong Windows SDK - set (DirectX_INC_SEARCH_PATH - "${WIN8_SDK_ROOT_DIR}/Include/um" - "${WIN8_SDK_ROOT_DIR}/Include/shared" + # XXX: Do this in such way that that we don't need to guess the Windows + # SDK path. + if (CMAKE_GENERATOR_TOOLSET MATCHES "_xp$") + # http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx + find_path (WIN7_SDK_ROOT_DIR + Include/windows.h + PATHS + "$ENV{ProgramFiles(x86)}/Microsoft SDKs/Windows/v7.1A" + "$ENV{ProgramFiles}/Microsoft SDKs/Windows/v7.1A" + DOC "Windows 7 SDK root directory" ) - set (DirectX_LIB_SEARCH_PATH - "${WIN8_SDK_ROOT_DIR}/Lib/winv6.3/um/${DirectX_ARCHITECTURE}" - "${WIN8_SDK_ROOT_DIR}/Lib/Win8/um/${DirectX_ARCHITECTURE}" + + if (WIN7_SDK_ROOT_DIR) + # We don't add the include search paths, as VS predefines the + # Windows SDK include paths, and we can get into errors errors if + # we happen to add wrong Windows SDK + set (DirectX_INC_SEARCH_PATH + "${WIN7_SDK_ROOT_DIR}/Include" + ) + if (DirectX_ARCHITECTURE STREQUAL x86) + set (DirectX_LIB_SEARCH_PATH "${WIN7_SDK_ROOT_DIR}/Lib") + else () + set (DirectX_LIB_SEARCH_PATH "${WIN7_SDK_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}") + endif () + set (DirectX_BIN_SEARCH_PATH "${WIN7_SDK_ROOT_DIR}/bin") + endif () + else () + find_path (WIN8_SDK_ROOT_DIR + Include/um/windows.h + PATHS + "$ENV{ProgramFiles(x86)}/Windows Kits/8.1" + "$ENV{ProgramFiles}/Windows Kits/8.1" + "$ENV{ProgramFiles(x86)}/Windows Kits/8.0" + "$ENV{ProgramFiles}/Windows Kits/8.0" + DOC "Windows 8 SDK root directory" ) - set (DirectX_BIN_SEARCH_PATH "${WIN8_SDK_ROOT_DIR}/bin/x86") + + if (WIN8_SDK_ROOT_DIR) + # We don't add the include search paths, as VS predefines the + # Windows SDK include paths, and we can get into errors errors if + # we happen to add wrong Windows SDK + set (DirectX_INC_SEARCH_PATH + "${WIN8_SDK_ROOT_DIR}/Include/um" + "${WIN8_SDK_ROOT_DIR}/Include/shared" + ) + set (DirectX_LIB_SEARCH_PATH + "${WIN8_SDK_ROOT_DIR}/Lib/winv6.3/um/${DirectX_ARCHITECTURE}" + "${WIN8_SDK_ROOT_DIR}/Lib/Win8/um/${DirectX_ARCHITECTURE}" + ) + set (DirectX_BIN_SEARCH_PATH "${WIN8_SDK_ROOT_DIR}/bin/x86") + endif () endif () else () find_path (DirectX_ROOT_DIR |