VS: Specify a custom CUDA platform toolkit at configure time
Hi,
For our Windows build environment we need to decide at configure time which custom CUDA platform toolkit we select. Currently, we can achieve this by setting CUDA_TOOLKIT_ROOT_DIR
prior to calling find_package(CUDA)
. Since the FindCUDA module is now deprecated, we are trying to get the suggested alternative enable_language(CUDA)
working. Unfortunately without success:
To my understanding, this approach would require us to specify the CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR
through a toolchain file or by passing -T
to cmake. However, as mentioned above we do not know this location at this early time because it is only determined later during early cmake configure after parsing package requirements. Changing CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR at that time is undefined behavior according to the docs and also does not work in practice.
Therefore I have two questions:
- Is there another way that we can specify the path to a custom CUDA platform toolkit at CMake configure time (obviously before enabling CUDA as language), essentially replacing our current approach with the FindCUDA module?
- If there is no way of achieving this right now, would it at least be possible from a technical perspective, and therefore form a reasonable feature request for future CMake versions (that we could wait for)?
Thanks!