summaryrefslogtreecommitdiff
path: root/Modules/FindCUDA
diff options
context:
space:
mode:
authorAdam Strzelecki <ono@java.pl>2014-06-12 19:46:50 +0200
committerRobert Maynard <robert.maynard@kitware.com>2014-06-30 11:23:36 -0400
commit32bcec5fab8a92590bfc2efafe29f2403bbab4dd (patch)
tree5fe48a79838c8f00fbd64816ed2d0539b1011b39 /Modules/FindCUDA
parentbf5fc1d5829e7995c0941996b4a515cbd46d4e4e (diff)
downloadcmake-32bcec5fab8a92590bfc2efafe29f2403bbab4dd.tar.gz
FindCUDA: Fix OSX Clang & no C language enabled
When setting default CUDA_HOST_COMPILER we must dereference CMAKE_C_COMPILER, i.e. /usr/bin/clang should be used instead /usr/bin/cc which is symlink. Otherwise CUDA thinks it is GCC and issues -dumpspecs which is unknown option to Clang. Also in case neither CMAKE_C_COMPILER is defined (project does not use C language) nor CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let nvcc use its own default C compiler.
Diffstat (limited to 'Modules/FindCUDA')
-rw-r--r--Modules/FindCUDA/run_nvcc.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake
index f0aac8487a..58e0d312bd 100644
--- a/Modules/FindCUDA/run_nvcc.cmake
+++ b/Modules/FindCUDA/run_nvcc.cmake
@@ -62,7 +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
+set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # path
# 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
@@ -106,7 +106,7 @@ list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
# 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( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN)
set(CCBIN -ccbin "${CCBIN}")
else()