Skip to content

Commit

Permalink
cmake(cuda): update handling of -std=c++11/14 flags
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek committed Jun 28, 2020
1 parent 206c843 commit 98ad7d0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmake/OpenCVDetectCUDA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,14 @@ if(CUDA_FOUND)
endif()

if(UNIX OR APPLE)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC --std=c++11)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC)
if(NOT " ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_DEBUG} ${CUDA_NVCC_FLAGS}" MATCHES "-std=")
if(CUDA_VERSION VERSION_LESS "11.0")
list(APPEND CUDA_NVCC_FLAGS "--std=c++11")
else()
list(APPEND CUDA_NVCC_FLAGS "--std=c++14")
endif()
endif()
endif()
if(APPLE)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fno-finite-math-only)
Expand Down

0 comments on commit 98ad7d0

Please sign in to comment.