summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDA
diff options
context:
space:
mode:
authorJames Bigler <jamesbigler@gmail.com>2012-08-20 21:14:37 (GMT)
committerJames Bigler <jamesbigler@gmail.com>2012-08-20 21:14:37 (GMT)
commitdb207e4065f4d1ecec9432cd4cc948f706bc973c (patch)
tree4b7e016a60627c6c7538d4f0de538777e555d070 /Modules/FindCUDA
parent4889188f670ae9e836a5f7a58928227e836d3292 (diff)
downloadCMake-db207e4065f4d1ecec9432cd4cc948f706bc973c.zip
CMake-db207e4065f4d1ecec9432cd4cc948f706bc973c.tar.gz
CMake-db207e4065f4d1ecec9432cd4cc948f706bc973c.tar.bz2
FindCUDA: Added CUDA_HOST_COMPILER variable.
Added a new CUDA variable for specifying the CUDA_HOST_COMPILER. This will allow users to be able to specify which host compiler to use for invoking NVCC with. By default it will use the compiler used for host compilation. This is convenient for when you want to specify a different compiler than the default compiler. You end up using the same compiler for both the NVCC compilation and the host compilation instead of using the default compiler in the path for NVCC.
Diffstat (limited to 'Modules/FindCUDA')
-rw-r--r--Modules/FindCUDA/run_nvcc.cmake12
1 files changed, 10 insertions, 2 deletions
diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake
index b31011c..381246d 100644
--- a/Modules/FindCUDA/run_nvcc.cmake
+++ b/Modules/FindCUDA/run_nvcc.cmake
@@ -62,6 +62,7 @@ set(cmake_dependency_file "@cmake_dependency_file@") # path
set(CUDA_make2cmake "@CUDA_make2cmake@") # path
set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path
set(build_cubin @build_cubin@) # bool
+set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # bool
# We won't actually use these variables for now, but we need to set this, in
# order to force this file to be run again if it changes.
set(generated_file_path "@generated_file_path@") # path
@@ -102,8 +103,15 @@ endif()
# Add the build specific configuration flags
list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
-if(DEFINED CCBIN)
- set(CCBIN -ccbin "${CCBIN}")
+# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority
+list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 )
+list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 )
+if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 )
+ if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN)
+ set(CCBIN -ccbin "${CCBIN}")
+ else()
+ set(CCBIN -ccbin "${CUDA_HOST_COMPILER}")
+ endif()
endif()
# cuda_execute_process - Executes a command with optional command echo and status message.