diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2016-09-04 20:29:44 (GMT) |
---|---|---|
committer | Robert Maynard <robert.maynard@kitware.com> | 2016-11-14 16:36:44 (GMT) |
commit | bbaf24341026cdacd1e313dd3f8e3501e9c4070e (patch) | |
tree | b88916748a529370a937b85c1b49b3da7887f310 /Modules/CMakeCUDAInformation.cmake | |
parent | a92f8d96162b9e6c29ad0bd81b8fd05b387d94a9 (diff) | |
download | CMake-bbaf24341026cdacd1e313dd3f8e3501e9c4070e.zip CMake-bbaf24341026cdacd1e313dd3f8e3501e9c4070e.tar.gz CMake-bbaf24341026cdacd1e313dd3f8e3501e9c4070e.tar.bz2 |
CUDA: add support for specifying an explicit host compiler.
Diffstat (limited to 'Modules/CMakeCUDAInformation.cmake')
-rw-r--r-- | Modules/CMakeCUDAInformation.cmake | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake index 41ed34f..858fee7 100644 --- a/Modules/CMakeCUDAInformation.cmake +++ b/Modules/CMakeCUDAInformation.cmake @@ -59,10 +59,16 @@ include(CMakeCommonLanguageInclude) # CMAKE_CUDA_COMPILE_OBJECT # CMAKE_CUDA_LINK_EXECUTABLE +if(CMAKE_CUDA_HOST_COMPILER) + set(CMAKE_CUDA_HOST_FLAGS "-ccbin \"${CMAKE_CUDA_HOST_COMPILER}\" ") +else() + set(CMAKE_CUDA_HOST_FLAGS "") +endif() + # create a shared library if(NOT CMAKE_CUDA_CREATE_SHARED_LIBRARY) set(CMAKE_CUDA_CREATE_SHARED_LIBRARY - "<CMAKE_CUDA_COMPILER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") endif() # create a shared module copy the shared library rule by default @@ -85,7 +91,7 @@ endif() # compile a cu file into an object file if(NOT CMAKE_CUDA_COMPILE_OBJECT) set(CMAKE_CUDA_COMPILE_OBJECT - "<CMAKE_CUDA_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x cu -c <SOURCE> -o <OBJECT>") + "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -c <SOURCE> -o <OBJECT>") #The Ninja generator uses the make file dependency files to determine what #files need to be recompiled. Unfortunately, nvcc doesn't support building @@ -96,7 +102,7 @@ if(NOT CMAKE_CUDA_COMPILE_OBJECT) #it is exempt from this logic. if(CMAKE_GENERATOR STREQUAL "Ninja") list(APPEND CMAKE_CUDA_COMPILE_OBJECT - "<CMAKE_CUDA_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x cu -M <SOURCE> -MT <OBJECT> -o $DEP_FILE") + "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -M <SOURCE> -MT <OBJECT> -o $DEP_FILE") endif() endif() @@ -104,7 +110,7 @@ endif() # compile a cu file into an executable if(NOT CMAKE_CUDA_LINK_EXECUTABLE) set(CMAKE_CUDA_LINK_EXECUTABLE - "<CMAKE_CUDA_COMPILER> <FLAGS> <CMAKE_CUDA_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <FLAGS> <CMAKE_CUDA_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") endif() |