First, there is this answer that describes how to fiddle with FindCUDA.cmake
so that we can link with CUDA 9.0+'s renamed NPP libraries correctly, but the default CMake 3.5.1 in Ubuntu 16.04 requires this code to be added manually.
However, if someone forgets to apply that change, or search paths are such that an older FindCUDA.cmake
is picked up, I want to report an error. This code almost does that:
find_package(CUDA)
if (CUDA_VERSION VERSION_GREATER_EQUAL "9.0")
if (NOT CUDA_nppial_LIBRARY)
message(FATAL_ERROR "CUDA 9.0+ libraries not set in file at ${FINDCUDA_FILE}")
endif()
target_link_libraries(foo ${CUDA_nppial_LIBRARY})
endif()
Except that I don't know what to use for ${FINDCUDA_FILE}
and searching the code doesn't give me any clues. Is there such a variable or other way to find that file?