mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-01 12:18:36 -06:00
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
This commit is contained in:
@@ -7,3 +7,7 @@ determine ``CUDA`` host compiler, after which the value for ``CUDAHOSTCXX`` is
|
||||
stored in the cache as :variable:`CMAKE_CUDA_HOST_COMPILER`. For any
|
||||
configuration run (including the first), the environment variable will be
|
||||
ignored if the :variable:`CMAKE_CUDA_HOST_COMPILER` variable is defined.
|
||||
|
||||
This environment variable is primarily meant for use with projects that
|
||||
enable ``CUDA`` as a first-class language. The :module:`FindCUDA`
|
||||
module will also use it to initialize its ``CUDA_HOST_COMPILER`` setting.
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user