python3Packages.torch: gate CUDAToolkit_VERSION cmake flag on cudaSupport

Fix a cache miss when `cudaSupport = false` but
`cudaPackages.cudaMajorMinorVersion` is not the default (as could be the
case with an overlay like `cudaPackages = cudaPackages_13_1;`)
This commit is contained in:
stefan
2026-06-03 07:34:10 +00:00
committed by Gaetan Lepage
parent 710fac44d6
commit 3eb4f1b56f
@@ -493,9 +493,9 @@ buildPythonPackage.override { inherit stdenv; } (finalAttrs: {
cmakeFlags = [
(lib.cmakeFeature "PYTHON_SIX_SOURCE_DIR" "${six.src}")
# (lib.cmakeBool "CMAKE_FIND_DEBUG_MODE" true)
(lib.cmakeFeature "CUDAToolkit_VERSION" cudaPackages.cudaMajorMinorVersion)
]
++ lib.optionals cudaSupport [
(lib.cmakeFeature "CUDAToolkit_VERSION" cudaPackages.cudaMajorMinorVersion)
# Unbreaks version discovery in enable_language(CUDA) when wrapping nvcc with ccache
# Cf. https://gitlab.kitware.com/cmake/cmake/-/issues/26363
(lib.cmakeFeature "CMAKE_CUDA_COMPILER_TOOLKIT_VERSION" cudaPackages.cudaMajorMinorVersion)