Quellcode durchsuchen

Merge topic 'topics/FindCUDA/FixCUDAInUNCPath'

83d4eea Add work around for CUDA in UNC paths.
David Cole vor 14 Jahren
Ursprung
Commit
de9dc82779
1 geänderte Dateien mit 16 neuen und 2 gelöschten Zeilen
  1. 16 2
      Modules/FindCUDA/make2cmake.cmake

+ 16 - 2
Modules/FindCUDA/make2cmake.cmake

@@ -54,13 +54,27 @@ if (${depend_text} MATCHES ".+")
 
     string(REGEX REPLACE "^ +" "" file ${file})
 
-    if(NOT IS_DIRECTORY ${file})
+    # OK, now if we had a UNC path, nvcc has a tendency to only output the first '/'
+    # instead of '//'.  Here we will test to see if the file exists, if it doesn't then
+    # try to prepend another '/' to the path and test again.  If it still fails remove the
+    # path.
+
+    if(NOT EXISTS "${file}")
+      if (EXISTS "/${file}")
+        set(file "/${file}")
+      else()
+        message(WARNING " Removing non-existant dependency file: ${file}")
+        set(file "")
+      endif()
+    endif()
+
+    if(NOT IS_DIRECTORY "${file}")
       # If softlinks start to matter, we should change this to REALPATH.  For now we need
       # to flatten paths, because nvcc can generate stuff like /bin/../include instead of
       # just /include.
       get_filename_component(file_absolute "${file}" ABSOLUTE)
       list(APPEND dependency_list "${file_absolute}")
-    endif(NOT IS_DIRECTORY ${file})
+    endif()
 
   endforeach(file)