浏览代码

Miscellaneous fixes.

James Bigler 14 年之前
父节点
当前提交
aa36082a2b
共有 1 个文件被更改,包括 11 次插入10 次删除
  1. 11 10
      Modules/FindCUDA.cmake

+ 11 - 10
Modules/FindCUDA.cmake

@@ -266,17 +266,17 @@ macro(CUDA_FIND_HELPER_FILE _name _extension)
   # processed.  Using this variable, we can pull out the current path, and
   # provide a way to get access to the other files we need local to here.
   get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-  find_file(CUDA_${_name} ${_full_name} PATHS ${CMAKE_CURRENT_LIST_DIR}/FindCUDA NO_DEFAULT_PATH)
-  if(NOT CUDA_${_name})
-    set(error_message "${_full_name} not found in CMAKE_MODULE_PATH")
+  set(CUDA_${_name} "${CMAKE_CURRENT_LIST_DIR}/FindCUDA/${_full_name}")
+  if(NOT EXISTS "${CUDA_${_name}}")
+    set(error_message "${_full_name} not found in ${CMAKE_CURRENT_LIST_DIR}/FindCUDA")
     if(CUDA_FIND_REQUIRED)
       message(FATAL_ERROR "${error_message}")
-    else(CUDA_FIND_REQUIRED)
+    else()
       if(NOT CUDA_FIND_QUIETLY)
         message(STATUS "${error_message}")
-      endif(NOT CUDA_FIND_QUIETLY)
-    endif(CUDA_FIND_REQUIRED)
-  endif(NOT CUDA_${_name})
+      endif()
+    endif()
+  endif()
   # Set this variable as internal, so the user isn't bugged with it.
   set(CUDA_${_name} ${CUDA_${_name}} CACHE INTERNAL "Location of ${_full_name}" FORCE)
 endmacro(CUDA_FIND_HELPER_FILE)
@@ -320,9 +320,9 @@ macro(CUDA_INCLUDE_NVCC_DEPENDENCIES dependency_file)
 #     message("CUDA_NVCC_DEPEND NOT set")
 #   endif()
   if(CUDA_NVCC_DEPEND)
-    #message("CUDA_NVCC_DEPEND true")
+    #message("CUDA_NVCC_DEPEND found")
     foreach(f ${CUDA_NVCC_DEPEND})
-      #message("searching for ${f}")
+      # message("searching for ${f}")
       if(NOT EXISTS ${f})
         #message("file ${f} not found")
         set(CUDA_NVCC_DEPEND_REGENERATE TRUE)
@@ -415,13 +415,14 @@ endforeach()
 # if they have then clear the cache variables, so that will be detected again.
 if(NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}")
   unset(CUDA_NVCC_EXECUTABLE CACHE)
-  unset(CUDA_VERSION CACHE)
   unset(CUDA_TOOLKIT_INCLUDE CACHE)
   unset(CUDA_CUDART_LIBRARY CACHE)
+  # Make sure you run this before you unset CUDA_VERSION.
   if(CUDA_VERSION VERSION_EQUAL "3.0")
     # This only existed in the 3.0 version of the CUDA toolkit
     unset(CUDA_CUDARTEMU_LIBRARY CACHE)
   endif()
+  unset(CUDA_VERSION CACHE)
   unset(CUDA_CUDA_LIBRARY CACHE)
   unset(CUDA_cublas_LIBRARY CACHE)
   unset(CUDA_cublasemu_LIBRARY CACHE)