From 68071747cb99808cb5d973c8922fc777c404ba7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 16 Jan 2026 12:17:54 +0000 Subject: [PATCH] Remove `-static-global-template-stub` on CUDA < 12.8 --- build2cmake/src/templates/cuda/kernel.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build2cmake/src/templates/cuda/kernel.cmake b/build2cmake/src/templates/cuda/kernel.cmake index 04d67d2..15062ea 100644 --- a/build2cmake/src/templates/cuda/kernel.cmake +++ b/build2cmake/src/templates/cuda/kernel.cmake @@ -25,12 +25,19 @@ if(GPU_LANG STREQUAL "CUDA") {% if cuda_flags %} + set(_CUDA_FLAGS "{{ cuda_flags }}") + # -static-global-template-stub is not supported on CUDA < 12.8. Remove this + # once we don't support CUDA 12.6 anymore. + if(CUDA_VERSION VERSION_LESS 12.8) + string(REGEX REPLACE "-static-global-template-stub=(true|false)" "" _CUDA_FLAGS "${_CUDA_FLAGS}") + endif() + foreach(_KERNEL_SRC {{'${' + kernel_name + '_SRC}'}}) if(_KERNEL_SRC MATCHES ".*\\.cu$") set_property( SOURCE ${_KERNEL_SRC} APPEND PROPERTY - COMPILE_OPTIONS "$<$:{{ cuda_flags }}>" + COMPILE_OPTIONS "$<$:${_CUDA_FLAGS}>" ) endif() endforeach()