diff options
author | Brad King <brad.king@kitware.com> | 2018-09-20 13:35:39 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-09-20 13:35:45 (GMT) |
commit | 99648081085d8ec48a7846c918bee39a2bdde908 (patch) | |
tree | 5312266843a91b1a2b990d7509bb6dcd5e80eab5 /Modules/FindCUDA.cmake | |
parent | cc6e2b95d92d233c755c4649ba2d6914255a1e04 (diff) | |
parent | 8085799ce3a311e3f0f3c2f2119ae0dcb8b2e0a3 (diff) | |
download | CMake-99648081085d8ec48a7846c918bee39a2bdde908.zip CMake-99648081085d8ec48a7846c918bee39a2bdde908.tar.gz CMake-99648081085d8ec48a7846c918bee39a2bdde908.tar.bz2 |
Merge topic 'FindCUDA-ccbin-env'
8085799ce3 FindCUDA: Add option to set CUDA_HOST_COMPILER via environment
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2391
Diffstat (limited to 'Modules/FindCUDA.cmake')
-rw-r--r-- | Modules/FindCUDA.cmake | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 5547dee..3527979 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -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> @@ -527,7 +529,9 @@ 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(CMAKE_GENERATOR MATCHES "Visual Studio") +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) set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)bin") |