Browse Source

Don't allow -G -M on CUDA versions less than 3.0.

James Bigler 16 năm trước cách đây
mục cha
commit
c9235c0159
1 tập tin đã thay đổi với 15 bổ sung1 xóa
  1. 15 1
      Modules/FindCUDA/run_nvcc.cmake

+ 15 - 1
Modules/FindCUDA/run_nvcc.cmake

@@ -150,12 +150,26 @@ cuda_execute_process(
   COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
   )
 
+# For CUDA 2.3 and below, -G -M doesn't work, so remove the -G flag
+# for dependency generation and hope for the best.
+set(depends_CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}")
+set(CUDA_VERSION @CUDA_VERSION@)
+if(CUDA_VERSION VERSION_LESS "3.0")
+  cmake_policy(PUSH)
+  # CMake policy 0007 NEW states that empty list elements are not
+  # ignored.  I'm just setting it to avoid the warning that's printed.
+  cmake_policy(SET CMP0007 NEW)
+  # Note that this will remove all occurances of -G.
+  list(REMOVE_ITEM depends_CUDA_NVCC_FLAGS "-G")
+  cmake_policy(POP)
+endif()
+
 # Generate the dependency file
 cuda_execute_process(
   "Generating dependency file: ${NVCC_generated_dependency_file}"
   COMMAND "${CUDA_NVCC_EXECUTABLE}"
   "${source_file}"
-  ${CUDA_NVCC_FLAGS}
+  ${depends_CUDA_NVCC_FLAGS}
   ${nvcc_flags}
   ${CCBIN}
   ${nvcc_host_compiler_flags}