summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDA.cmake
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-09-18 20:41:20 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-09-18 20:41:20 (GMT)
commit3dea63d04d683206cf05dc6d72cb5538222bfbc1 (patch)
tree31df33db56c848984cca67a8ea06b5a317bd6b31 /Modules/FindCUDA.cmake
parent21f5fc12ee4ca043838264962fc7608a97b8f35f (diff)
parentdb207e4065f4d1ecec9432cd4cc948f706bc973c (diff)
downloadCMake-3dea63d04d683206cf05dc6d72cb5538222bfbc1.zip
CMake-3dea63d04d683206cf05dc6d72cb5538222bfbc1.tar.gz
CMake-3dea63d04d683206cf05dc6d72cb5538222bfbc1.tar.bz2
Merge topic 'topics/FindCUDA/Add-CUDA_HOST_COMPILER'
db207e4 FindCUDA: Added CUDA_HOST_COMPILER variable.
Diffstat (limited to 'Modules/FindCUDA.cmake')
-rw-r--r--Modules/FindCUDA.cmake22
1 files changed, 17 insertions, 5 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 0a98bf5..5a834b1 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -68,6 +68,13 @@
# CUDA_HOST_COMPILATION_CPP (Default ON)
# -- Set to OFF for C compilation of host code.
#
+# CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER, $(VCInstallDir)/bin for VS)
+# -- Set the host compiler to be used by nvcc. Ignored if -ccbin or
+# --compiler-bindir is already present in the CUDA_NVCC_FLAGS or
+# CUDA_NVCC_FLAGS_<CONFIG> variables. For Visual Studio targets
+# $(VCInstallDir)/bin is a special value that expands out to the path when
+# the command is run from withing VS.
+#
# CUDA_NVCC_FLAGS
# CUDA_NVCC_FLAGS_<CONFIG>
# -- Additional NVCC command line arguments. NOTE: multiple arguments must be
@@ -390,6 +397,12 @@ option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON)
# Extra user settable flags
set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.")
+if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC")
+else()
+ set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC")
+endif()
+
# Propagate the host flags to the host compiler via -Xcompiler
option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" ON)
@@ -932,12 +945,11 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
endif()
# This needs to be passed in at this stage, because VS needs to fill out the
- # value of VCInstallDir from within VS.
+ # value of VCInstallDir from within VS. Note that CCBIN is only used if
+ # -ccbin or --compiler-bindir isn't used and CUDA_HOST_COMPILER matches
+ # $(VCInstallDir)/bin.
if(CMAKE_GENERATOR MATCHES "Visual Studio")
- if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
- # Add nvcc flag for 64b Windows
- set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" )
- endif()
+ set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" )
endif()
# Figure out which configure we will use and pass that in as an argument to