Skip to content

FindCUDA ignores CUDA_USE_STATIC_CUDA_RUNTIME option

Hi! I have been trying to disable the use of the static cuda runtime library, because I would prefer it to be linked dynamically.

There is an option in FindCUDA.cmake, namely CUDA_USE_STATIC_CUDA_RUNTIME which is supposed to toggle dynamic/static linking of libcudart.

CUDA_USE_STATIC_CUDA_RUNTIME (Default ON) -- When enabled the static version of the CUDA runtime library will be used in CUDA_LIBRARIES.

The default value for this option is ON. I have tried to set it to OFF by running cmake with

cmake .. -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF

And I have also tried to set the variable after including FindCuda.cmake with SET(CUDA_USE_STATIC_CUDA_RUNTIME OFF)

However, this does not work. grep CUDA_USE_STATIC_CUDA_RUNTIME CMakeCache.txt always returns the following, no matter what I do:

CUDA_USE_STATIC_CUDA_RUNTIME:BOOL=ON

And sure enough, running make in advertently uses the static library.

I am using CMake 3.9 on Fedora 26 with CUDA 9.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information