# Usage

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

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

**Page:** 6

---

## [How do you avoid target name conflicts in a multi-config setup?](https://discourse.cmake.org/t/how-do-you-avoid-target-name-conflicts-in-a-multi-config-setup/7711)

<div class="topic-metadata">

**Author:** [@max](https://discourse.cmake.org/u/max)\
**Replies:** 4\
**Last updated:** [November 15, 2025, 5:53pm UTC](https://discourse.cmake.org/t/how-do-you-avoid-target-name-conflicts-in-a-multi-config-setup/7711 "2025-11-15T17:53:02Z")

</div>

I’m forking this discussion off from https://gitlab.kitware.com/cmake/cmake/-/issues/23482. I’ve got some large, pre-built libraries that are released separately for the Debug and Release versions. And I would just like …

---

## [Error: Instruction is too long.](https://discourse.cmake.org/t/error-instruction-is-too-long/15300)

<div class="topic-metadata">

**Author:** [@wild.boy](https://discourse.cmake.org/u/wild.boy)\
**Replies:** 1\
**Last updated:** [November 15, 2025, 6:48am UTC](https://discourse.cmake.org/t/error-instruction-is-too-long/15300 "2025-11-15T06:48:17Z")

</div>

In CMake, if the link command becomes excessively long due to the presence of too many executable files during the linking process, what methods can be used to solve this problem?

---

## [prompting user for variables before configuration](https://discourse.cmake.org/t/prompting-user-for-variables-before-configuration/15283)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 7\
**Last updated:** [November 14, 2025, 6:05pm UTC](https://discourse.cmake.org/t/prompting-user-for-variables-before-configuration/15283 "2025-11-14T18:05:14Z")

</div>

Is there a way to ask the user for some variables before running configuration (possibly in cmake-gui)? So far, I must run the configuration that populates the cache and then displays available cache variables (but not …

---

## [Windows Kernel Mode does not support building without KMDF](https://discourse.cmake.org/t/windows-kernel-mode-does-not-support-building-without-kmdf/15299)

<div class="topic-metadata">

**Author:** [@michael.kwok](https://discourse.cmake.org/u/michael.kwok)\
**Replies:** 0\
**Last updated:** [November 12, 2025, 8:43pm UTC](https://discourse.cmake.org/t/windows-kernel-mode-does-not-support-building-without-kmdf/15299 "2025-11-12T20:43:20Z")

</div>

Hi there, CMake seems to only support generating Windows Kernel Mode projects when CMAKE\_WINDOWS\_KMDF\_VERSION is not defined (Modules/Platform/WindowsKernelModeDriver.cmake · master · CMake / CMake · GitLab). Despite a…

---

## [How to parallelize git submodules](https://discourse.cmake.org/t/how-to-parallelize-git-submodules/10056)

<div class="topic-metadata">

**Author:** [@bmagistro](https://discourse.cmake.org/u/bmagistro)\
**Replies:** 6\
**Last updated:** [November 11, 2025, 12:28am UTC](https://discourse.cmake.org/t/how-to-parallelize-git-submodules/10056 "2025-11-11T00:28:41Z")

</div>

We are trying to build boost using cmake (this works and is not the issue). The challenge is the time it takes to clone the submodules. It appears git supports fetchJobs which can allow this to be parallelized. By defa…

---

## [Executing Python command with CMake under CygWin fails with Errno 2](https://discourse.cmake.org/t/executing-python-command-with-cmake-under-cygwin-fails-with-errno-2/15290)

<div class="topic-metadata">

**Author:** [@tbeu](https://discourse.cmake.org/u/tbeu)\
**Replies:** 1\
**Last updated:** [November 7, 2025, 10:20am UTC](https://discourse.cmake.org/t/executing-python-command-with-cmake-under-cygwin-fails-with-errno-2/15290 "2025-11-07T10:20:57Z")

</div>

I have the following lines in my CMake file, basically running a python script. find\_package(Python3 COMPONENTS Interpreter) if(Python3\_Interpreter\_FOUND) set(MY\_CTESTS\_DIR ${PROJECT\_BINARY\_DIR}/tests) set(MY\_TESTING\_…

---

## [Trouble linking .a libraries in c++ using tutorial as guide](https://discourse.cmake.org/t/trouble-linking-a-libraries-in-c-using-tutorial-as-guide/15282)

<div class="topic-metadata">

**Author:** [@luttink](https://discourse.cmake.org/u/luttink)\
**Replies:** 6\
**Last updated:** [November 5, 2025, 11:41pm UTC](https://discourse.cmake.org/t/trouble-linking-a-libraries-in-c-using-tutorial-as-guide/15282 "2025-11-05T23:41:03Z")

</div>

Hi, I’m using cmake version 3.28.3, working with the tutorial on the cmake website, and got through Step 1 Exercise 3. Using that, I tried to link a library like so: cmake\_minimum\_required(VERSION 3.28) project(ES3) …

---

## [don't show includes, whatever the generator](https://discourse.cmake.org/t/dont-show-includes-whatever-the-generator/14476)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 6\
**Last updated:** [November 5, 2025, 2:20pm UTC](https://discourse.cmake.org/t/dont-show-includes-whatever-the-generator/14476 "2025-11-05T14:20:19Z")

</div>

Hi, So far, on windows, I was using nmake (using NMake Makefiles generator) with cl and make (using MinGW Makefiles generator) with gcc. But experimenting on parallel build, I realized that using make achieved a better…

---

## [Windows default CMAKE\_INSTALL\_PREFIX is wrong?](https://discourse.cmake.org/t/windows-default-cmake-install-prefix-is-wrong/15272)

<div class="topic-metadata">

**Author:** [@Peter\_Hull](https://discourse.cmake.org/u/Peter_Hull)\
**Replies:** 2\
**Last updated:** [October 29, 2025, 10:24am UTC](https://discourse.cmake.org/t/windows-default-cmake-install-prefix-is-wrong/15272 "2025-10-29T10:24:57Z")

</div>

Can anyone explain why the default prefix for Windows has (x86) in it, //Install path prefix, prepended onto install directories. CMAKE\_INSTALL\_PREFIX:PATH=C:/Program Files (x86)/{project name} even though I have a 64 …

---

## [Migration experiences / Comparison RUNTIME\_DEPENDENCY\_SET vs. fixup\_bundle (BundleUtilities)](https://discourse.cmake.org/t/migration-experiences-comparison-runtime-dependency-set-vs-fixup-bundle-bundleutilities/11323)

<div class="topic-metadata">

**Author:** [@codeling](https://discourse.cmake.org/u/codeling)\
**Replies:** 8\
**Last updated:** [October 29, 2025, 12:26am UTC](https://discourse.cmake.org/t/migration-experiences-comparison-runtime-dependency-set-vs-fixup-bundle-bundleutilities/11323 "2025-10-29T00:26:28Z")

</div>

TL;DR: For a summary of my findings and still open questions, see this post below! I’m currently reading up on and experimenting with the RUNTIME\_DEPENDENCY\_SET functionality. In trying to set up a RUNTIME\_DEPENDENCY\_SE…

---

## [GNUInstallDir differences in prefix paths and inconsistency with documentation](https://discourse.cmake.org/t/gnuinstalldir-differences-in-prefix-paths-and-inconsistency-with-documentation/5102)

<div class="topic-metadata">

**Author:** [@computerquip-work](https://discourse.cmake.org/u/computerquip-work)\
**Replies:** 3\
**Last updated:** [October 29, 2025, 12:06am UTC](https://discourse.cmake.org/t/gnuinstalldir-differences-in-prefix-paths-and-inconsistency-with-documentation/5102 "2025-10-29T00:06:52Z")

</div>

I was under the impression that GNUInstallDirs treated certain directories specially: / For \<dir\> other than the SYSCONFDIR, LOCALSTATEDIR and RUNSTATEDIR, the value of CMAKE\_INSTALL\_\<dir\> is prefixed with usr/ if it…

---

## [Installation prefix at install phase (cmake --install ... --prefix ...)](https://discourse.cmake.org/t/installation-prefix-at-install-phase-cmake-install-prefix/14214)

<div class="topic-metadata">

**Author:** [@petk](https://discourse.cmake.org/u/petk)\
**Replies:** 3\
**Last updated:** [October 28, 2025, 8:23pm UTC](https://discourse.cmake.org/t/installation-prefix-at-install-phase-cmake-install-prefix/14214 "2025-10-28T20:23:10Z")

</div>

Hello, CMake has option to specify installation prefix at the install phase using cmake --install \<build-dir\> --prefix \<install-prefix\> Because I’m currently thinking to completely ignore the --prefix option to simpli…

---

## [CMake | find\_package(Python3) documentation confusion](https://discourse.cmake.org/t/cmake-find-package-python3-documentation-confusion/15275)

<div class="topic-metadata">

**Author:** [@hjmjohnson](https://discourse.cmake.org/u/hjmjohnson)\
**Replies:** 2\
**Last updated:** [October 28, 2025, 7:22pm UTC](https://discourse.cmake.org/t/cmake-find-package-python3-documentation-confusion/15275 "2025-10-28T19:22:42Z")

</div>

I’ve tried the following with cmake 3.28 (ubuntu 24.04) and 4.04 (mac arm). I had expected to find libraries and include directories. Could someone please explain why Python3\_Development.SABIModule\_FOUND is TRUE, but t…

---

## [Generate individual package for each component](https://discourse.cmake.org/t/generate-individual-package-for-each-component/4686)

<div class="topic-metadata">

**Author:** [@hachanuy](https://discourse.cmake.org/u/hachanuy)\
**Replies:** 4\
**Last updated:** [October 28, 2025, 2:49pm UTC](https://discourse.cmake.org/t/generate-individual-package-for-each-component/4686 "2025-10-28T14:49:04Z")

</div>

I want to build multiple packages from a single project, and I’m trying to use cpack component to do it. I have a toy project set up as follows: # CMakeLists.txt cmake\_minimum\_required(VERSION 3.21) project(Sandbox VER…

---

## [Do generators expression work with BASE\_DIRS in target\_sources](https://discourse.cmake.org/t/do-generators-expression-work-with-base-dirs-in-target-sources/15257)

<div class="topic-metadata">

**Author:** [@David\_Hunter](https://discourse.cmake.org/u/David_Hunter)\
**Replies:** 8\
**Last updated:** [October 26, 2025, 8:56am UTC](https://discourse.cmake.org/t/do-generators-expression-work-with-base-dirs-in-target-sources/15257 "2025-10-26T08:56:15Z")

</div>

I can post a longer example of this issue if needed but I wanted to see if what I am doing is just not expected to work. I have a CMakeLists.txt like target\_sources(HelloWorld PUBLIC FILE\_SET generated\_export\_header…

---

## [Build a framework on the Mac](https://discourse.cmake.org/t/build-a-framework-on-the-mac/13443)

<div class="topic-metadata">

**Author:** [@SpacedCowboy](https://discourse.cmake.org/u/SpacedCowboy)\
**Replies:** 1\
**Last updated:** [October 22, 2025, 11:14am UTC](https://discourse.cmake.org/t/build-a-framework-on-the-mac/13443 "2025-10-22T11:14:47Z")

</div>

I’m trying to set up a CMakeLists.txt to build a Mac framework. I’m running into issues where any headers that include \<framework/something.h\> in angle brackets (because the include itself is in a public header) are not …

---

## [How to force a static archive to be recreated when another file changes](https://discourse.cmake.org/t/how-to-force-a-static-archive-to-be-recreated-when-another-file-changes/15240)

<div class="topic-metadata">

**Author:** [@alcroito](https://discourse.cmake.org/u/alcroito)\
**Replies:** 5\
**Last updated:** [October 20, 2025, 8:14pm UTC](https://discourse.cmake.org/t/how-to-force-a-static-archive-to-be-recreated-when-another-file-changes/15240 "2025-10-20T20:14:03Z")

</div>

I have the following sample project illustrating the issue: cmake\_minimum\_required(VERSION 3.16) project(proj LANGUAGES CXX) # Allow using response files. if(APPLE) set(CMAKE\_CXX\_ARCHIVE\_CREATE "libtool -o \<TARGET\> …

---

## [Target dependant properties of a source file used by multiple targets](https://discourse.cmake.org/t/target-dependant-properties-of-a-source-file-used-by-multiple-targets/15236)

<div class="topic-metadata">

**Author:** [@sergiud](https://discourse.cmake.org/u/sergiud)\
**Replies:** 4\
**Last updated:** [October 17, 2025, 4:42pm UTC](https://discourse.cmake.org/t/target-dependant-properties-of-a-source-file-used-by-multiple-targets/15236 "2025-10-17T16:42:49Z")

</div>

Consider a project that defines multiple object libraries from the same source file: add\_library (A OBJECT foo.cpp bar.cpp ) add\_library (B OBJECT foo.cpp bar.cpp ) My goal is to set a preprocessor definition …

---

## [Inheriting complier flags from multiple config presets.](https://discourse.cmake.org/t/inheriting-complier-flags-from-multiple-config-presets/15195)

<div class="topic-metadata">

**Author:** [@pmf-honeywell](https://discourse.cmake.org/u/pmf-honeywell)\
**Replies:** 3\
**Last updated:** [October 15, 2025, 7:23pm UTC](https://discourse.cmake.org/t/inheriting-complier-flags-from-multiple-config-presets/15195 "2025-10-15T19:23:41Z")

</div>

Is it possible to have multiple configuration presets that add compiler options to CMAKE\_CXX\_FLAGS? For example, { "name": "common-presets", "hidden": true, "cacheVariables": { "CMAKE\_CXX\_FLAGS\_INIT": "-Dprop…

---

## [Customizing search paths for find modules](https://discourse.cmake.org/t/customizing-search-paths-for-find-modules/15242)

<div class="topic-metadata">

**Author:** [@petk](https://discourse.cmake.org/u/petk)\
**Replies:** 2\
**Last updated:** [October 15, 2025, 5:10pm UTC](https://discourse.cmake.org/t/customizing-search-paths-for-find-modules/15242 "2025-10-15T17:10:27Z")

</div>

Hello, What is the recommended CMake way to customize paths, where some external library should be searched (for example, when developing and having a custom, local installation somewhere)? For example, when using mo…

---

## [cmake fails to build on NetBSD/hppa](https://discourse.cmake.org/t/cmake-fails-to-build-on-netbsd-hppa/14272)

<div class="topic-metadata">

**Author:** [@vom](https://discourse.cmake.org/u/vom)\
**Replies:** 1\
**Last updated:** [October 14, 2025, 5:28pm UTC](https://discourse.cmake.org/t/cmake-fails-to-build-on-netbsd-hppa/14272 "2025-10-14T17:28:02Z")

</div>

Hello all, Let me say upfront I know this is a pretty far out in left field, seeing that it’s a) NetBSD and b) on old HPPA hardware. I have built cmake on 32-bit NetBSD sparc for example in the recent past. I am using…

---

## [Provide absolute paths to dependencies with \`CMAKE\_FIND\_ROOT\_PATH\` search (during cross-compilation, wasm)](https://discourse.cmake.org/t/provide-absolute-paths-to-dependencies-with-cmake-find-root-path-search-during-cross-compilation-wasm/15241)

<div class="topic-metadata">

**Author:** [@Andrej730](https://discourse.cmake.org/u/Andrej730)\
**Replies:** 0\
**Last updated:** [October 14, 2025, 3:25pm UTC](https://discourse.cmake.org/t/provide-absolute-paths-to-dependencies-with-cmake-find-root-path-search-during-cross-compilation-wasm/15241 "2025-10-14T15:25:04Z")

</div>

Was trying to rework cmake file to use find\_package configs instead of providing paths to each dependency with explicit DEPENDENCY\_INCLUDE variables and I’ve stumbled upon issue when using those cmake-configs during cros…

---

## [CMAKE\_OSX\_ARCHITECTURES documentation page leaves a lot to be desired for newbie](https://discourse.cmake.org/t/cmake-osx-architectures-documentation-page-leaves-a-lot-to-be-desired-for-newbie/15177)

<div class="topic-metadata">

**Author:** [@ipatch](https://discourse.cmake.org/u/ipatch)\
**Replies:** 6\
**Last updated:** [October 13, 2025, 7:37am UTC](https://discourse.cmake.org/t/cmake-osx-architectures-documentation-page-leaves-a-lot-to-be-desired-for-newbie/15177 "2025-10-13T07:37:18Z")

</div>

dumb question from a dumb person. when working with cmake i often use the following cmake command, cmake -L to print a list of “variables” / “args” i can pass to my cmake based project. so i do a google for CMAKE\_OSX\_…

---

## [Setting cmake\_minimum\_required globally or in a shared script](https://discourse.cmake.org/t/setting-cmake-minimum-required-globally-or-in-a-shared-script/15235)

<div class="topic-metadata">

**Author:** [@ChrisJaquet](https://discourse.cmake.org/u/ChrisJaquet)\
**Replies:** 0\
**Last updated:** [October 12, 2025, 10:17am UTC](https://discourse.cmake.org/t/setting-cmake-minimum-required-globally-or-in-a-shared-script/15235 "2025-10-12T10:17:17Z")

</div>

We have a set of shared CMake scripts that are used by all of our projects and their dependencies. Up until recently we have done something on the lines of project(MyProject) include(../SharedCMakeScripts/Common.cmake)…

---

## [No CMAKE\_C\_COMPILER could be found](https://discourse.cmake.org/t/no-cmake-c-compiler-could-be-found/9066)

<div class="topic-metadata">

**Author:** [@brisauce](https://discourse.cmake.org/u/brisauce)\
**Replies:** 9\
**Last updated:** [October 11, 2025, 3:20pm UTC](https://discourse.cmake.org/t/no-cmake-c-compiler-could-be-found/9066 "2025-10-11T15:20:29Z")

</div>

Hey, I’m having some trouble configuring cmake on my machine. I am attempting to build leptonica. I am on Windows 10, I have GCC 11.4.0 x86\_64 and visual studio community 2022 release x86 as my compilers and I am using v…

---

## [Custom toolchain and platform files](https://discourse.cmake.org/t/custom-toolchain-and-platform-files/15232)

<div class="topic-metadata">

**Author:** [@georg](https://discourse.cmake.org/u/georg)\
**Replies:** 0\
**Last updated:** [October 10, 2025, 12:39pm UTC](https://discourse.cmake.org/t/custom-toolchain-and-platform-files/15232 "2025-10-10T12:39:04Z")

</div>

Hi community, we use a number of embedded toolchains and compilers for which we need to craft toolchain files for use with CMake. Most of them are deeply embedded (Generic platform) and mostly work without a standard li…

---

## [CMAKE\_HOST\_SYSTEM\_PROCESSOR is filled with the current value only after the project() command](https://discourse.cmake.org/t/cmake-host-system-processor-is-filled-with-the-current-value-only-after-the-project-command/15230)

<div class="topic-metadata">

**Author:** [@rumgot](https://discourse.cmake.org/u/rumgot)\
**Replies:** 0\
**Last updated:** [October 9, 2025, 7:55am UTC](https://discourse.cmake.org/t/cmake-host-system-processor-is-filled-with-the-current-value-only-after-the-project-command/15230 "2025-10-09T07:55:13Z")

</div>

I have a task that requires using the CMAKE\_HOST\_SYSTEM\_PROCESSOR variable when executing the project() command. I want to specify a value for the CMAKE\_OSX\_ARCHITECTURES variable, which, according to the documentation (h…

---

## [Struggling to use VSCode with CMakePresets.json to invoke a test](https://discourse.cmake.org/t/struggling-to-use-vscode-with-cmakepresets-json-to-invoke-a-test/13667)

<div class="topic-metadata">

**Author:** [@exoosh](https://discourse.cmake.org/u/exoosh)\
**Replies:** 3\
**Last updated:** [October 8, 2025, 11:24pm UTC](https://discourse.cmake.org/t/struggling-to-use-vscode-with-cmakepresets-json-to-invoke-a-test/13667 "2025-10-08T23:24:15Z")

</div>

Hi, I would like to use the built-in facilities of VSCode to invoke ctest. However, I am unable to tell it to step into a given --test-dir via CMakePresets.json. And so I get one of two symptoms: if I call enable\_tes…

---

## [if (var STREQUAL value) and value without “” –\> no warning](https://discourse.cmake.org/t/if-var-strequal-value-and-value-without-no-warning/15224)

<div class="topic-metadata">

**Author:** [@johan556](https://discourse.cmake.org/u/johan556)\
**Replies:** 1\
**Last updated:** [October 7, 2025, 8:28pm UTC](https://discourse.cmake.org/t/if-var-strequal-value-and-value-without-no-warning/15224 "2025-10-07T20:28:29Z")

</div>

I just realised that I have a lot of CMake code where the intention is to compare a variable with a value, but the value has no ““ around itself. This work as long as there is no variable with the same name, since then t…

---

## [Find newer Python using old FindPython](https://discourse.cmake.org/t/find-newer-python-using-old-findpython/15221)

<div class="topic-metadata">

**Author:** [@Andrej730](https://discourse.cmake.org/u/Andrej730)\
**Replies:** 1\
**Last updated:** [October 7, 2025, 11:57am UTC](https://discourse.cmake.org/t/find-newer-python-using-old-findpython/15221 "2025-10-07T11:57:53Z")

</div>

In my cmake I fetch a couple Python components - Development, Interpreter and for simplicity I wanted to provide Python installation by just prefixing the PATH (e.g. -DCMAKE\_PREFIX\_PATH="/my/install/python-3.13.6") inst…

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

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