From 7ca34877749fb03f086acf73f4a9b7429ad41f39 Mon Sep 17 00:00:00 2001 From: "Randolph R. Settgast" Date: Fri, 12 Oct 2018 15:24:51 -0700 Subject: [PATCH 1/2] added commands to set CMAKE_CUDA_HOST_COMPILER in SetupCUDA.cmake file --- cmake/thirdparty/SetupCUDA.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/thirdparty/SetupCUDA.cmake b/cmake/thirdparty/SetupCUDA.cmake index 199e7a5d6..0457704b4 100644 --- a/cmake/thirdparty/SetupCUDA.cmake +++ b/cmake/thirdparty/SetupCUDA.cmake @@ -45,8 +45,19 @@ ################################ set (CMAKE_MODULE_PATH "${BLT_ROOT_DIR}/cmake/thirdparty;${CMAKE_MODULE_PATH}") + +if ( NOT CMAKE_CUDA_HOST_COMPILER ) + if ( CMAKE_CXX_COMPILER ) + set ( CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING "" FORCE) + else () + set ( CMAKE_CUDA_HOST_COMPILER ${CMAKE_C_COMPILER} CACHE BOOL "" FORCE) + endif () +endif () + + enable_language(CUDA) + ############################################################ # Map Legacy FindCUDA variables to native cmake variables ############################################################ From 3695393f8ef89c0c502dd21dcc4895d642d142b0 Mon Sep 17 00:00:00 2001 From: "Randolph R. Settgast" Date: Mon, 15 Oct 2018 13:24:14 -0700 Subject: [PATCH 2/2] added version check for use of CMAKE_CUDA_HOST_COMPILER and added output message stating value of CMAKE_CUDA_HOST_COMPILER --- cmake/thirdparty/SetupCUDA.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/thirdparty/SetupCUDA.cmake b/cmake/thirdparty/SetupCUDA.cmake index 0457704b4..d3fb0b03d 100644 --- a/cmake/thirdparty/SetupCUDA.cmake +++ b/cmake/thirdparty/SetupCUDA.cmake @@ -46,12 +46,15 @@ set (CMAKE_MODULE_PATH "${BLT_ROOT_DIR}/cmake/thirdparty;${CMAKE_MODULE_PATH}") -if ( NOT CMAKE_CUDA_HOST_COMPILER ) +if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.9.0" ) + if ( NOT CMAKE_CUDA_HOST_COMPILER ) if ( CMAKE_CXX_COMPILER ) - set ( CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING "" FORCE) + set ( CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING "" FORCE) else () - set ( CMAKE_CUDA_HOST_COMPILER ${CMAKE_C_COMPILER} CACHE BOOL "" FORCE) + set ( CMAKE_CUDA_HOST_COMPILER ${CMAKE_C_COMPILER} CACHE STRING "" FORCE) endif () + endif () + message(STATUS "CMAKE_CUDA_HOST_COMPILER: ${CMAKE_CUDA_HOST_COMPILER}") endif ()