diff options
Diffstat (limited to 'aten/cmake')
-rw-r--r-- | aten/cmake/FindCUDA/FindCUDA.cmake | 5 | ||||
-rw-r--r-- | aten/cmake/FindCUDA/FindCUDA/select_compute_arch.cmake | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/aten/cmake/FindCUDA/FindCUDA.cmake b/aten/cmake/FindCUDA/FindCUDA.cmake index e836a6eaed..3990d67002 100644 --- a/aten/cmake/FindCUDA/FindCUDA.cmake +++ b/aten/cmake/FindCUDA/FindCUDA.cmake @@ -487,8 +487,9 @@ option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON) # Extra user settable flags set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.") -if(CMAKE_GENERATOR MATCHES "Visual Studio") - set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC") +if(MSVC AND NOT "${CMAKE_C_COMPILER}" MATCHES "/cl.exe") + find_program(REAL_MSVC_COMPILER cl.exe) + set(CUDA_HOST_COMPILER "${REAL_MSVC_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC") else() if(APPLE AND "${CMAKE_C_COMPILER_ID}" MATCHES "Clang" diff --git a/aten/cmake/FindCUDA/FindCUDA/select_compute_arch.cmake b/aten/cmake/FindCUDA/FindCUDA/select_compute_arch.cmake index 4b274418aa..5e79cdb144 100644 --- a/aten/cmake/FindCUDA/FindCUDA/select_compute_arch.cmake +++ b/aten/cmake/FindCUDA/FindCUDA/select_compute_arch.cmake @@ -62,8 +62,15 @@ function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE) " return 0;\n" "}\n") + if(MSVC AND NOT "${CMAKE_C_COMPILER}" MATCHES "/cl.exe") + find_program(REAL_MSVC_COMPILER cl.exe) + set(CCBIN "${REAL_MSVC_COMPILER}") + else() + set(CCBIN "${CMAKE_C_COMPILER}") + endif() + execute_process(COMMAND "${CUDA_NVCC_EXECUTABLE}" "--run" "${cufile}" - "-ccbin" ${CMAKE_CXX_COMPILER} + "-ccbin" ${CCBIN} WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles/" RESULT_VARIABLE nvcc_res OUTPUT_VARIABLE nvcc_out ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) |