Please add a find_package module for the NVIDIA Management library
This issue is basically the same as #17175 (closed) , except this one is for the native CUDA language support.
Since CUDA 8, the NVIDIA Management Library for the management and monitoring of NVIDIA GPU's is part of the CUDA toolkit.
Currently, there is no finder Module for this library, and the "native CUDA language support" also doesn't expose this library in a separate variable or along with CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES
.
as a Workaround, one can awkwardly do this, if the project uses the CUDA language:
link_directories(${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
add_executable(yourtarget yoursource.cpp)
# or
add_library(yourtarget yoursource.cpp)
target_link_libraries(yourtarget ${CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES})
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
target_link_libraries(yourtarget nvml)
else(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
target_link_libraries(yourtarget nvidia-ml)
endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
I believe there should be either a FindNVML.cmake module that detects this library along with the CUDA toolkit, or that the native CUDA language support exposes the library in a variable.
A FindNVML.cmake module that is independent of the CUDA language would probably be preferable, because it can be used in C/C++-only applications that don't use the CUDA language.