# Usage

**URL:** https://discourse.cmake.org/c/usage/12.md

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

---

## [About the Usage category](https://discourse.cmake.org/t/about-the-usage-category/84)

<div class="topic-metadata">

**Author:** [@kwrobot](https://discourse.cmake.org/u/kwrobot)\
**Replies:** 0\
**Last updated:** [October 21, 2019, 6:21pm UTC](https://discourse.cmake.org/t/about-the-usage-category/84 "2019-10-21T18:21:25Z")

</div>

Post for help running CMake, CTest, or CPack on projects. \[post via email\]

---

## [Force find\_package to fail if required library type (shared vs. static) is not found](https://discourse.cmake.org/t/force-find-package-to-fail-if-required-library-type-shared-vs-static-is-not-found/15612)

<div class="topic-metadata">

**Author:** [@Lars](https://discourse.cmake.org/u/Lars)\
**Replies:** 12\
**Last updated:** [November 9, 2026, 7:31pm UTC](https://discourse.cmake.org/t/force-find-package-to-fail-if-required-library-type-shared-vs-static-is-not-found/15612 "2026-11-09T19:31:56Z")

</div>

Note: a similar issue is described in Choose between shared/static library after find\_package() but the answer is inadequate for some scenarios in my opinion. Near trivial task: I want to link a shared library against d…

---

## [Windows LLVMFlang supported?](https://discourse.cmake.org/t/windows-llvmflang-supported/15905)

<div class="topic-metadata">

**Author:** [@scivision](https://discourse.cmake.org/u/scivision)\
**Replies:** 1\
**Last updated:** [November 9, 2026, 11:57am UTC](https://discourse.cmake.org/t/windows-llvmflang-supported/15905 "2026-11-09T11:57:37Z")

</div>

Is LLVMFlang (not MSYS2, rather native LLVM) supported in CMake? I hadn’t tried that before. like https://github.com/llvm/llvm-project/releases/download/llvmorg-23.1.5/LLVM-23.1.5-woa64.msi On a trivial CMakeLists.txt …

---

## [Is it a CMake bug if setting C++ standard on a dependency is required?](https://discourse.cmake.org/t/is-it-a-cmake-bug-if-setting-c-standard-on-a-dependency-is-required/15536)

<div class="topic-metadata">

**Author:** [@benthevining](https://discourse.cmake.org/u/benthevining)\
**Replies:** 5\
**Last updated:** [November 7, 2026, 10:50pm UTC](https://discourse.cmake.org/t/is-it-a-cmake-bug-if-setting-c-standard-on-a-dependency-is-required/15536 "2026-11-07T22:50:45Z")

</div>

In one of my projects, I recently removed \`set(CMAKE\_CXX\_STANDARD 23)\` from the top-level cmakelists, instead setting a compile feature on the appropriate targets. My unit test executable that depends on Catch2 failed w…

---

## [Override base preset](https://discourse.cmake.org/t/override-base-preset/15903)

<div class="topic-metadata">

**Author:** [@Wallby](https://discourse.cmake.org/u/Wallby)\
**Replies:** 1\
**Last updated:** [November 6, 2026, 2:47pm UTC](https://discourse.cmake.org/t/override-base-preset/15903 "2026-11-06T14:47:09Z")

</div>

I was thinking of adding cache variables in the CMakeUserPreset.json file for some project specific configuration. But I don’t want to have to override all of the presets defined in my CMakePresets.json file. Instead, 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:** 6\
**Last updated:** [October 30, 2026, 3:38am UTC](https://discourse.cmake.org/t/cps-doesnt-work-with-boost-headers/15720 "2026-10-30T03:38:14Z")

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

---

## [Collecting llvm code coverage data](https://discourse.cmake.org/t/collecting-llvm-code-coverage-data/15875)

<div class="topic-metadata">

**Author:** [@epistax](https://discourse.cmake.org/u/epistax)\
**Replies:** 2\
**Last updated:** [October 25, 2026, 7:27pm UTC](https://discourse.cmake.org/t/collecting-llvm-code-coverage-data/15875 "2026-10-25T19:27:13Z")

</div>

Put simply, when running a unit test build with llvm coverage enabled, by default it drops a file called default.profraw in the directory of the executable. I am using gtest\_discover\_tests and when I invoke using ctest, …

---

## [Swift package (PackageDescription)](https://discourse.cmake.org/t/swift-package-packagedescription/15865)

<div class="topic-metadata">

**Author:** [@Wallby](https://discourse.cmake.org/u/Wallby)\
**Replies:** 2\
**Last updated:** [October 11, 2026, 10:46am UTC](https://discourse.cmake.org/t/swift-package-packagedescription/15865 "2026-10-11T10:46:28Z")

</div>

Is it possible to create a Swift package project (i.e. as can be created by swift package init ...) using CMake? The example repository by swiftlang on GitHub doesn’t contain this as an example. And there is no issue th…

---

## [CDash (my.cdash.org) Forbidden Errors](https://discourse.cmake.org/t/cdash-my-cdash-org-forbidden-errors/15851)

<div class="topic-metadata">

**Author:** [@amadio](https://discourse.cmake.org/u/amadio)\
**Replies:** 3\
**Last updated:** [October 2, 2026, 1:01pm UTC](https://discourse.cmake.org/t/cdash-my-cdash-org-forbidden-errors/15851 "2026-10-02T13:01:04Z")

</div>

Hi, as of recently, I believe I’m being erroneously blocked by my.cdash.org This happens on my desktop machine at work (Chrome browser only, works with Firefox) and on my phone, but not at home, where CDash works. Co…

---

## [CPack error copying files](https://discourse.cmake.org/t/cpack-error-copying-files/15848)

<div class="topic-metadata">

**Author:** [@Wallby](https://discourse.cmake.org/u/Wallby)\
**Replies:** 1\
**Last updated:** [September 28, 2026, 9:45am UTC](https://discourse.cmake.org/t/cpack-error-copying-files/15848 "2026-09-28T09:45:46Z")

</div>

I have set up a .cmake file I intend to use as a template/framework. It is included at the beginning of the top level CMakeLists.txt. The actual project contains more than this (and targets not named example), but this i…

---

## [CMAKE\_INSTALL\_PREFIX vs installDir in a CMake configure preset](https://discourse.cmake.org/t/cmake-install-prefix-vs-installdir-in-a-cmake-configure-preset/15844)

<div class="topic-metadata">

**Author:** [@CsatiZoltan](https://discourse.cmake.org/u/CsatiZoltan)\
**Replies:** 3\
**Last updated:** [September 22, 2026, 10:01pm UTC](https://discourse.cmake.org/t/cmake-install-prefix-vs-installdir-in-a-cmake-configure-preset/15844 "2026-09-22T22:01:30Z")

</div>

I defined a CMake configure preset like this: { "configurePresets": \[ { "name": "base", "displayName": "Base configuration", "cacheVariables": { "CMAKE\_INSTALL\_PREFIX": "install" },…

---

## [JUnit Results for Collections of Tests](https://discourse.cmake.org/t/junit-results-for-collections-of-tests/15845)

<div class="topic-metadata">

**Author:** [@kevinyee](https://discourse.cmake.org/u/kevinyee)\
**Replies:** 0\
**Last updated:** [September 21, 2026, 3:53pm UTC](https://discourse.cmake.org/t/junit-results-for-collections-of-tests/15845 "2026-09-21T15:53:24Z")

</div>

My use case is for dotnet test, but I think this topic could apply to any collections of tests. I’m writing a MSTest library that I register with ctest with a COMMAND dotnet test like so: add\_library(MyTestLibrary SHAR…

---

## [Fortran\_PREPROCESS ignored on Linux](https://discourse.cmake.org/t/fortran-preprocess-ignored-on-linux/9105)

<div class="topic-metadata">

**Author:** [@Maarten\_Braakhekke](https://discourse.cmake.org/u/Maarten_Braakhekke)\
**Replies:** 5\
**Last updated:** [September 17, 2026, 3:54pm UTC](https://discourse.cmake.org/t/fortran-preprocess-ignored-on-linux/9105 "2026-09-17T15:54:19Z")

</div>

It seems that the Fortran\_PREPROCESS property is not functioning properly on Linux. The default behavior of CMake on Linux is that source files are not preprocssed and Fortran\_PREPROCESS doesn seem to affect this. I att…

---

## [How to set an alias for a target imported by find\_package?](https://discourse.cmake.org/t/how-to-set-an-alias-for-a-target-imported-by-find-package/15831)

<div class="topic-metadata">

**Author:** [@CsatiZoltan](https://discourse.cmake.org/u/CsatiZoltan)\
**Replies:** 2\
**Last updated:** [September 15, 2026, 8:22am UTC](https://discourse.cmake.org/t/how-to-set-an-alias-for-a-target-imported-by-find-package/15831 "2026-09-15T08:22:47Z")

</div>

When I create my own library target with add\_library, it has an ALIAS option. However, I cannot find similar for libraries imported via find\_package. In my case, I import OpenMP with find\_package(OpenMP COMPONENTS CXX …

---

## [Can't build source for reVC GameCube](https://discourse.cmake.org/t/cant-build-source-for-revc-gamecube/15824)

<div class="topic-metadata">

**Author:** [@x\_orange90\_x](https://discourse.cmake.org/u/x_orange90_x)\
**Replies:** 7\
**Last updated:** [September 10, 2026, 12:38am UTC](https://discourse.cmake.org/t/cant-build-source-for-revc-gamecube/15824 "2026-09-10T00:38:23Z")

</div>

I’m not sure if this is the correct place or if this is allowed here. I have no idea where else to ask this because the internet is void of any success stories building this source. A developer ported GTA VC to GameCube…

---

## [Bad dependency management for custom commands with Unix Makefiles generator](https://discourse.cmake.org/t/bad-dependency-management-for-custom-commands-with-unix-makefiles-generator/15823)

<div class="topic-metadata">

**Author:** [@davide9](https://discourse.cmake.org/u/davide9)\
**Replies:** 1\
**Last updated:** [September 7, 2026, 12:37pm UTC](https://discourse.cmake.org/t/bad-dependency-management-for-custom-commands-with-unix-makefiles-generator/15823 "2026-09-07T12:37:27Z")

</div>

When using “Unix Makefile” generator combined with custom commands and custom targets to generate files, CMake make use of sub-make invocation which doesn’t propagate the dependency tree between custom targets. Give the…

---

## [How to use FASTBuild with multiple targets?](https://discourse.cmake.org/t/how-to-use-fastbuild-with-multiple-targets/15822)

<div class="topic-metadata">

**Author:** [@CsatiZoltan](https://discourse.cmake.org/u/CsatiZoltan)\
**Replies:** 1\
**Last updated:** [September 4, 2026, 10:51pm UTC](https://discourse.cmake.org/t/how-to-use-fastbuild-with-multiple-targets/15822 "2026-09-04T22:51:05Z")

</div>

I tried out the FASTBuild generator with CMake (FASTBuild v1.20 with CMake 4.3.2). My project has multiple targets, which I build with cmake --build build/ By default, CMake builds all the targets, which causes an erro…

---

## [Compiling Shared Library Using External Library, and then Using it on another system.](https://discourse.cmake.org/t/compiling-shared-library-using-external-library-and-then-using-it-on-another-system/15344)

<div class="topic-metadata">

**Author:** [@Vekleon](https://discourse.cmake.org/u/Vekleon)\
**Replies:** 7\
**Last updated:** [September 3, 2026, 7:38pm UTC](https://discourse.cmake.org/t/compiling-shared-library-using-external-library-and-then-using-it-on-another-system/15344 "2026-09-03T19:38:10Z")

</div>

Right now I’m trying to compile a project using an SDK from a service on system A. Currently my shared library compiles fine with this SDK, but when I try to move this library to use on system B, I’m noticing now that it…

---

## [Deduce cmake\_minimum\_required from the features I use](https://discourse.cmake.org/t/deduce-cmake-minimum-required-from-the-features-i-use/15817)

<div class="topic-metadata">

**Author:** [@CsatiZoltan](https://discourse.cmake.org/u/CsatiZoltan)\
**Replies:** 1\
**Last updated:** [September 2, 2026, 2:29am UTC](https://discourse.cmake.org/t/deduce-cmake-minimum-required-from-the-features-i-use/15817 "2026-09-02T02:29:28Z")

</div>

Throughout the documentation, the minimum required CMake version is given. When I create or modify a CMake script, I often forget about the minimum version requirement. Is there a static analysis tool that checks the CMa…

---

## [Testing/simulating a missing dependency](https://discourse.cmake.org/t/testing-simulating-a-missing-dependency/15804)

<div class="topic-metadata">

**Author:** [@ferdnyc](https://discourse.cmake.org/u/ferdnyc)\
**Replies:** 0\
**Last updated:** [August 25, 2026, 7:35am UTC](https://discourse.cmake.org/t/testing-simulating-a-missing-dependency/15804 "2026-08-25T07:35:36Z")

</div>

Say I have a project that includes Bison and Flex code, and therefore relies on FindBISON.cmake and FindFLEX.cmake. (Because, I do.) Say, also, that the project does not REQUIRE those dependencies in the find\_package() c…

---

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

---

## [CMake 4.2.1 Detecting C compiler ABI info - failed](https://discourse.cmake.org/t/cmake-4-2-1-detecting-c-compiler-abi-info-failed/15790)

<div class="topic-metadata">

**Author:** [@lostbits](https://discourse.cmake.org/u/lostbits)\
**Replies:** 0\
**Last updated:** [August 17, 2026, 6:57pm UTC](https://discourse.cmake.org/t/cmake-4-2-1-detecting-c-compiler-abi-info-failed/15790 "2026-08-17T18:57:34Z")

</div>

Win11 Pro (x86-64) cygwin 3.7.1 cmake 4.2.1 gcc 17.0.0 IN the first example of the cmake tutorial fails with the error above and as a result code to generate a target is not generated: gmake\[2\]: \*\*\* No rule to make …

---

## [cmake build maps libre](https://discourse.cmake.org/t/cmake-build-maps-libre/15788)

<div class="topic-metadata">

**Author:** [@impetus](https://discourse.cmake.org/u/impetus)\
**Replies:** 3\
**Last updated:** [August 16, 2026, 9:12am UTC](https://discourse.cmake.org/t/cmake-build-maps-libre/15788 "2026-08-16T09:12:41Z")

</div>

I’m building maps libre Linux - MapLibre Native Developer Documentation Having problem with mbgl-core build FAILED: CMakeFiles/mbgl-core.dir/src/mbgl/layout/symbol\_layout.cpp.o ccache /usr/bin/clang++ -DEGL\_NO\_X11 -DM…

---

## [Coverage report formats supported for CDash upload](https://discourse.cmake.org/t/coverage-report-formats-supported-for-cdash-upload/9950)

<div class="topic-metadata">

**Author:** [@pkiran](https://discourse.cmake.org/u/pkiran)\
**Replies:** 6\
**Last updated:** [August 5, 2026, 4:35pm UTC](https://discourse.cmake.org/t/coverage-report-formats-supported-for-cdash-upload/9950 "2026-08-05T16:35:23Z")

</div>

Hello, I could not find documentation on the supported coverage report formats ( like cobertura xml, gcov, lcov etc) or the coverage tools, which can be used with ctest\_coverage to be uploaded to CDash. Where can I fin…

---

## [Comment line for custom target has added leading 1\>](https://discourse.cmake.org/t/comment-line-for-custom-target-has-added-leading-1/15764)

<div class="topic-metadata">

**Author:** [@Wallby](https://discourse.cmake.org/u/Wallby)\
**Replies:** 3\
**Last updated:** [July 31, 2026, 11:25am UTC](https://discourse.cmake.org/t/comment-line-for-custom-target-has-added-leading-1/15764 "2026-07-31T11:25:49Z")

</div>

For example: set(name example) add\_executable(${name} ${...}) set(customName customTarget) add\_custom\_target(${customName} COMMENT "#${customName}" COMMAND ${CMAKE\_COMMAND} -E echo $\<TARGET\_FILE…

---

## [Cannot start CMake GUI on Windows 8.1](https://discourse.cmake.org/t/cannot-start-cmake-gui-on-windows-8-1/15763)

<div class="topic-metadata">

**Author:** [@NEOWISE](https://discourse.cmake.org/u/NEOWISE)\
**Replies:** 1\
**Last updated:** [July 29, 2026, 10:18pm UTC](https://discourse.cmake.org/t/cannot-start-cmake-gui-on-windows-8-1/15763 "2026-07-29T22:18:20Z")

</div>

Cannot start CMake GUI on Windows 8.1. It says cannot find d3d12.dll.

---

## [How to add raw binary to be merged?](https://discourse.cmake.org/t/how-to-add-raw-binary-to-be-merged/981)

<div class="topic-metadata">

**Author:** [@eng.fernandosilva](https://discourse.cmake.org/u/eng.fernandosilva)\
**Replies:** 4\
**Last updated:** [July 24, 2026, 6:36am UTC](https://discourse.cmake.org/t/how-to-add-raw-binary-to-be-merged/981 "2026-07-24T06:36:33Z")

</div>

Hi, I’m starting to use CMake and I was wondering if I can mix a raw binary with linking using CMake. This is useful for firmware development and it is used by UEFI tools (EDK2) using scripts. Do we have a custom comma…

---

## [Combine sanitizer check in one single MemCheck analysis](https://discourse.cmake.org/t/combine-sanitizer-check-in-one-single-memcheck-analysis/15658)

<div class="topic-metadata">

**Author:** [@npoletz](https://discourse.cmake.org/u/npoletz)\
**Replies:** 3\
**Last updated:** [July 8, 2026, 3:44pm UTC](https://discourse.cmake.org/t/combine-sanitizer-check-in-one-single-memcheck-analysis/15658 "2026-07-08T15:44:34Z")

</div>

I am currently testing the dynamic analysis with UndefinedBehaviorSanitizer and AddressSanitizer. It works well separately and defects are correctly reported on our dashboard. However I am wondering if there is a way t…

---

## [what's the meaing of this sentence?](https://discourse.cmake.org/t/whats-the-meaing-of-this-sentence/15735)

<div class="topic-metadata">

**Author:** [@yushang](https://discourse.cmake.org/u/yushang)\
**Replies:** 2\
**Last updated:** [July 7, 2026, 8:10am UTC](https://discourse.cmake.org/t/whats-the-meaing-of-this-sentence/15735 "2026-07-07T08:10:02Z")

</div>

Hi guys, in this page https://cmake.org/cmake/help/latest/command/set\_directory\_properties.html there is a sentence Sets properties of the current directory and its subdirectories in key-value pairs. I’m trying to ver…

---

## [about include\_guard](https://discourse.cmake.org/t/about-include-guard/15737)

<div class="topic-metadata">

**Author:** [@yushang](https://discourse.cmake.org/u/yushang)\
**Replies:** 4\
**Last updated:** [July 6, 2026, 1:42pm UTC](https://discourse.cmake.org/t/about-include-guard/15737 "2026-07-06T13:42:17Z")

</div>

Hi guys, I have the following setup CMakeLists.txt list(APPEND CMAKE\_MODULE\_PATH ${CMAKE\_CURRENT\_SOURCE\_DIR}) add\_subdirectory(sub) add\_subdirectory(sub2) tools.cmake include\_guard(DIRECTORY) # A message("tools.cmak…

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