Skip to content

CUDA: Implement CMAKE_USER_MAKE_RULES_OVERRIDE[_CUDA]

Unlike C, CXX, Fortran, and apparently most of the other first-class CMake languages, CUDA did not get support for CMAKE_USER_MAKE_RULES_OVERRIDE and CMAKE_USER_MAKE_RULES_OVERRIDE_CUDA (even though the documentation implies both).


Is CMAKE_USER_MAKE_RULES_OVERRIDE such an unusual feature that no one has noticed the omission for five years? I thought given its design that it was the best way to implement a project-specific default for CMAKE_CUDA_FLAGS=--extended-lambda and CMAKE_CUDA_FLAGS_DEBUG=-O0 -g -G. The idea is that these are project-specific settings that can be overridden or even cleared by the advanced user, and I've seen many projects implement workarounds such as

if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()

which seem far less elegant and prevents the use of an empty string.


Backport: release
Topic-rename: cuda-rules-override

Edited by Brad King

Merge request reports