The OpenMP runtime's cmake scripts do not correctly locate the
libdevice that the Debian/Ubuntu package nvidia-cuda-toolkit currently
includes, at least on my Ubuntu 18.04.1 installation. This patch
fixes that for me.
This problem was discussed at length in D55269. D40453 added a
similar adjustment in clang, but reviewers of D55269 concluded that,
for the OpenMP runtime, the right place to address this problem is in
cmake's CUDA support. However, it was also suggested we could add a
workaround to OpenMP's cmake scripts now. This patch contains such a
workaround, which I've tried to design so that it will have no harmful
effect if cmake improves in the future.
nvidia-cuda-toolkit also needs improvements because its intended
monolithic CUDA tree shim, /usr/lib/cuda, has many empty directories,
such as bin. I reported that at:
https://bugs.launchpad.net/ubuntu/+source/nvidia-cuda-toolkit/+bug/1808999
There's a convention that cmake variables are capitalized. Also, cmake variables local to libomptarget should start with the prefix LIBOMPTARGET_. So this variable's name should be changed to LIBOMPTARGET_CUDA_TOOLKIT_ROOT_DIR_PRESET ("preset" makes more sense than "old").