CMAKE_CUDA_FLAGS passed to linking operations?

Upgrading from CMake 3.29.2 to 4.2.2, and building CPU and GPU code with Clang, it seems like CMAKE_CUDA_FLAGS are now pass to linking operations with 4.2.2, while they were not (at least with our setup) with 3.29.2. We noticed because, now with 4.2.2, some linking operations are failing in error of the like:

clang++: error: argument unused during compilation: ‘-Xarch_host -ffp-exception-behavior=strict’ [-Werror,-Wunused-command-line-argument]

Looking at release notes and policy changes, I haven’t been able to identify the new/changed CMake behavior that could explain it, hence the question here: is it intended or have I missed something?

Investigating a little further, it seems like CMake 4.2.2 depends on having -Xarch_host or not in CMAKE_CUDA_FLAGS:

  • With CMAKE_CUDA_FLAGS=[…] -Xarch_host -ffp-exception-behavior=strict, all theCMAKE_CUDA_FLAGS get passed down to the linking operation.
  • With CMAKE_CUDA_FLAGS=[…] -ffp-exception-behavior=strict, none of the CMAKE_CUDA_FLAGS get passed down to the linking operation.