Added define to fix issue with compatibility with latest Windows SDK (#85408)

Fixes #83820.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/85408
Approved by: https://github.com/ezyang
This commit is contained in:
Vladimír Aubrecht 2022-10-12 15:44:28 +00:00 committed by PyTorch MergeBot
parent f24d174fff
commit 409efebab8

View File

@ -92,6 +92,10 @@ endif()
if(MSVC)
# skip unwanted includes from windows.h
add_definitions(-DWIN32_LEAN_AND_MEAN)
# Windows SDK broke compatibility since version 25131, but introduced this define for backward compatibility.
add_definitions(-D_UCRT_LEGACY_INFINITY)
foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL)