# Help with CMAKE\_CUDA\_ARCHITECTURES resulting in incorrect nvcc compiler flags

**URL:** https://discourse.cmake.org/t/help-with-cmake-cuda-architectures-resulting-in-incorrect-nvcc-compiler-flags/3556
**Category:** Usage
**Tags:** lang:cuda, os:windows, gen:ninja
**Created:** [June 11, 2021, 12:12pm UTC](https://discourse.cmake.org/t/help-with-cmake-cuda-architectures-resulting-in-incorrect-nvcc-compiler-flags/3556 "2021-06-11T12:12:21Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![irnbrux](https://discourse.cmake.org/user_avatar/discourse.cmake.org/irnbrux/32/1554_2.png) [@irnbrux](https://discourse.cmake.org/u/irnbrux)
#### Post date: [June 11, 2021, 12:12pm UTC](https://discourse.cmake.org/t/help-with-cmake-cuda-architectures-resulting-in-incorrect-nvcc-compiler-flags/3556/1 "2021-06-11T12:12:21Z")

</div>

Hi,

I am trying to build against CUDA, but get a compiler error:  
**nvcc fatal : ‘sm\_53’ is not in ‘keyword=value’ format**

from  
**set(CMAKE\_CUDA\_ARCHITECTURES 53 75)**

**The command line generated is**  
C:\PROGRA~1\NVIDIA~2\CUDA\v11.2\bin\nvcc.exe -forward-unknown-to-host-compiler --options-file output\CMakeFiles\samediff\_obj.dir\ops\declarable\helpers\cuda\imagesHelpers.cu.obj.rsp -MD -MT output\CMakeFiles\samediff\_obj.dir\ops\declarable\helpers\cuda\imagesHelpers.cu.obj -MF output\CMakeFiles\samediff\_obj.dir\ops\declarable\helpers\cuda\imagesHelpers.cu.obj.d -x cu -c …\src\main\cpp\blas\ops\declarable\helpers\cuda\imagesHelpers.cu -o output\CMakeFiles\samediff\_obj.dir\ops\declarable\helpers\cuda\imagesHelpers.cu.obj -Xcompiler=-Fdoutput\CMakeFiles\samediff\_obj.dir,-FS

**with the option file being:**  
-D\_\_CUDABLAS\_\_=true -Imkldnn-build\include -Imkldnn-src\include -Imkldnn-build -Iflatbuffers-src\include -Isrc\main\include -I…\src\main\cpp\blas\samediff\_obj -I…\src\main\cpp\blas\PUBLIC -I…\src\main\cpp\blas. -D\_WINDOWS -Xcompiler=" /EHsc" -DCUDA\_VERSION\_MAJOR= -w --cudart=static --expt-extended-lambda -Xfatbin -compress-all -Xcompiler="-O2 -Ob2" -DNDEBUG **–generate-code=arch=compute\_53,code=[compute\_53,sm\_53] --generate-code=arch=compute\_75,code=[compute\_75,sm\_75]** -std=c++14

It does work when the --generate-code parameter is wrapped in quotes like this  
**–generate-code=“arch=compute\_53,code=[compute\_53,sm\_53]” --generate-code="arch=compute\_75,code=[compute\_75,sm\_75]"**

Building on Windows, MSYS, MingW64, Ninja  
cmake 3.20.3

Anyone has an idea how to fix that?  
Thanks

Bru

---

<div class="post-metadata">

### Author: ![pierre](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/d07c76/32.png) [@pierre](https://discourse.cmake.org/u/pierre)
#### Post date: [October 20, 2021, 1:27pm UTC](https://discourse.cmake.org/t/help-with-cmake-cuda-architectures-resulting-in-incorrect-nvcc-compiler-flags/3556/2 "2021-10-20T13:27:59Z")

</div>

I made a ticket for you: [https://gitlab.kitware.com/cmake/cmake/-/issues/22780](https://gitlab.kitware.com/cmake/cmake/-/issues/22780)  
meanwhile use something like

```auto
set(CMAKE_CUDA_ARCHITECTURES OFF)
string(APPEND CMAKE_CUDA_FLAGS " -arch=sm_53")

```
