From 6b8657531d16e16a40aa13992842875ec8b28fd3 Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Fri, 11 Jan 2019 11:01:45 -0800 Subject: [PATCH] Enable detection of Win10 SDK from environment variable instead of registry (#1832) Fix typo --- cmake/modules/FindD3D12.cmake | 14 +++++++++----- cmake/modules/FindDiaSDK.cmake | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cmake/modules/FindD3D12.cmake b/cmake/modules/FindD3D12.cmake index cfee95ca3..01e7a3ae9 100644 --- a/cmake/modules/FindD3D12.cmake +++ b/cmake/modules/FindD3D12.cmake @@ -1,13 +1,17 @@ # Find the win10 SDK path. -get_filename_component(WIN10_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]" ABSOLUTE CACHE) -get_filename_component(TEMP_WIN10_SDK_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;ProductVersion]" ABSOLUTE CACHE) - -get_filename_component(WIN10_SDK_VERSION ${TEMP_WIN10_SDK_VERSION} NAME) +if ("$ENV{WIN10_SDK_PATH}$ENV{WIN10_SDK_VERSION}" STREQUAL "" ) + get_filename_component(WIN10_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]" ABSOLUTE CACHE) + get_filename_component(TEMP_WIN10_SDK_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;ProductVersion]" ABSOLUTE CACHE) + get_filename_component(WIN10_SDK_VERSION ${TEMP_WIN10_SDK_VERSION} NAME) +elseif(TRUE) + set (WIN10_SDK_PATH $ENV{WIN10_SDK_PATH}) + set (WIN10_SDK_VERSION $ENV{WIN10_SDK_VERSION}) +endif ("$ENV{WIN10_SDK_PATH}$ENV{WIN10_SDK_VERSION}" STREQUAL "" ) # WIN10_SDK_PATH will be something like C:\Program Files (x86)\Windows Kits\10 - # WIN10_SDK_VERSION will be something like 10.0.14393 or 10.0.14393.0; we need the # one that matches the directory name. + if (IS_DIRECTORY "${WIN10_SDK_PATH}/Include/${WIN10_SDK_VERSION}.0") set(WIN10_SDK_VERSION "${WIN10_SDK_VERSION}.0") endif (IS_DIRECTORY "${WIN10_SDK_PATH}/Include/${WIN10_SDK_VERSION}.0") diff --git a/cmake/modules/FindDiaSDK.cmake b/cmake/modules/FindDiaSDK.cmake index f55373a77..f11e5117f 100644 --- a/cmake/modules/FindDiaSDK.cmake +++ b/cmake/modules/FindDiaSDK.cmake @@ -9,7 +9,7 @@ get_filename_component(VS15_C_PATH32 "$ENV{${PROGRAMFILES_X86}}/Microsoft Visual get_filename_component(VS15_P_PATH32 "$ENV{${PROGRAMFILES_X86}}/Microsoft Visual Studio/2017/Professional/Common7/IDE" ABSOLUTE CACHE) get_filename_component(VS15_E_PATH32 "$ENV{${PROGRAMFILES_X86}}/Microsoft Visual Studio/2017/Enterprise/Common7/IDE" ABSOLUTE CACHE) -# Find the TAEF path, it will typically look something like this. +# Find the DIA SDK path, it will typically look something like this. # C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\DIA SDK\include # C:\Program Files (x86)\Microsoft Visual Studio 14.0\DIA SDK\include\dia2.h find_path(DIASDK_INCLUDE_DIR # Set variable DIASDK_INCLUDE_DIR