summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCUDACompiler.cmake
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2016-09-04 20:29:44 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2016-11-14 16:36:44 (GMT)
commitbbaf24341026cdacd1e313dd3f8e3501e9c4070e (patch)
treeb88916748a529370a937b85c1b49b3da7887f310 /Modules/CMakeDetermineCUDACompiler.cmake
parenta92f8d96162b9e6c29ad0bd81b8fd05b387d94a9 (diff)
downloadCMake-bbaf24341026cdacd1e313dd3f8e3501e9c4070e.zip
CMake-bbaf24341026cdacd1e313dd3f8e3501e9c4070e.tar.gz
CMake-bbaf24341026cdacd1e313dd3f8e3501e9c4070e.tar.bz2
CUDA: add support for specifying an explicit host compiler.
Diffstat (limited to 'Modules/CMakeDetermineCUDACompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake13
1 files changed, 12 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index a6863ef..d5dc9f4 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -23,6 +23,10 @@ endif()
mark_as_advanced(CMAKE_CUDA_COMPILER)
+#Allow the user to specify a host compiler
+#todo: need to specify this to compiler test passes
+set(CMAKE_CUDA_HOST_COMPILER "" CACHE FILEPATH "Host compiler to be used by nvcc")
+
# Build a small source file to identify the compiler.
if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
set(CMAKE_CUDA_COMPILER_ID_RUN 1)
@@ -39,9 +43,16 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdCUDA/(\\./)?(CompilerIdCUDA.xctest/)?CompilerIdCUDA[ \t\n\\\"]")
set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_INDEX 2)
+ if(CMAKE_CUDA_HOST_COMPILER)
+ # Each entry in this list is a set of extra flags to try
+ # adding to the compile line to see if it helps produce
+ # a valid identification file. In our case this would just
+ # be the explicit host compiler
+ set(CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "-ccbin=${CMAKE_CUDA_HOST_COMPILER}")
+ endif()
+
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
CMAKE_DETERMINE_COMPILER_ID(CUDA CUDAFLAGS CMakeCUDACompilerId.cu)
-
endif()
include(CMakeFindBinUtils)