# \#lang:cuda

**URL:** https://discourse.cmake.org/tag/lang-cuda/39.md

[Latest](https://discourse.cmake.org/latest.md) · [Categories](https://discourse.cmake.org/categories.md) · [Tags](https://discourse.cmake.org/tags.md)

---

## [Problem with CMake when compiling a project with Clang and CUDA support](https://discourse.cmake.org/t/problem-with-cmake-when-compiling-a-project-with-clang-and-cuda-support/11723)

<div class="topic-metadata">

**Author:** [@AAUDI](https://discourse.cmake.org/u/AAUDI)\
**Replies:** 1\
**Last updated:** [March 12, 2026, 5:01pm UTC](https://discourse.cmake.org/t/problem-with-cmake-when-compiling-a-project-with-clang-and-cuda-support/11723 "2026-03-12T17:01:23Z")

</div>

Hello, I’m trying to build an open-source project called VORTEX on Windows using CLANG as the compiler. However, when I run the CMake command, it seems that the NVCC (CUDA) compiler is not being detected. Could you plea…

---

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

<div class="topic-metadata">

**Author:** [@garyo](https://discourse.cmake.org/u/garyo)\
**Replies:** 4\
**Last updated:** [March 11, 2026, 3:53pm UTC](https://discourse.cmake.org/t/how-to-set-path-for-try-compile-runs-and-during-build/10256 "2026-03-11T15:53:11Z")

</div>

I’m trying to use CUDA with clang-cl (or just plain cl.exe) on Windows, using Mark Schofield’s Windows toolchain. The toolchain finds cl.exe, but then when CMake tries to find CUDA it fails, because nvcc can’t find compi…

---

## [CMAKE\_CUDA\_FLAGS passed to linking operations?](https://discourse.cmake.org/t/cmake-cuda-flags-passed-to-linking-operations/15540)

<div class="topic-metadata">

**Author:** [@mblanchard](https://discourse.cmake.org/u/mblanchard)\
**Replies:** 1\
**Last updated:** [March 5, 2026, 10:44am UTC](https://discourse.cmake.org/t/cmake-cuda-flags-passed-to-linking-operations/15540 "2026-03-05T10:44:48Z")

</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 …

---

## [CUDA CCCL integration](https://discourse.cmake.org/t/cuda-cccl-integration/15229)

<div class="topic-metadata">

**Author:** [@jwm](https://discourse.cmake.org/u/jwm)\
**Replies:** 4\
**Last updated:** [October 9, 2025, 3:45pm UTC](https://discourse.cmake.org/t/cuda-cccl-integration/15229 "2025-10-09T15:45:53Z")

</div>

I recently tried to upgrade my CUDA version from 12.8.0 to 13.1 (then dropped back to 12.9.1). Apparently I’ve been hit by the upgrade to the CCCL. My immediate symptom is that \<thrust/xxx\> is no longer found. At the sa…

---

## [CMake CUDA opinions](https://discourse.cmake.org/t/cmake-cuda-opinions/13160)

<div class="topic-metadata">

**Author:** [@eduardz1](https://discourse.cmake.org/u/eduardz1)\
**Replies:** 1\
**Last updated:** [October 8, 2025, 8:01pm UTC](https://discourse.cmake.org/t/cmake-cuda-opinions/13160 "2025-10-08T20:01:46Z")

</div>

This is a cross post from the CUDA discourse, it was suggested that I ask here instead. I have a repository that is structured in this way, following the example from ModernCMake - Extended example. I’m replacing with .…

---

## [Building CUDA code with a Clang host compiler which uses a non-standard GCC installation](https://discourse.cmake.org/t/building-cuda-code-with-a-clang-host-compiler-which-uses-a-non-standard-gcc-installation/14058)

<div class="topic-metadata">

**Author:** [@krasznaa](https://discourse.cmake.org/u/krasznaa)\
**Replies:** 0\
**Last updated:** [May 8, 2025, 8:58am UTC](https://discourse.cmake.org/t/building-cuda-code-with-a-clang-host-compiler-which-uses-a-non-standard-gcc-installation/14058 "2025-05-08T08:58:08Z")

</div>

Hi, The issue I bumped into just now may be a very corner case thing, but I think I found a bug… One of the environments in which I’d like to build CUDA code is one where host code is being compiled with a version of c…

---

## [Can't make simple cuda project with VS 2022 and CMake??? why I wonder? Simple code below....](https://discourse.cmake.org/t/cant-make-simple-cuda-project-with-vs-2022-and-cmake-why-i-wonder-simple-code-below/10754)

<div class="topic-metadata">

**Author:** [@RickF](https://discourse.cmake.org/u/RickF)\
**Replies:** 1\
**Last updated:** [March 13, 2025, 1:16pm UTC](https://discourse.cmake.org/t/cant-make-simple-cuda-project-with-vs-2022-and-cmake-why-i-wonder-simple-code-below/10754 "2025-03-13T13:16:19Z")

</div>

CMakeLists.txt cmake\_minimum\_required(VERSION 3.8 FATAL\_ERROR) project(CudaCppExample) enable\_language("CUDA") add\_executable(CudaCppExample main.cpp kernel.cu) set\_target\_properties(CudaCppExample PROPERTIES CUDA…

---

## [CMake target\_include\_directories doesn't export to compile\_commands.json when using CUDA](https://discourse.cmake.org/t/cmake-target-include-directories-doesnt-export-to-compile-commands-json-when-using-cuda/10072)

<div class="topic-metadata">

**Author:** [@SidYaj](https://discourse.cmake.org/u/SidYaj)\
**Replies:** 11\
**Last updated:** [February 27, 2025, 7:07am UTC](https://discourse.cmake.org/t/cmake-target-include-directories-doesnt-export-to-compile-commands-json-when-using-cuda/10072 "2025-02-27T07:07:34Z")

</div>

I am trying to use CMake to build a CUDA project. However, when I use add\_library followed by target\_include\_directories, the relevant commands are not updated in the compile\_commands.json file. The structure of the p…

---

## [Gromacs compilation: Could NOT find CUDA](https://discourse.cmake.org/t/gromacs-compilation-could-not-find-cuda/13405)

<div class="topic-metadata">

**Author:** [@Natalia\_Chesnokova](https://discourse.cmake.org/u/Natalia_Chesnokova)\
**Replies:** 0\
**Last updated:** [January 15, 2025, 2:45pm UTC](https://discourse.cmake.org/t/gromacs-compilation-could-not-find-cuda/13405 "2025-01-15T14:45:14Z")

</div>

Hi everyone! When I compile Gromacs with GPU acceleration from source code, I get a message “Could NOT find CUDA (missing: CUDA\_NVCC\_EXECUTABLE CUDA\_INCLUDE\_DIRS CUDA\_CUDART\_LIBRARY)” when running the Cmake command. M…

---

## [CMake incorrectly links to nvrtc-builtins](https://discourse.cmake.org/t/cmake-incorrectly-links-to-nvrtc-builtins/12723)

<div class="topic-metadata">

**Author:** [@peastman](https://discourse.cmake.org/u/peastman)\
**Replies:** 5\
**Last updated:** [October 9, 2024, 3:51pm UTC](https://discourse.cmake.org/t/cmake-incorrectly-links-to-nvrtc-builtins/12723 "2024-10-09T15:51:26Z")

</div>

I have a program that uses CUDA, and more specifically the nvrtc runtime compiler. In my build script, I call find\_package(CUDAToolkit), then use target\_link\_libraries() to link to CUDA::nvrtc. It is supposed to be bin…

---

## [CUDA setup not found with update-alternatives symlinks on ubuntu](https://discourse.cmake.org/t/cuda-setup-not-found-with-update-alternatives-symlinks-on-ubuntu/11745)

<div class="topic-metadata">

**Author:** [@maichmueller](https://discourse.cmake.org/u/maichmueller)\
**Replies:** 2\
**Last updated:** [September 30, 2024, 6:47pm UTC](https://discourse.cmake.org/t/cuda-setup-not-found-with-update-alternatives-symlinks-on-ubuntu/11745 "2024-09-30T18:47:36Z")

</div>

Hi, cmake (26.5 and also 30.3) seem to fail searching for the cuda toolkit when it is symlinked by ubuntu’s update-alternatives. More precisely, I have this sample project cmakelists.txt from CLion: cmake\_minimum\_requi…

---

## [Cuda nvJitLink error because fatbin does not contains the correct function.](https://discourse.cmake.org/t/cuda-nvjitlink-error-because-fatbin-does-not-contains-the-correct-function/11612)

<div class="topic-metadata">

**Author:** [@YoniSp](https://discourse.cmake.org/u/YoniSp)\
**Replies:** 0\
**Last updated:** [September 8, 2024, 5:18pm UTC](https://discourse.cmake.org/t/cuda-nvjitlink-error-because-fatbin-does-not-contains-the-correct-function/11612 "2024-09-08T17:18:42Z")

</div>

Hi I am trying to compile my application with fatbin flag is active: set\_property(TARGET offline PROPERTY CUDA\_FATBIN\_COMPILATION ON) The error code is: error : Undefined reference to '\_Z7computefff' in 'ltoPtx' er…

---

## [CheckLanguage does not take the C++ standard into account](https://discourse.cmake.org/t/checklanguage-does-not-take-the-c-standard-into-account/11433)

<div class="topic-metadata">

**Author:** [@krasznaa](https://discourse.cmake.org/u/krasznaa)\
**Replies:** 9\
**Last updated:** [August 15, 2024, 2:05pm UTC](https://discourse.cmake.org/t/checklanguage-does-not-take-the-c-standard-into-account/11433 "2024-08-15T14:05:27Z")

</div>

Hi, I’ve run into an issue recently that I think CMake could be helping with in a better way. :thinking: In one of our projects we tend to make use of the very latest version of certain compilers at the same time. Which…

---

## [Error when linking a shared library on Windows using Clang, CUDA and Ninja](https://discourse.cmake.org/t/error-when-linking-a-shared-library-on-windows-using-clang-cuda-and-ninja/6377)

<div class="topic-metadata">

**Author:** [@harrytodorov](https://discourse.cmake.org/u/harrytodorov)\
**Replies:** 2\
**Last updated:** [April 30, 2024, 3:38pm UTC](https://discourse.cmake.org/t/error-when-linking-a-shared-library-on-windows-using-clang-cuda-and-ninja/6377 "2024-04-30T15:38:02Z")

</div>

I have recently worked on integrating CUDA in a project and have stumbled upon a couple of problems on Windows in combination with Clang (using the GNU-like command-line) and Ninja. To demonstrate the problems there is …

---

## [Add custom config in subdir](https://discourse.cmake.org/t/add-custom-config-in-subdir/10761)

<div class="topic-metadata">

**Author:** [@garyo](https://discourse.cmake.org/u/garyo)\
**Replies:** 1\
**Last updated:** [April 30, 2024, 6:04am UTC](https://discourse.cmake.org/t/add-custom-config-in-subdir/10761 "2024-04-30T06:04:24Z")

</div>

I have a set of subdirs with example programs that cmake builds. To keep things simple, the subdirs don’t have their own CMake files, just the sources; they all follow a common template. So the top-level CMake file looks…

---

## [No Cuda syntax highlighting/debugging when using CMake.](https://discourse.cmake.org/t/no-cuda-syntax-highlighting-debugging-when-using-cmake/10675)

<div class="topic-metadata">

**Author:** [@LouChiSoft](https://discourse.cmake.org/u/LouChiSoft)\
**Replies:** 0\
**Last updated:** [April 16, 2024, 11:58am UTC](https://discourse.cmake.org/t/no-cuda-syntax-highlighting-debugging-when-using-cmake/10675 "2024-04-16T11:58:45Z")

</div>

Hi, when using Visual Studio to open a CMake project (not a visual studio project generated by CMake) and pass the command line arguments --preset conan-default in CMakeSettings.json I get a valid project that builds wit…

---

## [Cmake Cuda Compiling Error (Cuda Compiler Idenfitication Is Unknown)](https://discourse.cmake.org/t/cmake-cuda-compiling-error-cuda-compiler-idenfitication-is-unknown/9694)

<div class="topic-metadata">

**Author:** [@ugurortac](https://discourse.cmake.org/u/ugurortac)\
**Replies:** 2\
**Last updated:** [December 21, 2023, 10:12pm UTC](https://discourse.cmake.org/t/cmake-cuda-compiling-error-cuda-compiler-idenfitication-is-unknown/9694 "2023-12-21T22:12:26Z")

</div>

Hello, I’m getting an error while compiling the cmake project I created. I think this error is caused by the internal structure of cmake. Cmake Version : 3.27.8 (Clion Embedded Compiler) Cuda Version: 12.3 Nvidia Dri…

---

## [Do I still need FindCUDA ?](https://discourse.cmake.org/t/do-i-still-need-findcuda/1705)

<div class="topic-metadata">

**Author:** [@Psykoangel](https://discourse.cmake.org/u/Psykoangel)\
**Replies:** 5\
**Last updated:** [December 5, 2023, 6:43am UTC](https://discourse.cmake.org/t/do-i-still-need-findcuda/1705 "2023-12-05T06:43:09Z")

</div>

Hello CMake Community ! I just had the opportunity to update one of our Ubuntu 20.04 host at work with the last stable CMake snap (actually version 3.18.1) and have been surprised with an error during the build of our p…

---

## [OpenACC + CUDA + CMake](https://discourse.cmake.org/t/openacc-cuda-cmake/9317)

<div class="topic-metadata">

**Author:** [@mihaly\_sisak\_conti](https://discourse.cmake.org/u/mihaly_sisak_conti)\
**Replies:** 1\
**Last updated:** [November 2, 2023, 9:16pm UTC](https://discourse.cmake.org/t/openacc-cuda-cmake/9317 "2023-11-02T21:16:38Z")

</div>

New users can not upload attachements, so I linked them here: https://forums.developer.nvidia.com/t/openacc-cuda-interop-with-cmake/270794/4?u=janos.mihaly.sisak We would like to use C with OpenACC pragmas and CUDA ker…

---

## [Using --keep and --keep-dir with CUDA compilation commands](https://discourse.cmake.org/t/using-keep-and-keep-dir-with-cuda-compilation-commands/9307)

<div class="topic-metadata">

**Author:** [@krasznaa](https://discourse.cmake.org/u/krasznaa)\
**Replies:** 3\
**Last updated:** [October 30, 2023, 3:19pm UTC](https://discourse.cmake.org/t/using-keep-and-keep-dir-with-cuda-compilation-commands/9307 "2023-10-30T15:19:21Z")

</div>

Hi, I ran into an unexpected complication with our project, which I’d like to collect some ideas about. In our project, amongst other things, we build some CUDA source code. In order to do some not-completely-trivial de…

---

## [nvlink segv w. clang as the cuda compiler](https://discourse.cmake.org/t/nvlink-segv-w-clang-as-the-cuda-compiler/8742)

<div class="topic-metadata">

**Author:** [@Burlen\_Loring](https://discourse.cmake.org/u/Burlen_Loring)\
**Replies:** 1\
**Last updated:** [August 15, 2023, 4:40pm UTC](https://discourse.cmake.org/t/nvlink-segv-w-clang-as-the-cuda-compiler/8742 "2023-08-15T16:40:42Z")

</div>

Hi All, as the title says, I’m using clang as both C++ and CUDA compiler. However, I found that w. recent versions of clang, including mainline nightly build, my project build fails due to a segv when device linking. Cm…

---

## [CUDAToolkit\_INCLUDE\_DIR and CUDAToolkit\_ROOT have no effect.](https://discourse.cmake.org/t/cudatoolkit-include-dir-and-cudatoolkit-root-have-no-effect/8621)

<div class="topic-metadata">

**Author:** [@Geremia](https://discourse.cmake.org/u/Geremia)\
**Replies:** 2\
**Last updated:** [July 31, 2023, 12:59pm UTC](https://discourse.cmake.org/t/cudatoolkit-include-dir-and-cudatoolkit-root-have-no-effect/8621 "2023-07-31T12:59:59Z")

</div>

CMakeLists.txt MWE: cmake\_minimum\_required(VERSION 3.17) project(ProjectName) find\_package(CUDAToolkit) $ cmake .. -- Unable to find cuda\_runtime.h in "/usr/share/cuda/include" for CUDAToolkit\_INCLUDE\_DIR. -- Unable t…

---

## [Linking cufft\_static with a CXX target](https://discourse.cmake.org/t/linking-cufft-static-with-a-cxx-target/7946)

<div class="topic-metadata">

**Author:** [@pauleonix](https://discourse.cmake.org/u/pauleonix)\
**Replies:** 5\
**Last updated:** [April 24, 2023, 5:40pm UTC](https://discourse.cmake.org/t/linking-cufft-static-with-a-cxx-target/7946 "2023-04-24T17:40:50Z")

</div>

The cuFFT/1d\_c2c sample by Nvidia provides a CMakeLists.txt which links CUDA::cufft. Modifying it to link against CUDA::cufft\_static causes a lot of linking issues. The cuFFT docs provide some guidance here, so I modifie…

---

## [Linking against CUDA::cuda\_driver not working right with libcuda stub, wants libcuda.so.1 not libcuda.so](https://discourse.cmake.org/t/linking-against-cuda-cuda-driver-not-working-right-with-libcuda-stub-wants-libcuda-so-1-not-libcuda-so/7455)

<div class="topic-metadata">

**Author:** [@eugenewalker](https://discourse.cmake.org/u/eugenewalker)\
**Replies:** 12\
**Last updated:** [March 7, 2023, 11:40pm UTC](https://discourse.cmake.org/t/linking-against-cuda-cuda-driver-not-working-right-with-libcuda-stub-wants-libcuda-so-1-not-libcuda-so/7455 "2023-03-07T23:40:17Z")

</div>

We build our project cusz using CMake so that it links against CUDA::cuda\_driver. For CI we build inside a Docker container where we have to rely on linking against the libcuda.so stub in the absence of the actual CUDA d…

---

## [Best way to support different CUDA version](https://discourse.cmake.org/t/best-way-to-support-different-cuda-version/7313)

<div class="topic-metadata">

**Author:** [@GiovaBx](https://discourse.cmake.org/u/GiovaBx)\
**Replies:** 1\
**Last updated:** [January 25, 2023, 4:48pm UTC](https://discourse.cmake.org/t/best-way-to-support-different-cuda-version/7313 "2023-01-25T16:48:18Z")

</div>

Hi all, I’m moving some of our internal libraries that use CUDA to cmake to generate a solution for Visual Studio (and then create conan packages from them). I need to support different versions of CUDA (at the moment …

---

## [Is it exlicitly described in the doc that Modern CMake will only compile \`.cu\` files with \`nvcc\`?](https://discourse.cmake.org/t/is-it-exlicitly-described-in-the-doc-that-modern-cmake-will-only-compile-cu-files-with-nvcc/6954)

<div class="topic-metadata">

**Author:** [@songyuc](https://discourse.cmake.org/u/songyuc)\
**Replies:** 3\
**Last updated:** [December 2, 2022, 12:21pm UTC](https://discourse.cmake.org/t/is-it-exlicitly-described-in-the-doc-that-modern-cmake-will-only-compile-cu-files-with-nvcc/6954 "2022-12-02T12:21:05Z")

</div>

Hi, guys, I am a learner of CMake, and I find that CMake would only compile .cu files with nvcc, except any files with the other extensions. Is this rule exlicitly described in the CMake documentation? Currently, I h…

---

## [FindCUDAToolkit CUDA::cupti fails since 3.24.1](https://discourse.cmake.org/t/findcudatoolkit-cuda-cupti-fails-since-3-24-1/6327)

<div class="topic-metadata">

**Author:** [@sami](https://discourse.cmake.org/u/sami)\
**Replies:** 3\
**Last updated:** [August 24, 2022, 4:11pm UTC](https://discourse.cmake.org/t/findcudatoolkit-cuda-cupti-fails-since-3-24-1/6327 "2022-08-24T16:11:51Z")

</div>

Hi, Since possibly a recent change, FindCUDAToolkit fails to find the libcupti since it is not looking to /usr/loca/cuda/include path anymore. Nvidia cuda packages install headers together with the other headers instead…

---

## [FindCUDAToolkit unable to find cudart library](https://discourse.cmake.org/t/findcudatoolkit-unable-to-find-cudart-library/5406)

<div class="topic-metadata">

**Author:** [@naglemi](https://discourse.cmake.org/u/naglemi)\
**Replies:** 2\
**Last updated:** [April 11, 2022, 1:29pm UTC](https://discourse.cmake.org/t/findcudatoolkit-unable-to-find-cudart-library/5406 "2022-04-11T13:29:19Z")

</div>

First, a big thank you to the developers and community. My understanding of the fundamentals of cmake is lacking, so I greatly appreciate your time and patience. I am trying to compile a program that comes with a CMakeL…

---

## [Help with CMAKE\_CUDA\_ARCHITECTURES resulting in incorrect nvcc compiler flags](https://discourse.cmake.org/t/help-with-cmake-cuda-architectures-resulting-in-incorrect-nvcc-compiler-flags/3556)

<div class="topic-metadata">

**Author:** [@irnbrux](https://discourse.cmake.org/u/irnbrux)\
**Replies:** 1\
**Last updated:** [October 20, 2021, 1:27pm UTC](https://discourse.cmake.org/t/help-with-cmake-cuda-architectures-resulting-in-incorrect-nvcc-compiler-flags/3556 "2021-10-20T13:27:59Z")

</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\\C…

---

## [Support for CUDA & ClangCL on Windows](https://discourse.cmake.org/t/support-for-cuda-clangcl-on-windows/1437)

<div class="topic-metadata">

**Author:** [@mojca](https://discourse.cmake.org/u/mojca)\
**Replies:** 2\
**Last updated:** [June 25, 2020, 7:42am UTC](https://discourse.cmake.org/t/support-for-cuda-clangcl-on-windows/1437 "2020-06-25T07:42:50Z")

</div>

When trying to build a simple CUDA project on Windows and optimistically specifying -T ClangCL, CMake complains about unknown CUDA compiler Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041. The CX…

[Next page](https://discourse.cmake.org/tag/lang-cuda/39.md?match_all_tags=true&page=1&tags%5B%5D=lang%3Acuda)
