Merge pull request #17671 from tomoaki0705:fixCUDANativeDetection

pull/17679/head
Alexander Alekhin 4 years ago
commit c62e63909a
  1. 9
      cmake/OpenCVDetectCUDA.cmake

@ -8,7 +8,10 @@ if(NOT UNIX AND CV_CLANG)
return() return()
endif() endif()
if(CUDA_HOST_COMPILER)
# respect the CUDA_HOST_COMPILER if specified manually
set(PREFERRED_CUDA_HOST_COMPILER "${CUDA_HOST_COMPILER}")
endif()
if(((NOT CMAKE_VERSION VERSION_LESS "3.9.0") # requires https://gitlab.kitware.com/cmake/cmake/merge_requests/663 if(((NOT CMAKE_VERSION VERSION_LESS "3.9.0") # requires https://gitlab.kitware.com/cmake/cmake/merge_requests/663
OR OPENCV_CUDA_FORCE_EXTERNAL_CMAKE_MODULE) OR OPENCV_CUDA_FORCE_EXTERNAL_CMAKE_MODULE)
AND NOT OPENCV_CUDA_FORCE_BUILTIN_CMAKE_MODULE) AND NOT OPENCV_CUDA_FORCE_BUILTIN_CMAKE_MODULE)
@ -107,8 +110,8 @@ if(CUDA_FOUND)
unset(CUDA_ARCH_PTX CACHE) unset(CUDA_ARCH_PTX CACHE)
endif() endif()
if(CUDA_HOST_COMPILER) if(PREFERRED_CUDA_HOST_COMPILER)
LIST(APPEND CUDA_NVCC_FLAGS -ccbin ${CUDA_HOST_COMPILER}) LIST(APPEND CUDA_NVCC_FLAGS -ccbin "${PREFERRED_CUDA_HOST_COMPILER}")
else() else()
if(WIN32 AND CMAKE_LINKER) #Workaround for VS cl.exe not being in the env. path if(WIN32 AND CMAKE_LINKER) #Workaround for VS cl.exe not being in the env. path
get_filename_component(host_compiler_bindir ${CMAKE_LINKER} DIRECTORY) get_filename_component(host_compiler_bindir ${CMAKE_LINKER} DIRECTORY)

Loading…
Cancel
Save