# \#gen:ninja

**URL:** https://discourse.cmake.org/tag/gen-ninja/8.md

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

---

## [A method of writing that can handle file name changes.](https://discourse.cmake.org/t/a-method-of-writing-that-can-handle-file-name-changes/15825)

<div class="topic-metadata">

**Author:** [@amagi](https://discourse.cmake.org/u/amagi)\
**Replies:** 5\
**Last updated:** [September 12, 2026, 2:54am UTC](https://discourse.cmake.org/t/a-method-of-writing-that-can-handle-file-name-changes/15825 "2026-09-12T02:54:38Z")

</div>

The following code requires a cmake --build build command to build if the filename is changed. However, emptying and regenerating the build directory is cumbersome, so I’ve assigned a single command to a shortcut key for…

---

## [cmake -G Ninja has errors](https://discourse.cmake.org/t/cmake-g-ninja-has-errors/15787)

<div class="topic-metadata">

**Author:** [@SlipBits](https://discourse.cmake.org/u/SlipBits)\
**Replies:** 1\
**Last updated:** [August 19, 2026, 8:48pm UTC](https://discourse.cmake.org/t/cmake-g-ninja-has-errors/15787 "2026-08-19T20:48:29Z")

</div>

cmake 4.2.1 Win11 home (x86-64) Ninja 1.13.1 (windows version) cygwin 3.7.0 I am brand new to cmake. A complete novice. So, if my question is dumb then that tells the truth about me. cmake -G Ninja -B build produ…

---

## [Target requires "CXX26" but CMake does not know the flags to enable it](https://discourse.cmake.org/t/target-requires-cxx26-but-cmake-does-not-know-the-flags-to-enable-it/15762)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 5\
**Last updated:** [August 13, 2026, 2:02pm UTC](https://discourse.cmake.org/t/target-requires-cxx26-but-cmake-does-not-know-the-flags-to-enable-it/15762 "2026-08-13T14:02:44Z")

</div>

I want to test c++26 with import std; too if(FMT\_MODULE) add\_library(fmt-module) add\_library(fmt::fmt-module ALIAS fmt-module) target\_compile\_options( fmt-module PUBLIC $\<$\<AND:$\<COMPILE\_LANG…

---

## [let cmake use clang-cl when use ninja, not clang++ ,so people can migrate from visual studio nmake to ninja](https://discourse.cmake.org/t/let-cmake-use-clang-cl-when-use-ninja-not-clang-so-people-can-migrate-from-visual-studio-nmake-to-ninja/15755)

<div class="topic-metadata">

**Author:** [@photonest3](https://discourse.cmake.org/u/photonest3)\
**Replies:** 1\
**Last updated:** [July 22, 2026, 2:35am UTC](https://discourse.cmake.org/t/let-cmake-use-clang-cl-when-use-ninja-not-clang-so-people-can-migrate-from-visual-studio-nmake-to-ninja/15755 "2026-07-22T02:35:47Z")

</div>

let cmake use clang-cl when use ninja, not clang++ ,so people can migrate from visual studio nmake to ninja. OpenClaw (codebuddy.ai) output translate: Here’s a natural, technically-accurate English translation (good fo…

---

## [Why is -isystem include path not used while CXX\_MODULE dependencies scan?](https://discourse.cmake.org/t/why-is-isystem-include-path-not-used-while-cxx-module-dependencies-scan/15729)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 4\
**Last updated:** [July 6, 2026, 7:23am UTC](https://discourse.cmake.org/t/why-is-isystem-include-path-not-used-while-cxx-module-dependencies-scan/15729 "2026-07-06T07:23:11Z")

</div>

same problem with clang-22 and gcc-16 on OSX bash-5.3$ ninja -C build/ -j 1 -k 1 -v ninja: Entering directory \`build/' \[1/183\] "/usr/local/Cellar/llvm/22.1.8/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/…

---

## [Qt 6.10.0 building from sources. GNU C++ compiler error: unrecognized command-line option ‘-R’ while using GCC 14.3.0](https://discourse.cmake.org/t/qt-6-10-0-building-from-sources-gnu-c-compiler-error-unrecognized-command-line-option-r-while-using-gcc-14-3-0/15736)

<div class="topic-metadata">

**Author:** [@mans5647](https://discourse.cmake.org/u/mans5647)\
**Replies:** 0\
**Last updated:** [July 5, 2026, 8:37am UTC](https://discourse.cmake.org/t/qt-6-10-0-building-from-sources-gnu-c-compiler-error-unrecognized-command-line-option-r-while-using-gcc-14-3-0/15736 "2026-07-05T08:37:56Z")

</div>

Hi. I configured QT 6.10.0 from sources using following command: $ ./configure -shared -no-opengl -- -B build/ --fresh After that, It gave me usual and error-free output: -- The CXX compiler identification is GNU 14.3…

---

## [file not found error: /lib/share/libc++/v1/std.cppm with Clang 21.1.7 on Linux](https://discourse.cmake.org/t/file-not-found-error-lib-share-libc-v1-std-cppm-with-clang-21-1-7-on-linux/15368)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 4\
**Last updated:** [June 29, 2026, 6:14pm UTC](https://discourse.cmake.org/t/file-not-found-error-lib-share-libc-v1-std-cppm-with-clang-21-1-7-on-linux/15368 "2026-06-29T18:14:02Z")

</div>

clang++ --version Ubuntu clang version 21.1.7 (++20251127113503+9ed1927442a4-1~exp1~20251127113518.64) Target: x86\_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm-21/bin clang++ -print-file-name=libc++.mo…

---

## [How to be able to choose Debug or Release build in CMake](https://discourse.cmake.org/t/how-to-be-able-to-choose-debug-or-release-build-in-cmake/15727)

<div class="topic-metadata">

**Author:** [@Maaz\_Madha](https://discourse.cmake.org/u/Maaz_Madha)\
**Replies:** 1\
**Last updated:** [June 25, 2026, 3:17pm UTC](https://discourse.cmake.org/t/how-to-be-able-to-choose-debug-or-release-build-in-cmake/15727 "2026-06-25T15:17:46Z")

</div>

Hi all How do I configure build or debug releases for a multi directory project, cross compiling project with CMakeLists.txt for each of the directories. Do I do this in CMakePresets.json or pass it as a command, and i…

---

## [CPS doesn't work with Boost::headers](https://discourse.cmake.org/t/cps-doesnt-work-with-boost-headers/15720)

<div class="topic-metadata">

**Author:** [@Yanzhao\_Wang](https://discourse.cmake.org/u/Yanzhao_Wang)\
**Replies:** 4\
**Last updated:** [June 25, 2026, 1:30pm UTC](https://discourse.cmake.org/t/cps-doesnt-work-with-boost-headers/15720 "2026-06-25T13:30:17Z")

</div>

Hi, I have a project which uses the Boost library through the target Boost::headers . I really like the idea of CPS and I would like to use it to install the project. But I encountered a configuration error: CMake Erro…

---

## [Running postbuild tasks with ninja](https://discourse.cmake.org/t/running-postbuild-tasks-with-ninja/13623)

<div class="topic-metadata">

**Author:** [@noahdav](https://discourse.cmake.org/u/noahdav)\
**Replies:** 4\
**Last updated:** [June 4, 2026, 7:06pm UTC](https://discourse.cmake.org/t/running-postbuild-tasks-with-ninja/13623 "2026-06-04T19:06:03Z")

</div>

Hi, We have been using the visual studio generators and it seems to work for the most part but there are a few issues that we are trying to solve that are not supported with the visual studio generators. We have been l…

---

## [presets: Omitting \`generator\` does not default to regular generator discovery procedure](https://discourse.cmake.org/t/presets-omitting-generator-does-not-default-to-regular-generator-discovery-procedure/7910)

<div class="topic-metadata">

**Author:** [@dabe](https://discourse.cmake.org/u/dabe)\
**Replies:** 2\
**Last updated:** [June 1, 2026, 12:38am UTC](https://discourse.cmake.org/t/presets-omitting-generator-does-not-default-to-regular-generator-discovery-procedure/7910 "2026-06-01T00:38:44Z")

</div>

I have a project that I’d like to use different generators for depending on the OS that is compiling it (specifically, Unix Makefiles for Linux and Visual Studio/Ninja for Windows). I’d like to just let the automatic ge…

---

## [Experimental SBOM: Statically linked dependencies show up as "Shared"](https://discourse.cmake.org/t/experimental-sbom-statically-linked-dependencies-show-up-as-shared/15648)

<div class="topic-metadata">

**Author:** [@Mythra](https://discourse.cmake.org/u/Mythra)\
**Replies:** 0\
**Last updated:** [May 9, 2026, 7:02pm UTC](https://discourse.cmake.org/t/experimental-sbom-statically-linked-dependencies-show-up-as-shared/15648 "2026-05-09T19:02:25Z")

</div>

I’m attempting to test out the new experimental SBOM generation feature, and it seems I have statically linked libraries showing up as “shared” libraries in the generated SPDX. I know this feature is experimental, but be…

---

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

---

## [error: C++26 was enabled in precompiled file 'CMakeFiles/\_\_cmake\_cxx23.dir/std.pcm' but is currently disabled](https://discourse.cmake.org/t/error-c-26-was-enabled-in-precompiled-file-cmakefiles-cmake-cxx23-dir-std-pcm-but-is-currently-disabled/15467)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 7\
**Last updated:** [April 16, 2026, 9:03am UTC](https://discourse.cmake.org/t/error-c-26-was-enabled-in-precompiled-file-cmakefiles-cmake-cxx23-dir-std-pcm-but-is-currently-disabled/15467 "2026-04-16T09:03:14Z")

</div>

I see this strange error when I try to build with an installed CXX\_MODULES, The installed module was build with: # CMake requires the language standard to be specified as compile feature # when a target provides C++23 …

---

## [Incorrect link library flags in mixed C++/ASM project using MSVC with Clang](https://discourse.cmake.org/t/incorrect-link-library-flags-in-mixed-c-asm-project-using-msvc-with-clang/15600)

<div class="topic-metadata">

**Author:** [@MEhrn00](https://discourse.cmake.org/u/MEhrn00)\
**Replies:** 2\
**Last updated:** [April 14, 2026, 5:32pm UTC](https://discourse.cmake.org/t/incorrect-link-library-flags-in-mixed-c-asm-project-using-msvc-with-clang/15600 "2026-04-14T17:32:53Z")

</div>

I am experiencing an issue in a mixed C++/ASM project on Windows using MSVC as the C++ compiler and Clang for the assembler. When configuring a project for Ninja passing -DCMAKE\_ASM\_COMPILER=clang, bare link library nam…

---

## [install(TARGETS ... CXX\_MODULES\_BMI ...) does not always install a file?](https://discourse.cmake.org/t/install-targets-cxx-modules-bmi-does-not-always-install-a-file/15574)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 5\
**Last updated:** [March 26, 2026, 10:24am UTC](https://discourse.cmake.org/t/install-targets-cxx-modules-bmi-does-not-always-install-a-file/15574 "2026-03-26T10:24:27Z")

</div>

I struggle over the CXX\_MODULES install BMI. Sometimes this has no effect or some BMI files are missing? see to Why are the build and installed BMI files not used? I use always this cmake install function call: …

---

## [Import std with Ninja Multi-Config generator does not work in Release?](https://discourse.cmake.org/t/import-std-with-ninja-multi-config-generator-does-not-work-in-release/15561)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 6\
**Last updated:** [March 18, 2026, 8:39pm UTC](https://discourse.cmake.org/t/import-std-with-ninja-multi-config-generator-does-not-work-in-release/15561 "2026-03-18T20:39:55Z")

</div>

~/.local/bin/cmake --version cmake version 4.2.3 The project is Transition to CXX\_MOUDLES for asio root@b40851a7588d:/home/builder/workdir/build/linux-gcc/src/tests/unit/find-package-test# ~/.local/bin/cmake --build .…

---

## [cmake --install . --component ? : how get the list of valid component to install?](https://discourse.cmake.org/t/cmake-install-component-how-get-the-list-of-valid-component-to-install/15510)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 6\
**Last updated:** [March 18, 2026, 7:42am UTC](https://discourse.cmake.org/t/cmake-install-component-how-get-the-list-of-valid-component-to-install/15510 "2026-03-18T07:42:22Z")

</div>

cmdoption-cmake-install-component does not help to get list of possible components to install bash-5.3$ cmake --install . --component CMake Error: Invalid value used with --component Usage: cmake --install \<dir\> \[option…

---

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

---

## [Experimental \`import std\` support not enabled when detecting toolchain clang-22.1?](https://discourse.cmake.org/t/experimental-import-std-support-not-enabled-when-detecting-toolchain-clang-22-1/15534)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 1\
**Last updated:** [March 1, 2026, 1:00pm UTC](https://discourse.cmake.org/t/experimental-import-std-support-not-enabled-when-detecting-toolchain-clang-22-1/15534 "2026-03-01T13:00:41Z")

</div>

bash-5.3$ ~/.local/bin/cmake --workflow llvm-release --fresh Executing workflow step 1 of 3: configure preset "llvm-release" -- CXXFLAGS=-stdlib=libc++ 'brew' '--prefix' 'llvm' -- LLVM\_DIR=/usr/local/Cellar/llvm/22.1.0 …

---

## [CMAKE\_CXX\_MODULE\_STD: cmake cmake v4.3.0-rc1 generate 30 times more targets?](https://discourse.cmake.org/t/cmake-cxx-module-std-cmake-cmake-v4-3-0-rc1-generate-30-times-more-targets/15512)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 4\
**Last updated:** [February 27, 2026, 3:43pm UTC](https://discourse.cmake.org/t/cmake-cxx-module-std-cmake-cmake-v4-3-0-rc1-generate-30-times-more-targets/15512 "2026-02-27T15:43:36Z")

</div>

@ben.boeckel the dependency scan seems to be the overkill at the moment? bash-5.3$ make release cmake --preset release --log-level=VERBOSE --fresh Preset CMake variables: BEMAN\_USE\_MODULES:BOOL="TRUE" BEMAN\_USE\_STD…

---

## [Linker error with import std example](https://discourse.cmake.org/t/linker-error-with-import-std-example/14224)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 7\
**Last updated:** [February 20, 2026, 3:07pm UTC](https://discourse.cmake.org/t/linker-error-with-import-std-example/14224 "2026-02-20T15:07:16Z")

</div>

I have this simple main.cxx: import std; int main(int argc, char\* argv\[\]) { if (argc \> 0 && argv\[0\]) { std::string argv0 = argv\[0\]; std::print("program: {}/n", argv0); } return 0; } and this CMakeLists.t…

---

## [Import std - cmake 3.30 - "config mismatch" error](https://discourse.cmake.org/t/import-std-cmake-3-30-config-mismatch-error/12908)

<div class="topic-metadata">

**Author:** [@Kelarov](https://discourse.cmake.org/u/Kelarov)\
**Replies:** 3\
**Last updated:** [February 20, 2026, 5:48am UTC](https://discourse.cmake.org/t/import-std-cmake-3-30-config-mismatch-error/12908 "2026-02-20T05:48:14Z")

</div>

Hi all. I am trying to apply what the import std in CMake 3.30 post does to use in a project, but am facing errors. My setup: CMakeLists.txt CMakePresets.json src/CMakeLists.txt src/kk-intro.cppm src/kk-intro.cc src/m…

---

## [How to install multiple FILE\_SET for a library in a generic way?](https://discourse.cmake.org/t/how-to-install-multiple-file-set-for-a-library-in-a-generic-way/15489)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 24\
**Last updated:** [February 11, 2026, 3:47pm UTC](https://discourse.cmake.org/t/how-to-install-multiple-file-set-for-a-library-in-a-generic-way/15489 "2026-02-11T15:47:46Z")

</div>

With this CMake code snippet from boost/tools/cmake I can install i.e Boost::any lib with HEADERS and CXX\_MODULES. But it fails, if there is more than one FILE\_SET used in a library target! if(NOT CMAKE\_VERSION VERSIO…

---

## [@\*.cppm.o.modmap files not found by clang-tidy?](https://discourse.cmake.org/t/cppm-o-modmap-files-not-found-by-clang-tidy/15354)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 2\
**Last updated:** [February 9, 2026, 3:54am UTC](https://discourse.cmake.org/t/cppm-o-modmap-files-not-found-by-clang-tidy/15354 "2026-02-09T03:54:16Z")

</div>

is it a clang-tidy problem oder a wrong CMake generated compile\_commands.jsonfile? Running clang-tidy for 4 files out of 4 in compilation database ... \[1/4\]\[6.3s\] /usr/local/Cellar/llvm/21.1.6/bin/clang-tidy -checks=-\*,…

---

## [import std appears to be broken in release 4.0.2](https://discourse.cmake.org/t/import-std-appears-to-be-broken-in-release-4-0-2/14062)

<div class="topic-metadata">

**Author:** [@abbator](https://discourse.cmake.org/u/abbator)\
**Replies:** 5\
**Last updated:** [February 9, 2026, 3:47am UTC](https://discourse.cmake.org/t/import-std-appears-to-be-broken-in-release-4-0-2/14062 "2026-02-09T03:47:06Z")

</div>

I attempted to upgrade to 4.0.2 but found that my modules projects using import std are now unbuildable. I’m using Visual Studio Community 17.15.0 Preview 4.0 + Ninja. After fiddling across a large-scale project with a …

---

## [mark\_as\_advanced strange behaviour](https://discourse.cmake.org/t/mark-as-advanced-strange-behaviour/15461)

<div class="topic-metadata">

**Author:** [@Tharrik](https://discourse.cmake.org/u/Tharrik)\
**Replies:** 1\
**Last updated:** [February 9, 2026, 2:20am UTC](https://discourse.cmake.org/t/mark-as-advanced-strange-behaviour/15461 "2026-02-09T02:20:54Z")

</div>

I’m currently learning in-deep CMake and I found something I don’t understand. I have this script: cmake\_minimum\_required(VERSION 4.2) project(CmakeLearn VERSION 1.0 LANGUAGES CXX) # check that CMAKE\_BUILD\_TYPE is de…

---

## [Linker error with CXX\_MODULES](https://discourse.cmake.org/t/linker-error-with-cxx-modules/15449)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 4\
**Last updated:** [January 12, 2026, 12:33am UTC](https://discourse.cmake.org/t/linker-error-with-cxx-modules/15449 "2026-01-12T00:33:14Z")

</div>

I have a project that build Boost with CXX\_MODULES. It works on Linux and OSX, but not on windows? The type\_index lib is a header only module the any lib too. The any module itself imports the type\_index. \[367/557\] Lin…

---

## [CMAKE\_UNITY\_BUILD and CXX\_MODULES](https://discourse.cmake.org/t/cmake-unity-build-and-cxx-modules/15450)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 1\
**Last updated:** [January 10, 2026, 3:10am UTC](https://discourse.cmake.org/t/cmake-unity-build-and-cxx-modules/15450 "2026-01-10T03:10:25Z")

</div>

I am wondering why CMAKE\_CXX\_SCAN\_FOR\_MODULES disables UNITY\_BUILD on all plattforms?

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