-pthread is being passed to nvcc due to usage of pkg-config
I'm having a project using cuda and it also uses pkg-config, in particular, I'm using udisks from pkgconfig the following way:
pkg_check_modules(UDISKS2 IMPORTED_TARGET udisks2)
if(UDISKS2_FOUND)
target_link_libraries(fuse PRIVATE PkgConfig::UDISKS2)
target_compile_definitions(fuse PRIVATE UDISKS2_ENABLED)
endif()
It so happens that one of the dependent modules of udisks2 appends -pthread to the compile flags. This is no problem for c++ code, but a big problem for nvcc which bails out with -pthread as an unknown option. Disabling the if and the code compiles fine