diff options
| author | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2018-02-12 11:01:56 +0000 |
|---|---|---|
| committer | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2018-02-12 11:01:56 +0000 |
| commit | 3cfaf3dd0def9f87ebfcc530bfe0c26a444a27ac (patch) | |
| tree | 2ff5bdaa628f76efbc9ef534c85c4d37b53ab4a3 | |
| parent | 5379c6d6fd121f822b6b191906fc1aa664726607 (diff) | |
| download | bcm5719-llvm-3cfaf3dd0def9f87ebfcc530bfe0c26a444a27ac.tar.gz bcm5719-llvm-3cfaf3dd0def9f87ebfcc530bfe0c26a444a27ac.zip | |
[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.
llvm-svn: 324879
| -rw-r--r-- | openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake index acdaff21e2c..71a6a5edb91 100644 --- a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake +++ b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake @@ -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 |

