# Problem with CMake when compiling a project with Clang and CUDA support

**URL:** https://discourse.cmake.org/t/problem-with-cmake-when-compiling-a-project-with-clang-and-cuda-support/11723
**Category:** Usage
**Tags:** os:windows, comp:clang, gen:vs, lang:cuda, tool:cmake
**Created:** [September 19, 2024, 12:50pm UTC](https://discourse.cmake.org/t/problem-with-cmake-when-compiling-a-project-with-clang-and-cuda-support/11723 "2024-09-19T12:50:03Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![corio](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/d26b3c/32.png) [@corio](https://discourse.cmake.org/u/corio)
#### Post date: [March 12, 2026, 5:01pm UTC](https://discourse.cmake.org/t/problem-with-cmake-when-compiling-a-project-with-clang-and-cuda-support/11723/2 "2026-03-12T17:01:23Z")

</div>

I had the same error (MSB4023) when trying to run

```auto
C:\> "c:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" ^
-G "Visual Studio 17 2022" ^
-A x64 ^
-T ClangCL ^
-S "C:/Downloads/cuda-samples-master/cuda-samples-master/Samples/1_Utilities/deviceQuery" ^
-B . ^
-DCUDAToolkit_ROOT="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6" ^
-DCMAKE_CUDA_ARCHITECTURES=75 ^
-DCMAKE_CUDA_STANDARD=14 ^
-DCMAKE_CUDA_EXTENSIONS=OFF ^
-DCMAKE_CUDA_COMPILER="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe" ^
-DCMAKE_VS_PLATFORM_TOOLSET_CUDA=12.6 ^
-DCMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6"

```

Workaround: [How to set $PATH for try\_compile runs, and during build? - #5 by corio](https://discourse.cmake.org/t/how-to-set-path-for-try-compile-runs-and-during-build/10256/5)

---

_[View the full topic](https://discourse.cmake.org/t/problem-with-cmake-when-compiling-a-project-with-clang-and-cuda-support/11723)._
