[Openmp-commits] [openmp] r324879 - [libomptarget] Fix detection of CUDA stubs library
Jonas Hahnfeld via Openmp-commits
openmp-commits at lists.llvm.org
Mon Feb 12 03:01:57 PST 2018
Author: hahnfeld
Date: Mon Feb 12 03:01:56 2018
New Revision: 324879
URL: http://llvm.org/viewvc/llvm-project?rev=324879&view=rev
Log:
[libomptarget] Fix detection of CUDA stubs library
CUDA_LIBRARIES contains additional linker arguments since CMake 3.3
which breakes the current way of finding the stubs library.
Modified:
openmp/trunk/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
Modified: openmp/trunk/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake?rev=324879&r1=324878&r2=324879&view=diff
==============================================================================
--- openmp/trunk/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake (original)
+++ openmp/trunk/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake Mon Feb 12 03:01:56 2018
@@ -134,7 +134,16 @@ 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)
- get_filename_component(CUDA_LIBDIR ${CUDA_LIBRARIES} DIRECTORY)
+ # 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 (
LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES
NAMES
More information about the Openmp-commits
mailing list