[Openmp-commits] [openmp] c42f96c - [CMake][OpenMP] Simplify getting CUDA library directory

Raul Tambre via Openmp-commits openmp-commits at lists.llvm.org
Fri Sep 11 11:19:19 PDT 2020


Author: Raul Tambre
Date: 2020-09-11T21:19:11+03:00
New Revision: c42f96cb23bedb0e4bc31d2e88b60275083a420d

URL: https://github.com/llvm/llvm-project/commit/c42f96cb23bedb0e4bc31d2e88b60275083a420d
DIFF: https://github.com/llvm/llvm-project/commit/c42f96cb23bedb0e4bc31d2e88b60275083a420d.diff

LOG: [CMake][OpenMP] Simplify getting CUDA library directory

LLVM now requires CMake 3.13.4 so we can simplify this.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D87195

Added: 
    

Modified: 
    openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
index 95254e7a9e12..05742bd4fbf7 100644
--- a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
+++ b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
@@ -137,17 +137,8 @@ find_library (
 
 # There is a libcuda.so in lib64/stubs that can be used for linking.
 if (NOT LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES AND CUDA_FOUND)
-  # Since CMake 3.3 FindCUDA.cmake defaults to using static libraries. In this
-  # case CUDA_LIBRARIES contains additional linker arguments which breaks
-  # get_filename_component below. Fortunately, since that change the module
-  # exports CUDA_cudart_static_LIBRARY which points to a single file in the
-  # right directory.
-  set(cuda_library ${CUDA_LIBRARIES})
-  if (DEFINED CUDA_cudart_static_LIBRARY)
-    set(cuda_library ${CUDA_cudart_static_LIBRARY})
-  endif()
-  get_filename_component(CUDA_LIBDIR ${cuda_library} DIRECTORY)
-  find_library (
+  get_filename_component(CUDA_LIBDIR "${CUDA_cudart_static_LIBRARY}" DIRECTORY)
+  find_library(
       LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES
     NAMES
       cuda


        


More information about the Openmp-commits mailing list