CUDA: Wrap `-pthread` flags into `-Xcompiler -pthread` for nvcc invocations
Using the finder module for Threads with
CMAKE_THREAD_PREFER_PTHREAD=ON causes compilation of cuda objects to fail with the message:
nvcc fatal : Unknown option 'pthread'
This is because nvcc does not understand the option
pthread. This should be able to be made to work by wrapping it in an
As a user-side workaround this is a bit unsatisfactory, because dealing with
-pthread flags is platform dependent, whereas the whole point of the the FindThreads module is to abstract away the platform dependency.
What would be great is if the native CUDA support in CMake could handle interactions with
Related to #17929 (closed).
Maybe @robertmaynard is involved, maybe the maintainer of the FindThreads module