# \#comp:clang

**URL:** https://discourse.cmake.org/tag/comp-clang/5.md

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

---

## [FASTBuild+clang-cl combo emits warnings which Ninja+clang-cl combo doesn't emit with same everything](https://discourse.cmake.org/t/fastbuild-clang-cl-combo-emits-warnings-which-ninja-clang-cl-combo-doesnt-emit-with-same-everything/15601)

<div class="topic-metadata">

**Author:** [@SenPie](https://discourse.cmake.org/u/SenPie)\
**Replies:** 6\
**Last updated:** [April 25, 2026, 11:51pm UTC](https://discourse.cmake.org/t/fastbuild-clang-cl-combo-emits-warnings-which-ninja-clang-cl-combo-doesnt-emit-with-same-everything/15601 "2026-04-25T23:51:51Z")

</div>

With the long awaited addition of FASTBuild to the list of supported generators we wanted to transition our game engine from Ninja+clang-cl setup to FASTBuild+clang-cl setup to leverage that sweet distributed compilation…

---

## [Having difficulty compiling with import std; support; cmake can't build std.cppm](https://discourse.cmake.org/t/having-difficulty-compiling-with-import-std-support-cmake-cant-build-std-cppm/15557)

<div class="topic-metadata">

**Author:** [@sebjames](https://discourse.cmake.org/u/sebjames)\
**Replies:** 10\
**Last updated:** [March 15, 2026, 8:41am UTC](https://discourse.cmake.org/t/having-difficulty-compiling-with-import-std-support-cmake-cant-build-std-cppm/15557 "2026-03-15T08:41:15Z")

</div>

Hi there, I’m looking for some help with a cmake-directed build of a C++ modules project containing import std; I’ve followed along with: https://www.kitware.com/import-std-in-cmake-3-30/ The sample provided there co…

---

## [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…

---

## [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 …

---

## [How to correctly generate compile\_commands.json for library dependency using PkgConfig?](https://discourse.cmake.org/t/how-to-correctly-generate-compile-commands-json-for-library-dependency-using-pkgconfig/15135)

<div class="topic-metadata">

**Author:** [@skittishdev](https://discourse.cmake.org/u/skittishdev)\
**Replies:** 3\
**Last updated:** [February 19, 2026, 9:01pm UTC](https://discourse.cmake.org/t/how-to-correctly-generate-compile-commands-json-for-library-dependency-using-pkgconfig/15135 "2026-02-19T21:01:24Z")

</div>

Hi, I am on MacOS, and I use nix as my package manager. I am building a C project, and I’d like to use Criterion for my tests. I am able to build my project and run the tests, but my compile\_commands.json file is not ge…

---

## [Change C compilation to two step transformation like .m -\> .bc -\> .o](https://discourse.cmake.org/t/change-c-compilation-to-two-step-transformation-like-m-bc-o/15349)

<div class="topic-metadata">

**Author:** [@mulle-nat](https://discourse.cmake.org/u/mulle-nat)\
**Replies:** 0\
**Last updated:** [November 27, 2025, 10:16am UTC](https://discourse.cmake.org/t/change-c-compilation-to-two-step-transformation-like-m-bc-o/15349 "2025-11-27T10:16:44Z")

</div>

I actually want to write this make like rule in cmake %.o: %.m mulle-clang $(LLVM\_FLAGS) -c -emit-llvm -o $\*.bc $\< emcc $(EMCC\_FLAGS) -c -o $@ $\*.bc This is not trivial it seems. At least I haven’t figured it out…

---

## [target\_precompile\_headers(PRIVATE) in library project does not work when using library functions in an executable project..](https://discourse.cmake.org/t/target-precompile-headers-private-in-library-project-does-not-work-when-using-library-functions-in-an-executable-project/15313)

<div class="topic-metadata">

**Author:** [@AlephVoid](https://discourse.cmake.org/u/AlephVoid)\
**Replies:** 1\
**Last updated:** [November 17, 2025, 6:55pm UTC](https://discourse.cmake.org/t/target-precompile-headers-private-in-library-project-does-not-work-when-using-library-functions-in-an-executable-project/15313 "2025-11-17T18:55:40Z")

</div>

Related question: Question. There is another problem which seems to stump me, that is it seems that target\_precompile\_headers with PRIVATE keyword(Which is a good practice) does not seem to work in my executable project…

---

## [Cannot include header files inside the header files in library project (With executable project for testing)](https://discourse.cmake.org/t/cannot-include-header-files-inside-the-header-files-in-library-project-with-executable-project-for-testing/15311)

<div class="topic-metadata">

**Author:** [@AlephVoid](https://discourse.cmake.org/u/AlephVoid)\
**Replies:** 2\
**Last updated:** [November 16, 2025, 1:52pm UTC](https://discourse.cmake.org/t/cannot-include-header-files-inside-the-header-files-in-library-project-with-executable-project-for-testing/15311 "2025-11-16T13:52:47Z")

</div>

I have the problem which stumped me for 3 days. I am creating an C++ library which inside the library codebase includes are more freely defined than on an executable. For example: #include "base\_task.h" Inside library…

---

## ["Show Live Issues" problem in Xcode with CMake generator and possible improvement](https://discourse.cmake.org/t/show-live-issues-problem-in-xcode-with-cmake-generator-and-possible-improvement/14176)

<div class="topic-metadata">

**Author:** [@Chinouo](https://discourse.cmake.org/u/Chinouo)\
**Replies:** 1\
**Last updated:** [July 20, 2025, 2:47am UTC](https://discourse.cmake.org/t/show-live-issues-problem-in-xcode-with-cmake-generator-and-possible-improvement/14176 "2025-07-20T02:47:03Z")

</div>

By default, CMake generates a .xcodeproj file, Xcode can index the code properly, but the Show Live Issues feature doesn’t work with this file. Code issues are only shown after building, However, if I create a new Xcode…

---

## [Support for reduced bmi in clang?](https://discourse.cmake.org/t/support-for-reduced-bmi-in-clang/14258)

<div class="topic-metadata">

**Author:** [@gracicot](https://discourse.cmake.org/u/gracicot)\
**Replies:** 4\
**Last updated:** [June 18, 2025, 8:28pm UTC](https://discourse.cmake.org/t/support-for-reduced-bmi-in-clang/14258 "2025-06-18T20:28:40Z")

</div>

Hi! Clang now has support for one phase compilation through -fmodules-reduced-bmi, just like GCC and MSVC does. Is there a way to use this new compiler feature in CMake C++20 modules support? I searched and couldn’t find…

---

## [Import std in clang with custom stdlibc++](https://discourse.cmake.org/t/import-std-in-clang-with-custom-stdlibc/14042)

<div class="topic-metadata">

**Author:** [@krzysztofkortas](https://discourse.cmake.org/u/krzysztofkortas)\
**Replies:** 3\
**Last updated:** [June 5, 2025, 7:28pm UTC](https://discourse.cmake.org/t/import-std-in-clang-with-custom-stdlibc/14042 "2025-06-05T19:28:42Z")

</div>

Merge request 10727 added support for import std using clang and stdlibc++. I use clang with a custom gcc installation passed through a flag --gcc-install-dir via CMAKE\_CXX\_FLAGS. In the Clang-CXX-CXXImportStd.cmake fil…

---

## [Specifying linker by path is broken!](https://discourse.cmake.org/t/specifying-linker-by-path-is-broken/13441)

<div class="topic-metadata">

**Author:** [@Time0o](https://discourse.cmake.org/u/Time0o)\
**Replies:** 4\
**Last updated:** [January 21, 2025, 12:53pm UTC](https://discourse.cmake.org/t/specifying-linker-by-path-is-broken/13441 "2025-01-21T12:53:36Z")

</div>

According to the documentation the following should be possible: cmake -B build \\ -DCMAKE\_C\_COMPILER=/llvm-project/llvm/build/projects/bin/clang \\ -DCMAKE\_CXX\_COMPILER=/llvm-project/llvm/build/projects/b…

---

## [How to use custom Clang build with VS generator](https://discourse.cmake.org/t/how-to-use-custom-clang-build-with-vs-generator/13158)

<div class="topic-metadata">

**Author:** [@Angew](https://discourse.cmake.org/u/Angew)\
**Replies:** 0\
**Last updated:** [December 9, 2024, 10:49am UTC](https://discourse.cmake.org/t/how-to-use-custom-clang-build-with-vs-generator/13158 "2024-12-09T10:49:07Z")

</div>

Is there a way to fully use a custom installation of Clang with the VS generator (2022 in my case) in CMake? I have a custom build & installation of Clang. Based on MS information on using custom Clang in VS, I was able…

---

## [CMAKE\_PREFIX\_PATH with clang-cl didn't find package](https://discourse.cmake.org/t/cmake-prefix-path-with-clang-cl-didnt-find-package/13109)

<div class="topic-metadata">

**Author:** [@gaz0](https://discourse.cmake.org/u/gaz0)\
**Replies:** 4\
**Last updated:** [December 3, 2024, 8:33pm UTC](https://discourse.cmake.org/t/cmake-prefix-path-with-clang-cl-didnt-find-package/13109 "2024-12-03T20:33:41Z")

</div>

I had a small MSVC x64 project using the template library inja, just to check that I could work with it in a larger project. It used find\_package to locate where cget installed the inja package. To do that I set CMAKE\_PR…

---

## [Import C++ Standard Library Headers on CMake 3.30](https://discourse.cmake.org/t/import-c-standard-library-headers-on-cmake-3-30/11354)

<div class="topic-metadata">

**Author:** [@04a](https://discourse.cmake.org/u/04a)\
**Replies:** 3\
**Last updated:** [September 29, 2024, 9:49pm UTC](https://discourse.cmake.org/t/import-c-standard-library-headers-on-cmake-3-30/11354 "2024-09-29T21:49:50Z")

</div>

Hi, I’m trying to write a CMakeLists to compile C++ code with import \<...\>;, like: // main.cpp import \<iostream\>; int main() { std::cout \<\< "Hello World" \<\< std::endl; return 0; } It can be compiled by a simple co…

---

## [CMake error calling sh](https://discourse.cmake.org/t/cmake-error-calling-sh/11117)

<div class="topic-metadata">

**Author:** [@TritiumXs](https://discourse.cmake.org/u/TritiumXs)\
**Replies:** 1\
**Last updated:** [July 1, 2024, 1:46pm UTC](https://discourse.cmake.org/t/cmake-error-calling-sh/11117 "2024-07-01T13:46:12Z")

</div>

OS: Windows10 with MSYS2 When I am using PowerShell and VS Code, CMake incorrectly invoked the sh in MSYS, and the sh in msys2 incorrectly handled Windows-style paths, which resulted in my clang not being called correct…

---

## [\[Issue\] CMake error invoke sh](https://discourse.cmake.org/t/issue-cmake-error-invoke-sh/11119)

<div class="topic-metadata">

**Author:** [@TritiumXs](https://discourse.cmake.org/u/TritiumXs)\
**Replies:** 1\
**Last updated:** [June 27, 2024, 10:14pm UTC](https://discourse.cmake.org/t/issue-cmake-error-invoke-sh/11119 "2024-06-27T22:14:33Z")

</div>

When I am using PowerShell and VS Code, CMake incorrectly invoked the sh in MSYS, and the sh in msys2 incorrectly handled Windows-style paths, which resulted in my clang not being called correctly. How should I handle th…

---

## [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 …

---

## [Assert while compiling CheckFunctionExists.cpp with llvm clang when -fveclib=SVML flag is enabled](https://discourse.cmake.org/t/assert-while-compiling-checkfunctionexists-cpp-with-llvm-clang-when-fveclib-svml-flag-is-enabled/10481)

<div class="topic-metadata">

**Author:** [@BBWork](https://discourse.cmake.org/u/BBWork)\
**Replies:** 1\
**Last updated:** [April 11, 2024, 3:32am UTC](https://discourse.cmake.org/t/assert-while-compiling-checkfunctionexists-cpp-with-llvm-clang-when-fveclib-svml-flag-is-enabled/10481 "2024-04-11T03:32:17Z")

</div>

CheckFunctionExists.c is a part of CMake and it is used by cmake to find whether the libarary function is supported or not. When CheckFunctionExists.c is compiled with llvm clang and with -fveclib=SVML flag. Assertion is…

---

## [Using clang-tidy with cross compilation](https://discourse.cmake.org/t/using-clang-tidy-with-cross-compilation/5435)

<div class="topic-metadata">

**Author:** [@AdamWRichardson](https://discourse.cmake.org/u/AdamWRichardson)\
**Replies:** 6\
**Last updated:** [March 15, 2024, 11:33pm UTC](https://discourse.cmake.org/t/using-clang-tidy-with-cross-compilation/5435 "2024-03-15T23:33:35Z")

</div>

This may be a really silly issue but I’m struggling to get clang-tidy working while cross compiling. I’m using the RSIC-V GCC toolchain to generate the binaries for a small embedded project I have and as part of the bui…

---

## [Installed module library can't find imported headers \[Ubuntu 22.04 LTS, CMake 3.28.1, Ninja 1.11.1 and Clang 17.0.6\]](https://discourse.cmake.org/t/installed-module-library-cant-find-imported-headers-ubuntu-22-04-lts-cmake-3-28-1-ninja-1-11-1-and-clang-17-0-6/9819)

<div class="topic-metadata">

**Author:** [@josecruz](https://discourse.cmake.org/u/josecruz)\
**Replies:** 22\
**Last updated:** [February 25, 2024, 12:29pm UTC](https://discourse.cmake.org/t/installed-module-library-cant-find-imported-headers-ubuntu-22-04-lts-cmake-3-28-1-ninja-1-11-1-and-clang-17-0-6/9819 "2024-02-25T12:29:05Z")

</div>

Using Ubuntu 22.04 LTS, CMake 3.28.1, Ninja 1.11.1 and Clang 17.0.6, I’m trying to create a library using modules, supported under these conditions, as described at import-cmake-the-experiment-is-over. I managed to succ…

---

## [OpenMP linking errors on Windows using Ninja and clang](https://discourse.cmake.org/t/openmp-linking-errors-on-windows-using-ninja-and-clang/7246)

<div class="topic-metadata">

**Author:** [@KrisThielemans](https://discourse.cmake.org/u/KrisThielemans)\
**Replies:** 2\
**Last updated:** [February 19, 2024, 1:29pm UTC](https://discourse.cmake.org/t/openmp-linking-errors-on-windows-using-ninja-and-clang/7246 "2024-02-19T13:29:55Z")

</div>

In our project we use OpenMP successfully in many systems, including Windows with VS compiler (and I believe both VS generator and Ninja). Relevant lines are essentially target\_link\_libraries(buildblock OpenMP::OpenMP\_C…

---

## [Whats the idiomatic way to run clang-tidy on header files with CMake?](https://discourse.cmake.org/t/whats-the-idiomatic-way-to-run-clang-tidy-on-header-files-with-cmake/9530)

<div class="topic-metadata">

**Author:** [@tom](https://discourse.cmake.org/u/tom)\
**Replies:** 7\
**Last updated:** [February 4, 2024, 5:24pm UTC](https://discourse.cmake.org/t/whats-the-idiomatic-way-to-run-clang-tidy-on-header-files-with-cmake/9530 "2024-02-04T17:24:49Z")

</div>

I would like to run clang-tidy on header files. I would also like to apply the fixits that are automatically generated. This is not trivial, because my header files are included many times throughout my codebase, so my…

---

## [How to share precompiled headers via an interface library](https://discourse.cmake.org/t/how-to-share-precompiled-headers-via-an-interface-library/9933)

<div class="topic-metadata">

**Author:** [@Kentzo](https://discourse.cmake.org/u/Kentzo)\
**Replies:** 7\
**Last updated:** [January 27, 2024, 9:04am UTC](https://discourse.cmake.org/t/how-to-share-precompiled-headers-via-an-interface-library/9933 "2024-01-27T09:04:13Z")

</div>

From target\_precompile\_headers: A notable exception to this is where an interface library is created to define a commonly used set of precompile headers in one place and then other targets link to that interface librar…

---

## [\[RFC\] Adding support for Clang within the OpenACC module](https://discourse.cmake.org/t/rfc-adding-support-for-clang-within-the-openacc-module/9930)

<div class="topic-metadata">

**Author:** [@ajarmusch](https://discourse.cmake.org/u/ajarmusch)\
**Replies:** 1\
**Last updated:** [January 25, 2024, 2:56pm UTC](https://discourse.cmake.org/t/rfc-adding-support-for-clang-within-the-openacc-module/9930 "2024-01-25T14:56:01Z")

</div>

Hello, In support of the recent ongoing efforts to implement OpenACC in Clang/LLVM, Given LLVM’s utilization of CMake, we want to add support for the LLVM/Clang compiler in the OpenACC module. This would be highly used…

---

## [How to find OpenMP with clang on macOS](https://discourse.cmake.org/t/how-to-find-openmp-with-clang-on-macos/8860)

<div class="topic-metadata">

**Author:** [@mathomp4](https://discourse.cmake.org/u/mathomp4)\
**Replies:** 12\
**Last updated:** [December 21, 2023, 7:26am UTC](https://discourse.cmake.org/t/how-to-find-openmp-with-clang-on-macos/8860 "2023-12-21T07:26:16Z")

</div>

All, I’m feeling really stupid right now. Not sure what I’m doing wrong. First, I’m a Fortran programmer, so I am not good at C. But, when I try and use OpenMP and Clang, I can’t seem to. Many things on line say I need …

---

## [Building gollvm on Windows 10 (i386): unable to determine host target triple; string sub-command REGEX, mode MATCH needs at least 5 arguments; Unknown architecture host](https://discourse.cmake.org/t/building-gollvm-on-windows-10-i386-unable-to-determine-host-target-triple-string-sub-command-regex-mode-match-needs-at-least-5-arguments-unknown-architecture-host/1654)

<div class="topic-metadata">

**Author:** [@Ivan\_Serdyuk](https://discourse.cmake.org/u/Ivan_Serdyuk)\
**Replies:** 5\
**Last updated:** [December 8, 2023, 9:45pm UTC](https://discourse.cmake.org/t/building-gollvm-on-windows-10-i386-unable-to-determine-host-target-triple-string-sub-command-regex-mode-match-needs-at-least-5-arguments-unknown-architecture-host/1654 "2023-12-08T21:45:17Z")

</div>

I have experienced some issues (gollvm’s project README), which look pretty much CMake related: cmake -DCMAKE\_BUILD\_TYPE=Debug -DCMAKE\_CXX\_FLAGS=-stdlib=libc++ -DCMAKE\_CXX\_COMPILER=clang++ -DCMAKE\_C\_COMPILER=clang -DGO…

---

## [Using C++20 modules in a multiple directory project](https://discourse.cmake.org/t/using-c-20-modules-in-a-multiple-directory-project/9239)

<div class="topic-metadata">

**Author:** [@nitroglyceryne](https://discourse.cmake.org/u/nitroglyceryne)\
**Replies:** 4\
**Last updated:** [October 24, 2023, 7:28pm UTC](https://discourse.cmake.org/t/using-c-20-modules-in-a-multiple-directory-project/9239 "2023-10-24T19:28:37Z")

</div>

Hey everyone ! I wanted to try C++ modules on a project I’m working on. This project contains multiple directories and multiple CMakeLists.txt files. The structure is as follows: Root/ ├─ Kernel/ │ ├─ CMakeLists.txt │…

---

## [CMake goes into an infinite loop when there are two stand-alone subprojects with two different compilers within the same build](https://discourse.cmake.org/t/cmake-goes-into-an-infinite-loop-when-there-are-two-stand-alone-subprojects-with-two-different-compilers-within-the-same-build/8833)

<div class="topic-metadata">

**Author:** [@chudur-budur](https://discourse.cmake.org/u/chudur-budur)\
**Replies:** 1\
**Last updated:** [August 29, 2023, 1:54am UTC](https://discourse.cmake.org/t/cmake-goes-into-an-infinite-loop-when-there-are-two-stand-alone-subprojects-with-two-different-compilers-within-the-same-build/8833 "2023-08-29T01:54:32Z")

</div>

I am new to CMake. What I want to have is two different stand-alone subprojects within one “root” project such that those two subprojects could be built independently. Given that those two subprojects use two different t…

---

## [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…

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