Hello.
I am using cmake 3.3.2.
The following script sets the CUDA_USE_STATIC_CUDA_RUNTIME option, then finds the CUDA package.

cmake_minimum_required(VERSION 3.3)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CUDA_TOOLKIT_ROOT_DIR "d:/work/CUDAToolkit")
message(STATUS CUDA_USE_STATIC_CUDA_RUNTIME=${CUDA_USE_STATIC_CUDA_RUNTIME})
find_package(CUDA)
message(STATUS CUDA_USE_STATIC_CUDA_RUNTIME=${CUDA_USE_STATIC_CUDA_RUNTIME})

In the find_package, the variable CUDA_TOOLKIT_ROOT_DIR is compared to the variable CUDA_TOOLKIT_ROOT_DIR_INTERNAL (line 556). Since this variable is not defined, the cuda_unset_include_and_libraries function is called. This function wipes the CUDA_USE_STATIC_CUDA_RUNTIME option from the cache.

In order to correctly set this variable, I need to restart change it back to OFF, then the FindCUDA script doesn't call cuda_unset_include_and_libraries function.
Thibaut.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to