Sync FindCUDA.cmake with upstream cmake repo (#11880)

Summary:
Upstream PR: https://gitlab.kitware.com/cmake/cmake/merge_requests/2391/diffs
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11880

Differential Revision: D9989119

Pulled By: soumith

fbshipit-source-id: 66e87367127975a5f1619fe447f74e76f101b503
This commit is contained in:
peter
2018-09-21 06:55:59 -07:00
committed by Facebook Github Bot
parent 58d28a5f12
commit a7afd133f5
2 changed files with 5 additions and 3 deletions

View File

@ -202,7 +202,7 @@ REM The following two lines are needed for Python 2.7, but the support for it is
set MSSdk=1
set FORCE_PY27_BUILD=1
REM As for CUDA 8, VS2015 Update 3 is also required to build PyTorch. Use the following line.
set "CUDA_HOST_COMPILER=%VS140COMNTOOLS%\..\..\VC\bin\amd64\cl.exe"
set "CUDAHOSTCXX=%VS140COMNTOOLS%\..\..\VC\bin\amd64\cl.exe"
call "%VS150COMNTOOLS%\vcvarsall.bat" x64 -vcvars_ver=14.11
python setup.py install

View File

@ -105,6 +105,8 @@
# the host compiler is constructed with one or more visual studio macros
# such as $(VCInstallDir), that expands out to the path when
# the command is run from within VS.
# If the CUDAHOSTCXX environment variable is set it will
# be used as the default.
#
# CUDA_NVCC_FLAGS
# CUDA_NVCC_FLAGS_<CONFIG>
@ -531,8 +533,8 @@ option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON)
# Extra user settable flags
cmake_initialize_per_config_variable(CUDA_NVCC_FLAGS "Semi-colon delimit multiple arguments.")
if(DEFINED ENV{CUDA_HOST_COMPILER})
set(CUDA_HOST_COMPILER "$ENV{CUDA_HOST_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC")
if(DEFINED ENV{CUDAHOSTCXX})
set(CUDA_HOST_COMPILER "$ENV{CUDAHOSTCXX}" CACHE FILEPATH "Host side compiler used by NVCC")
elseif(CMAKE_GENERATOR MATCHES "Visual Studio")
set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)")
if(MSVC_VERSION LESS 1910)