# CMAKE\_CUDA\_FLAGS passed to linking operations?

**URL:** https://discourse.cmake.org/t/cmake-cuda-flags-passed-to-linking-operations/15540
**Category:** Usage
**Tags:** os:linux, comp:clang, gen:ninja, lang:cuda
**Created:** [March 5, 2026, 8:59am UTC](https://discourse.cmake.org/t/cmake-cuda-flags-passed-to-linking-operations/15540 "2026-03-05T08:59:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mblanchard](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ee59a6/32.png) [@mblanchard](https://discourse.cmake.org/u/mblanchard)
#### Post date: [March 5, 2026, 8:59am UTC](https://discourse.cmake.org/t/cmake-cuda-flags-passed-to-linking-operations/15540/1 "2026-03-05T08:59:20Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![mblanchard](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ee59a6/32.png) [@mblanchard](https://discourse.cmake.org/u/mblanchard)
#### Post date: [March 5, 2026, 10:44am UTC](https://discourse.cmake.org/t/cmake-cuda-flags-passed-to-linking-operations/15540/2 "2026-03-05T10:44:48Z")

</div>

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 the`CMAKE_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.
