summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDA
diff options
context:
space:
mode:
authorJames Bigler <jamesbigler@gmail.com>2011-12-05 23:54:06 (GMT)
committerJames Bigler <jamesbigler@gmail.com>2011-12-05 23:54:06 (GMT)
commit83d4eeadac5a656949127d4e2b67c4e973bbab48 (patch)
tree66c0af23fccda0359ba8e626acc7858cebff248a /Modules/FindCUDA
parente0bc42aa4ff086e9c6976ab91ba924530df0bf72 (diff)
downloadCMake-83d4eeadac5a656949127d4e2b67c4e973bbab48.zip
CMake-83d4eeadac5a656949127d4e2b67c4e973bbab48.tar.gz
CMake-83d4eeadac5a656949127d4e2b67c4e973bbab48.tar.bz2
Add work around for CUDA in UNC paths.
Nvcc can emit '/path' instead of '//path' which can cause a lot of grief later. We test to see if the file exists, if it doesn't then we see if the file exists with '/' prepended. Files that don't exist won't be added to the list.
Diffstat (limited to 'Modules/FindCUDA')
-rw-r--r--Modules/FindCUDA/make2cmake.cmake18
1 files changed, 16 insertions, 2 deletions
diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake
index 7fce167..d41b72d 100644
--- a/Modules/FindCUDA/make2cmake.cmake
+++ b/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)