# Usage

**URL:** https://discourse.cmake.org/c/usage/12.md?page=1

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

**Page:** 2

---

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

---

## [What is a 'head' target?](https://discourse.cmake.org/t/what-is-a-head-target/15630)

<div class="topic-metadata">

**Author:** [@MickeJ](https://discourse.cmake.org/u/MickeJ)\
**Replies:** 1\
**Last updated:** [July 2, 2026, 2:27pm UTC](https://discourse.cmake.org/t/what-is-a-head-target/15630 "2026-07-02T14:27:47Z")

</div>

In the documentation i see reference to a thing name ‘head’ target. What is the definition of a head target? For example if my project only contains one target executable and many libs is the exe target the head target? …

---

## [disabling C++ extensions](https://discourse.cmake.org/t/disabling-c-extensions/15579)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 7\
**Last updated:** [July 1, 2026, 7:33am UTC](https://discourse.cmake.org/t/disabling-c-extensions/15579 "2026-07-01T07:33:39Z")

</div>

I think the topic title is self-explanatory. So far, it seems that set\_target\_properties(${TARGET\_NAME} PROPERTIES CXX\_EXTENSIONS OFF) does nothing more than using -std=c++xx instead of -std=gnu++xx. For gcc I must add…

---

## [add\_library/add\_executable sources do not depend on compiler executable](https://discourse.cmake.org/t/add-library-add-executable-sources-do-not-depend-on-compiler-executable/15662)

<div class="topic-metadata">

**Author:** [@wenju-he](https://discourse.cmake.org/u/wenju-he)\
**Replies:** 4\
**Last updated:** [June 29, 2026, 6:19pm UTC](https://discourse.cmake.org/t/add-library-add-executable-sources-do-not-depend-on-compiler-executable/15662 "2026-06-29T18:19:41Z")

</div>

By default, CMake does not add the compiler executable as a dependency of compiled objects. Sources are rebuilt when they change, but not when the compiler changes. This causes a concrete problem in toolchain bootstrap …

---

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

---

## [For posterity: another of these CMake "hacks" — No CMAKE\_C\_COMPILER could be found.](https://discourse.cmake.org/t/for-posterity-another-of-these-cmake-hacks-no-cmake-c-compiler-could-be-found/15721)

<div class="topic-metadata">

**Author:** [@exoosh](https://discourse.cmake.org/u/exoosh)\
**Replies:** 9\
**Last updated:** [June 23, 2026, 3:15pm UTC](https://discourse.cmake.org/t/for-posterity-another-of-these-cmake-hacks-no-cmake-c-compiler-could-be-found/15721 "2026-06-23T15:15:57Z")

</div>

So, CMake seems incapable of passing through /pdbaltpath:%\_PDB% when given in a CMakeLists.txt (first learning). It somehow ends up as %%%%\_PDB%%%% which then will evaluate — assuming a foobar.exe — to %%%foobar.pdb%%% i…

---

## [newbie question about cmake escape character](https://discourse.cmake.org/t/newbie-question-about-cmake-escape-character/15722)

<div class="topic-metadata">

**Author:** [@yushang](https://discourse.cmake.org/u/yushang)\
**Replies:** 0\
**Last updated:** [June 20, 2026, 2:36am UTC](https://discourse.cmake.org/t/newbie-question-about-cmake-escape-character/15722 "2026-06-20T02:36:21Z")

</div>

Hi guys, by this syntax https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#escape-sequences $ is not a valid escape character, but \\${} works. What I’v missed?

---

## [Help with Cmake version problem stopping IC design software install](https://discourse.cmake.org/t/help-with-cmake-version-problem-stopping-ic-design-software-install/15716)

<div class="topic-metadata">

**Author:** [@Fasttrain77](https://discourse.cmake.org/u/Fasttrain77)\
**Replies:** 1\
**Last updated:** [June 17, 2026, 7:09pm UTC](https://discourse.cmake.org/t/help-with-cmake-version-problem-stopping-ic-design-software-install/15716 "2026-06-17T19:09:38Z")

</div>

Hi: Please forward this to the correct area if this isn’t the right team. I am a student working on an online integrated circuit design course. I am using ubuntu linux 26. I am trying to install tools so I can do the co…

---

## [find\_package: can't find "jansson" library](https://discourse.cmake.org/t/find-package-cant-find-jansson-library/15711)

<div class="topic-metadata">

**Author:** [@bam](https://discourse.cmake.org/u/bam)\
**Replies:** 1\
**Last updated:** [June 17, 2026, 9:23am UTC](https://discourse.cmake.org/t/find-package-cant-find-jansson-library/15711 "2026-06-17T09:23:41Z")

</div>

Hi, cmake can’t find “jansson” library: \[cmake\] CMake Error at CMakeLists.txt:187 (find\_package): \[cmake\] Could not find a package configuration file provided by "jansson" with any \[cmake\] of the following names: \[c…

---

## [ninja: build stopped: subcommand failed.](https://discourse.cmake.org/t/ninja-build-stopped-subcommand-failed/15713)

<div class="topic-metadata">

**Author:** [@perdrix](https://discourse.cmake.org/u/perdrix)\
**Replies:** 2\
**Last updated:** [June 16, 2026, 9:53am UTC](https://discourse.cmake.org/t/ninja-build-stopped-subcommand-failed/15713 "2026-06-16T09:53:04Z")

</div>

I’m running a CMake build and got part way through and was then presented with the cryptic message in the subject line: ninja: build stopped: subcommand failed. The file ninja.log in my build directory doesn’t give m…

---

## [Unexpected/incomplete \`install\` of CSharp library/executable/NuGet](https://discourse.cmake.org/t/unexpected-incomplete-install-of-csharp-library-executable-nuget/15708)

<div class="topic-metadata">

**Author:** [@kevinyee](https://discourse.cmake.org/u/kevinyee)\
**Replies:** 0\
**Last updated:** [June 11, 2026, 4:38am UTC](https://discourse.cmake.org/t/unexpected-incomplete-install-of-csharp-library-executable-nuget/15708 "2026-06-11T04:38:56Z")

</div>

In the example below, I would expect the everything (MyExecutable.exe, CommandLine.dll, MyLibrary.dll and Newtonsoft.Json.dll) to be installed to bin (i.e. CMAKE\_INSTALL\_BINDIR). I observe the following (output pasted be…

---

## [The C compiler "/usr/bin/cc" is not able to compile a simple test program.](https://discourse.cmake.org/t/the-c-compiler-usr-bin-cc-is-not-able-to-compile-a-simple-test-program/6258)

<div class="topic-metadata">

**Author:** [@Doug\_Rattmann](https://discourse.cmake.org/u/Doug_Rattmann)\
**Replies:** 8\
**Last updated:** [June 10, 2026, 6:18am UTC](https://discourse.cmake.org/t/the-c-compiler-usr-bin-cc-is-not-able-to-compile-a-simple-test-program/6258 "2026-06-10T06:18:23Z")

</div>

Hi I was triying to install asepire by source i followed this tutorial: How to Compile Aseprite on Ubuntu Linux - YouTube on Linux Mint 19.3 its my first time trying to install something from source and using Cmake so Ia…

---

## [How to include subdirectory with a different generator?](https://discourse.cmake.org/t/how-to-include-subdirectory-with-a-different-generator/15594)

<div class="topic-metadata">

**Author:** [@Shane](https://discourse.cmake.org/u/Shane)\
**Replies:** 10\
**Last updated:** [June 5, 2026, 9:10am UTC](https://discourse.cmake.org/t/how-to-include-subdirectory-with-a-different-generator/15594 "2026-06-05T09:10:42Z")

</div>

Hello, I have two working CMakeList.txt files - \<project root\>CMakeList.txt #\[\[ # build with shared prebuilt SDL3 library (DLL) cmake -B build -G "Ninja Multi-Config" cmake --build build build\\Debug\\hello.exe cm…

---

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

---

## [cmake --install build/ --parallel autodetect impossible](https://discourse.cmake.org/t/cmake-install-build-parallel-autodetect-impossible/15687)

<div class="topic-metadata">

**Author:** [@Andrei\_Cherniaev](https://discourse.cmake.org/u/Andrei_Cherniaev)\
**Replies:** 0\
**Last updated:** [May 31, 2026, 5:08pm UTC](https://discourse.cmake.org/t/cmake-install-build-parallel-autodetect-impossible/15687 "2026-05-31T17:08:42Z")

</div>

As you know from doc, cmake --install can be given the --parallel \<jobs\> option to specify a maximum number of jobs. Why cmake can’t autodetect max number of jobs? I am sad surprised because cmake can detect the max num…

---

## [How to trigger recompilation on change of emcc --pre-js source files?](https://discourse.cmake.org/t/how-to-trigger-recompilation-on-change-of-emcc-pre-js-source-files/15669)

<div class="topic-metadata">

**Author:** [@Shane](https://discourse.cmake.org/u/Shane)\
**Replies:** 2\
**Last updated:** [May 28, 2026, 7:06am UTC](https://discourse.cmake.org/t/how-to-trigger-recompilation-on-change-of-emcc-pre-js-source-files/15669 "2026-05-28T07:06:38Z")

</div>

Hello, I have a working CMakeLists.txt which uses the emscripten compiler frontend (emcc). The core source files are written in C++ and when they are changed, cmake --build triggers recompilation as expected. emcc also …

---

## [Setting a known commit ID in the CTest Update Step for source tarballs](https://discourse.cmake.org/t/setting-a-known-commit-id-in-the-ctest-update-step-for-source-tarballs/15664)

<div class="topic-metadata">

**Author:** [@hebasto](https://discourse.cmake.org/u/hebasto)\
**Replies:** 0\
**Last updated:** [May 26, 2026, 2:49pm UTC](https://discourse.cmake.org/t/setting-a-known-commit-id-in-the-ctest-update-step-for-source-tarballs/15664 "2026-05-26T14:49:07Z")

</div>

Hi, One of the pipelines in our CI downloads a source tarball of the master branch (generated via git archive) and extracts the top commit hash from it. Because it’s a tarball, there is no actual .git directory present. …

---

## [Generate Build Database is Empty](https://discourse.cmake.org/t/generate-build-database-is-empty/15654)

<div class="topic-metadata">

**Author:** [@mwasplund](https://discourse.cmake.org/u/mwasplund)\
**Replies:** 8\
**Last updated:** [May 26, 2026, 1:50pm UTC](https://discourse.cmake.org/t/generate-build-database-is-empty/15654 "2026-05-26T13:50:31Z")

</div>

I am attempting to experiment with the experimental CMAKE\_EXPORT\_BUILD\_DATABASE flag. I think I got it up and running to the point where the cmake\_build\_database target is generating a build\_database.json. However the se…

---

## [Cannot bootstrap CMake 4.3.2 with nvc++ compiler](https://discourse.cmake.org/t/cannot-bootstrap-cmake-4-3-2-with-nvc-compiler/15663)

<div class="topic-metadata">

**Author:** [@MicPellegrino](https://discourse.cmake.org/u/MicPellegrino)\
**Replies:** 0\
**Last updated:** [May 26, 2026, 11:47am UTC](https://discourse.cmake.org/t/cannot-bootstrap-cmake-4-3-2-with-nvc-compiler/15663 "2026-05-26T11:47:39Z")

</div>

Hi, I am trying to build CMake 4.3.2 (NB not build with CMake) on my local university cluster. Since there’s no CUDA module (sigh) but plenty of NVHPC compiler modules (wrapping CUDA), I am trying to build CMake using n…

---

## [Why does cmake not have a \`--run option\` , or does it?](https://discourse.cmake.org/t/why-does-cmake-not-have-a-run-option-or-does-it/15661)

<div class="topic-metadata">

**Author:** [@a4z](https://discourse.cmake.org/u/a4z)\
**Replies:** 2\
**Last updated:** [May 23, 2026, 10:21am UTC](https://discourse.cmake.org/t/why-does-cmake-not-have-a-run-option-or-does-it/15661 "2026-05-23T10:21:58Z")

</div>

Can we have something like this, please cmake --run --preset brewgcc –target hello to run the add\_executable with the name hello or do we have that already?

---

## [CMake 4.2.3 picks wrong MSVC?](https://discourse.cmake.org/t/cmake-4-2-3-picks-wrong-msvc/15572)

<div class="topic-metadata">

**Author:** [@exoosh](https://discourse.cmake.org/u/exoosh)\
**Replies:** 7\
**Last updated:** [May 20, 2026, 1:48pm UTC](https://discourse.cmake.org/t/cmake-4-2-3-picks-wrong-msvc/15572 "2026-05-20T13:48:17Z")

</div>

Hi, so today I tried to build a project where we used to rely on the fact that CMake uses the ambient environment to figure out the compiler to use. Alas, despite being started in the VS2022 Developer Powershell, it en…

---

## [Generator expression $\<INSTALL\_PREFIX\> doesn't work with env variable DESTDIR](https://discourse.cmake.org/t/generator-expression-install-prefix-doesnt-work-with-env-variable-destdir/15645)

<div class="topic-metadata">

**Author:** [@jst\_mbs](https://discourse.cmake.org/u/jst_mbs)\
**Replies:** 5\
**Last updated:** [May 12, 2026, 2:51pm UTC](https://discourse.cmake.org/t/generator-expression-install-prefix-doesnt-work-with-env-variable-destdir/15645 "2026-05-12T14:51:21Z")

</div>

Using the generator expression $\<INSTALL\_PREFIX\> in install(CODE ) should work with CMake 3.27 and later. But the generator expression doesn’t work with the enviroment variable DESTDIR. I don’t know if this is the intend…

---

## [generate .o files from compiler instead of .obj files](https://discourse.cmake.org/t/generate-o-files-from-compiler-instead-of-obj-files/2690)

<div class="topic-metadata">

**Author:** [@deepan](https://discourse.cmake.org/u/deepan)\
**Replies:** 14\
**Last updated:** [May 6, 2026, 3:45am UTC](https://discourse.cmake.org/t/generate-o-files-from-compiler-instead-of-obj-files/2690 "2026-05-06T03:45:09Z")

</div>

I am working in an embedded project. target : ppc compiler : windriver Host environment : windows 10 build generator : cmake, MinGW makefiles during compilation i see .c.obj getting generated. I want .o instead of .…

---

## [Cache invalidation doesn't affect compile\_commands.json?](https://discourse.cmake.org/t/cache-invalidation-doesnt-affect-compile-commands-json/15642)

<div class="topic-metadata">

**Author:** [@tali](https://discourse.cmake.org/u/tali)\
**Replies:** 2\
**Last updated:** [May 5, 2026, 10:10pm UTC](https://discourse.cmake.org/t/cache-invalidation-doesnt-affect-compile-commands-json/15642 "2026-05-05T22:10:10Z")

</div>

Hello all - If a build directory is generated with -DCMAKE\_EXPORT\_COMPILE\_COMMANDS=1, and then the CMake command is run again identically but with a (different) value for --DCMAKE\_CXX\_COMPILER or -DCMAKE\_C\_COMPILER, the c…

---

## [/F MSVC stack size not working with CMake](https://discourse.cmake.org/t/f-msvc-stack-size-not-working-with-cmake/15641)

<div class="topic-metadata">

**Author:** [@AliADev](https://discourse.cmake.org/u/AliADev)\
**Replies:** 0\
**Last updated:** [May 5, 2026, 5:34pm UTC](https://discourse.cmake.org/t/f-msvc-stack-size-not-working-with-cmake/15641 "2026-05-05T17:34:23Z")

</div>

This program stack overflows by default on windows, because it allocates more than 1MB on the stack on debug builds. So I pass /F to MSVC and it works. However, when I do it in CMake, it does not seem to work and keep ge…

---

## [Print generated command by add\_custom\_command](https://discourse.cmake.org/t/print-generated-command-by-add-custom-command/15638)

<div class="topic-metadata">

**Author:** [@matdubuisson](https://discourse.cmake.org/u/matdubuisson)\
**Replies:** 1\
**Last updated:** [May 4, 2026, 10:35am UTC](https://discourse.cmake.org/t/print-generated-command-by-add-custom-command/15638 "2026-05-04T10:35:32Z")

</div>

Hello, I have a simple question, is it possible to ask cmake to print all generated commands our I have to do it manually py setting the COMMENT option of add\_custom\_command or adding a log ? Thank you in advance, Bes…

---

## [CMake C++17 "does not name a type" however class is included](https://discourse.cmake.org/t/cmake-c-17-does-not-name-a-type-however-class-is-included/15637)

<div class="topic-metadata">

**Author:** [@matdubuisson](https://discourse.cmake.org/u/matdubuisson)\
**Replies:** 2\
**Last updated:** [May 3, 2026, 8:18am UTC](https://discourse.cmake.org/t/cmake-c-17-does-not-name-a-type-however-class-is-included/15637 "2026-05-03T08:18:27Z")

</div>

Hello everyone, I have upgraded a project from cmake 2.8 to cmake 4.0 and llvm 3.9.0 to 22.1.0 so of course I got compilation issues. For example in the project there is a class not found error for vm.hh file and the cl…

---

## [Update CMake/CLang/LLVM versions of a big project Mozart2 system](https://discourse.cmake.org/t/update-cmake-clang-llvm-versions-of-a-big-project-mozart2-system/15622)

<div class="topic-metadata">

**Author:** [@matdubuisson](https://discourse.cmake.org/u/matdubuisson)\
**Replies:** 1\
**Last updated:** [May 2, 2026, 6:42pm UTC](https://discourse.cmake.org/t/update-cmake-clang-llvm-versions-of-a-big-project-mozart2-system/15622 "2026-05-02T18:42:46Z")

</div>

Hello everyone, I’m improving a programing language GitHub - mozart/mozart2: Mozart Programming System v2 · GitHub for my master thesis. The thing is it does a while no one made a real change so the build tools versions…

---

## ["CMAKE\_INSTALL\_RPATH $ORIGIN" expands to empty](https://discourse.cmake.org/t/cmake-install-rpath-origin-expands-to-empty/13876)

<div class="topic-metadata">

**Author:** [@Taw\_Moto](https://discourse.cmake.org/u/Taw_Moto)\
**Replies:** 9\
**Last updated:** [April 30, 2026, 2:23pm UTC](https://discourse.cmake.org/t/cmake-install-rpath-origin-expands-to-empty/13876 "2026-04-30T14:23:56Z")

</div>

Hi, I have an utils.cmake file which is used by all my projects and some of the lines were set(CMAKE\_SHARED\_LINKER\_FLAGS “${CMAKE\_SHARED\_LINKER\_FLAGS} -Wl,-rpath,‘$ORIGIN’”) set(CMAKE\_EXE\_LINKER\_FLAGS “${CMAKE\_EXE\_LIN…

---

## [CMAKE\_COMMAND variable resolves to a different executable](https://discourse.cmake.org/t/cmake-command-variable-resolves-to-a-different-executable/15633)

<div class="topic-metadata">

**Author:** [@nshustov](https://discourse.cmake.org/u/nshustov)\
**Replies:** 2\
**Last updated:** [April 27, 2026, 10:35pm UTC](https://discourse.cmake.org/t/cmake-command-variable-resolves-to-a-different-executable/15633 "2026-04-27T22:35:55Z")

</div>

Hi, I have a question about CMAKE\_COMMAND variable. We have multiple cmake executables in the same /my/bin directory, different in the name: /my/bin/cmake, /my/bin/cmake-3.30.3, /my/bin/cmake-4.1 and so on. When I la…

[Previous page](https://discourse.cmake.org/c/usage/12.md)

[Next page](https://discourse.cmake.org/c/usage/12.md?page=2)
