# Usage

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

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

**Page:** 80

---

## [Binary package name in find\_package() and target\_link\_libraries()](https://discourse.cmake.org/t/binary-package-name-in-find-package-and-target-link-libraries/3235)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.cmake.org/u/pauljurczak)\
**Replies:** 2\
**Last updated:** [April 29, 2021, 8:32am UTC](https://discourse.cmake.org/t/binary-package-name-in-find-package-and-target-link-libraries/3235 "2021-04-29T08:32:56Z")

</div>

I’m searching for a rule of thumb to discover how the binary package name used in find\_package() is modified for use in target\_link\_libraries(). In this fragment of CMakeLists.txt file: find\_package(fmt REQUIRED) find\_p…

---

## [Modify the default compiling commands](https://discourse.cmake.org/t/modify-the-default-compiling-commands/3224)

<div class="topic-metadata">

**Author:** [@prayutsu](https://discourse.cmake.org/u/prayutsu)\
**Replies:** 2\
**Last updated:** [April 28, 2021, 5:07pm UTC](https://discourse.cmake.org/t/modify-the-default-compiling-commands/3224 "2021-04-28T17:07:05Z")

</div>

I am a competitive programmmer and I use CLion IDE(which uses CMake) to write code for problems in the contest. In my c++ programs, I want to do certain things if a macro named prayutsu is defined along with the compilat…

---

## [list of available generator expression](https://discourse.cmake.org/t/list-of-available-generator-expression/3228)

<div class="topic-metadata">

**Author:** [@hex](https://discourse.cmake.org/u/hex)\
**Replies:** 2\
**Last updated:** [April 28, 2021, 3:52pm UTC](https://discourse.cmake.org/t/list-of-available-generator-expression/3228 "2021-04-28T15:52:27Z")

</div>

similar to cmake --help-variable-list, is there a way to create a list of genex operator? I need this to create a set of text snippet.

---

## [OSX, frameworks, @rpath, and image not found](https://discourse.cmake.org/t/osx-frameworks-rpath-and-image-not-found/3094)

<div class="topic-metadata">

**Author:** [@a4z](https://discourse.cmake.org/u/a4z)\
**Replies:** 9\
**Last updated:** [April 27, 2021, 4:26pm UTC](https://discourse.cmake.org/t/osx-frameworks-rpath-and-image-not-found/3094 "2021-04-27T16:26:30Z")

</div>

Hi, I wonder how @rpath is supposed to work on OSX/BigSur … I build a framework with CMake, that basically works But all tests are failing with a message basically saying the framework can not be found, but it’s ther…

---

## [Presets should ignore the toplevel "$schema" entry](https://discourse.cmake.org/t/presets-should-ignore-the-toplevel-schema-entry/3025)

<div class="topic-metadata">

**Author:** [@objectx](https://discourse.cmake.org/u/objectx)\
**Replies:** 2\
**Last updated:** [April 27, 2021, 6:43am UTC](https://discourse.cmake.org/t/presets-should-ignore-the-toplevel-schema-entry/3025 "2021-04-27T06:43:59Z")

</div>

To utilize the VSCode’s JSON completion, The CMakePresets.json must contain the “$schema” entry at the top-level. But cmake.exe refuses this ( :disappointed\_relieved: say “Invalid root object”).

---

## [Conditional include for nested header](https://discourse.cmake.org/t/conditional-include-for-nested-header/3212)

<div class="topic-metadata">

**Author:** [@William\_Bright](https://discourse.cmake.org/u/William_Bright)\
**Replies:** 1\
**Last updated:** [April 26, 2021, 12:31pm UTC](https://discourse.cmake.org/t/conditional-include-for-nested-header/3212 "2021-04-26T12:31:13Z")

</div>

I am running into an issue with a conditional include for a sub directory header. The structure is as follows: project/ include/foo.h src/ baz.h foo.c modules/bar/bar.h foo.c has the fol…

---

## [compilation database file generation for GCC and IAR toolchains](https://discourse.cmake.org/t/compilation-database-file-generation-for-gcc-and-iar-toolchains/3198)

<div class="topic-metadata">

**Author:** [@Krishna](https://discourse.cmake.org/u/Krishna)\
**Replies:** 4\
**Last updated:** [April 26, 2021, 11:21am UTC](https://discourse.cmake.org/t/compilation-database-file-generation-for-gcc-and-iar-toolchains/3198 "2021-04-26T11:21:56Z")

</div>

I’m generating a compilation database file compilation\_commands.json by setting set(CMAKE\_EXPORT\_COMPILE\_COMMANDS ON) in the cmake. The compilation\_commands.json file was generating for both GCC & IAR toolchains. Now th…

---

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

<div class="topic-metadata">

**Author:** [@Abdo\_Ameen](https://discourse.cmake.org/u/Abdo_Ameen)\
**Replies:** 7\
**Last updated:** [April 22, 2021, 11:49am UTC](https://discourse.cmake.org/t/the-c-compiler-is-not-able-to-compile-a-simple-test-program/3177 "2021-04-22T11:49:44Z")

</div>

Hello, Hello, I’m trying to install Gazebo on my Windows 10 machine and I’m following the official tutorial (http://gazebosim.org/tutorials?tut=install\_on\_windows&cat=install). When I try to configure and build the depe…

---

## [Install Cmake 3.8.1 command line with option](https://discourse.cmake.org/t/install-cmake-3-8-1-command-line-with-option/3181)

<div class="topic-metadata">

**Author:** [@thomas](https://discourse.cmake.org/u/thomas)\
**Replies:** 0\
**Last updated:** [April 21, 2021, 1:27pm UTC](https://discourse.cmake.org/t/install-cmake-3-8-1-command-line-with-option/3181 "2021-04-21T13:27:22Z")

</div>

Hi, i didn’t find a command line for the install option I explain, i use sccm for create and install applications i use the MSI cmake 3.8.1 for basic install it’s simple sccm find the command line automatically (MSI…

---

## [Question about 'LIBRARY\_SEARCH\_PATHS' and static libraries.](https://discourse.cmake.org/t/question-about-library-search-paths-and-static-libraries/2783)

<div class="topic-metadata">

**Author:** [@dannyNK](https://discourse.cmake.org/u/dannyNK)\
**Replies:** 8\
**Last updated:** [April 21, 2021, 1:27pm UTC](https://discourse.cmake.org/t/question-about-library-search-paths-and-static-libraries/2783 "2021-04-21T13:27:00Z")

</div>

In cmGlobalXCodeGenerator.cxx(3612) there is a section that skips setup of LIBRARY\_SEARCH\_PATHS for a target that is a STATIC\_LIBRARY Code Snippet: // Skip link information for object libraries. if (gt-\>GetType() == cm…

---

## [Configure and build presets consistency](https://discourse.cmake.org/t/configure-and-build-presets-consistency/3147)

<div class="topic-metadata">

**Author:** [@enovozhilov](https://discourse.cmake.org/u/enovozhilov)\
**Replies:** 1\
**Last updated:** [April 20, 2021, 2:06pm UTC](https://discourse.cmake.org/t/configure-and-build-presets-consistency/3147 "2021-04-20T14:06:04Z")

</div>

Hi there, I’ve recently started experimenting with CMake Presets feature in 3.20 and got a little bit confused by the build presets implementation. As an example, with a preset I can configure the project straight from …

---

## [CPack RPM change file ownership](https://discourse.cmake.org/t/cpack-rpm-change-file-ownership/3174)

<div class="topic-metadata">

**Author:** [@jwm](https://discourse.cmake.org/u/jwm)\
**Replies:** 5\
**Last updated:** [April 19, 2021, 5:06pm UTC](https://discourse.cmake.org/t/cpack-rpm-change-file-ownership/3174 "2021-04-19T17:06:48Z")

</div>

I need to add a file to my project package to perform network configuration using NetworkManager (RHEL). The requirements for this file are that it be owned by root, not writable by group/other, and executable. I know I…

---

## [cmake-gui locked by preset custom](https://discourse.cmake.org/t/cmake-gui-locked-by-preset-custom/3158)

<div class="topic-metadata">

**Author:** [@jodysmith](https://discourse.cmake.org/u/jodysmith)\
**Replies:** 1\
**Last updated:** [April 16, 2021, 1:30pm UTC](https://discourse.cmake.org/t/cmake-gui-locked-by-preset-custom/3158 "2021-04-16T13:30:55Z")

</div>

Every time I use cmake-gui to configure and generate build files for opencv / visual studio 2019 afterward the cmake-gui is forever locked with preset on with no more flag search/display, configure or generate button. …

---

## [Source RPM value and CPACK\_RPM\_DEBUGINFO\_SINGLE\_PACKAGE](https://discourse.cmake.org/t/source-rpm-value-and-cpack-rpm-debuginfo-single-package/3012)

<div class="topic-metadata">

**Author:** [@masdaq](https://discourse.cmake.org/u/masdaq)\
**Replies:** 0\
**Last updated:** [March 25, 2021, 5:58am UTC](https://discourse.cmake.org/t/source-rpm-value-and-cpack-rpm-debuginfo-single-package/3012 "2021-03-25T05:58:58Z")

</div>

I have a question on reported ‘Source RPM’ value and CPACK\_RPM\_DEBUGINFO\_SINGLE\_PACKAGE usage. I have the following files: CMakeLists.txt: cmake\_minimum\_required(VERSION 3.17.5) project(main VERSION 1.0.0) set(CMAKE…

---

## [Address sanitizer for MSVC](https://discourse.cmake.org/t/address-sanitizer-for-msvc/2480)

<div class="topic-metadata">

**Author:** [@objectx](https://discourse.cmake.org/u/objectx)\
**Replies:** 2\
**Last updated:** [April 14, 2021, 6:20pm UTC](https://discourse.cmake.org/t/address-sanitizer-for-msvc/2480 "2021-04-14T18:20:55Z")

</div>

MSVC has a native address sanitizer. But the -fsanitize=address and /RTC1 settings are exclusive (cf. Runtime chesk and Address Sanitizer are disabled ) /RTC1 setting comes from the Modules/Platform/Windows-MSVC.cmake:2…

---

## [Complete compiler path in compile commands.](https://discourse.cmake.org/t/complete-compiler-path-in-compile-commands/3127)

<div class="topic-metadata">

**Author:** [@TummalaManish](https://discourse.cmake.org/u/TummalaManish)\
**Replies:** 5\
**Last updated:** [April 12, 2021, 7:02pm UTC](https://discourse.cmake.org/t/complete-compiler-path-in-compile-commands/3127 "2021-04-12T19:02:20Z")

</div>

In the compile commands json the path to the compiler is truncated as follows. Is there an option to get the full compiler path?.

---

## [convert a gcc statement to Cmake](https://discourse.cmake.org/t/convert-a-gcc-statement-to-cmake/3124)

<div class="topic-metadata">

**Author:** [@Chris\_Nabold](https://discourse.cmake.org/u/Chris_Nabold)\
**Replies:** 1\
**Last updated:** [April 12, 2021, 3:34pm UTC](https://discourse.cmake.org/t/convert-a-gcc-statement-to-cmake/3124 "2021-04-12T15:34:51Z")

</div>

I tried to convert the following litte problem to Cmake, but whatever I tried I could not solve the problem. I downloaded and instaleed Lapack using Mingw-64 which created the following directories/filess using Cmake C…

---

## [How can I include a external dependency source c file](https://discourse.cmake.org/t/how-can-i-include-a-external-dependency-source-c-file/3122)

<div class="topic-metadata">

**Author:** [@longjiang321](https://discourse.cmake.org/u/longjiang321)\
**Replies:** 3\
**Last updated:** [April 12, 2021, 2:15pm UTC](https://discourse.cmake.org/t/how-can-i-include-a-external-dependency-source-c-file/3122 "2021-04-12T14:15:33Z")

</div>

I am trying to start opengl develop with cMake on Qt, the base informations are as below: glad: version4.6; glfw: version3.3.4, QT: version5.12. the file tree as below: my cmake are as below: cmake\_minimum\_require…

---

## [Documented criteria for build correctness?](https://discourse.cmake.org/t/documented-criteria-for-build-correctness/3087)

<div class="topic-metadata">

**Author:** [@alex](https://discourse.cmake.org/u/alex)\
**Replies:** 6\
**Last updated:** [April 11, 2021, 1:20pm UTC](https://discourse.cmake.org/t/documented-criteria-for-build-correctness/3087 "2021-04-11T13:20:47Z")

</div>

I have encountered the following surprising (to me) patterns that enough projects follow that I thought I should ask about them: Some projects expect you to run the equivalent of cmake . && cmake --build . for every in…

---

## [Best practices to set imported package settings](https://discourse.cmake.org/t/best-practices-to-set-imported-package-settings/3053)

<div class="topic-metadata">

**Author:** [@papush](https://discourse.cmake.org/u/papush)\
**Replies:** 3\
**Last updated:** [April 9, 2021, 9:51am UTC](https://discourse.cmake.org/t/best-practices-to-set-imported-package-settings/3053 "2021-04-09T09:51:36Z")

</div>

In Deniz Bahadir’s “More Modern CMake” talk, slide 12 presents how he integrates external dependencies by having a CMakeLists.txt file for each of them in an external/ subdirectory. One thing i fail to understand is t…

---

## [\`cmake\_policy\` get overwritten by \`cmake\_minimum\_required()\`](https://discourse.cmake.org/t/cmake-policy-get-overwritten-by-cmake-minimum-required/3097)

<div class="topic-metadata">

**Author:** [@Kerstin\_Keller](https://discourse.cmake.org/u/Kerstin_Keller)\
**Replies:** 5\
**Last updated:** [April 8, 2021, 12:56pm UTC](https://discourse.cmake.org/t/cmake-policy-get-overwritten-by-cmake-minimum-required/3097 "2021-04-08T12:56:38Z")

</div>

I have the usecase that I want to include a subproject, and set some variables for options of that subproject. With policy 0077 set to new, I can do that. However I am experiencing some problems, that somehow setting the…

---

## [How does CPack know whether it should create a source o binary package?](https://discourse.cmake.org/t/how-does-cpack-know-whether-it-should-create-a-source-o-binary-package/3103)

<div class="topic-metadata">

**Author:** [@RedDwarf](https://discourse.cmake.org/u/RedDwarf)\
**Replies:** 1\
**Last updated:** [April 8, 2021, 11:40am UTC](https://discourse.cmake.org/t/how-does-cpack-know-whether-it-should-create-a-source-o-binary-package/3103 "2021-04-08T11:40:49Z")

</div>

I have set CPACK\_PROJECT\_CONFIG\_FILE and in that config file I have a if(CPACK\_GENERATOR MATCHES "^(7Z|TBZ2|TGZ|TXZ|TZ|TZST|ZIP)$"). The thing is that I want to create both source and binary TGZ packages, and I only want…

---

## [Specifying multiple CMAKE\_PREFIX\_PATHs separated by semicolons on command line does not work](https://discourse.cmake.org/t/specifying-multiple-cmake-prefix-paths-separated-by-semicolons-on-command-line-does-not-work/3083)

<div class="topic-metadata">

**Author:** [@Olumide](https://discourse.cmake.org/u/Olumide)\
**Replies:** 3\
**Last updated:** [April 7, 2021, 7:32pm UTC](https://discourse.cmake.org/t/specifying-multiple-cmake-prefix-paths-separated-by-semicolons-on-command-line-does-not-work/3083 "2021-04-07T19:32:45Z")

</div>

Hello List, I am trying to specify multiple semicolon separated CMAKE\_PREFIX\_PATHs on the command line like so: cmake -DCMAKE\_PREFIX\_PATH=/home/Olumide/src/project/Release/install/lib/cmake;/home/Olumide/src/project/R…

---

## [Why is cmake on Linux so much faster than on Windows?](https://discourse.cmake.org/t/why-is-cmake-on-linux-so-much-faster-than-on-windows/1918)

<div class="topic-metadata">

**Author:** [@Knitschi](https://discourse.cmake.org/u/Knitschi)\
**Replies:** 6\
**Last updated:** [April 7, 2021, 11:41am UTC](https://discourse.cmake.org/t/why-is-cmake-on-linux-so-much-faster-than-on-windows/1918 "2021-04-07T11:41:12Z")

</div>

In my project the cmake generate step takes 5 seconds with the makefile generator on Ubuntu while the same project takes 33 seconds on Windows with the Visual Studio generator. The 5 seconds are so much nicer when workin…

---

## [Get warning/error count](https://discourse.cmake.org/t/get-warning-error-count/3088)

<div class="topic-metadata">

**Author:** [@tom](https://discourse.cmake.org/u/tom)\
**Replies:** 5\
**Last updated:** [April 7, 2021, 8:34am UTC](https://discourse.cmake.org/t/get-warning-error-count/3088 "2021-04-07T08:34:09Z")

</div>

Hi All, I have a CMake project that attempts to catch a huge number of errors in the configuration stage. This works quite well, and the output is normally no more than a hundred or so lines. However, even with such s…

---

## [How to clean up unused cache variables?](https://discourse.cmake.org/t/how-to-clean-up-unused-cache-variables/3076)

<div class="topic-metadata">

**Author:** [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)\
**Replies:** 6\
**Last updated:** [April 5, 2021, 6:49pm UTC](https://discourse.cmake.org/t/how-to-clean-up-unused-cache-variables/3076 "2021-04-05T18:49:36Z")

</div>

I have a project that has an option: option(FOOBAR "hello world") After a while I realize I don’t need this option. So I remove it from my project. However, it’s still in my cache. This can cause confusion for other d…

---

## [Redirecting gcc diagnostics into a file](https://discourse.cmake.org/t/redirecting-gcc-diagnostics-into-a-file/3041)

<div class="topic-metadata">

**Author:** [@Lothar\_Scholz](https://discourse.cmake.org/u/Lothar_Scholz)\
**Replies:** 5\
**Last updated:** [April 3, 2021, 8:09am UTC](https://discourse.cmake.org/t/redirecting-gcc-diagnostics-into-a-file/3041 "2021-04-03T08:09:59Z")

</div>

During my CI build i want to use -fdiagnostics-format=json to generate a nice build report. How can i redirect the output of every compiler call into a file? On a command line i would write gcc -c -fdiagnostics-format…

---

## [elf32 dependencies get packed](https://discourse.cmake.org/t/elf32-dependencies-get-packed/3051)

<div class="topic-metadata">

**Author:** [@oscarh](https://discourse.cmake.org/u/oscarh)\
**Replies:** 2\
**Last updated:** [April 2, 2021, 11:17pm UTC](https://discourse.cmake.org/t/elf32-dependencies-get-packed/3051 "2021-04-02T23:17:35Z")

</div>

I’m using CMake 3.20. I have a 64-bit Linux application built by running CMake scripts. After I ran CPack to create a binary package, I found 32-bit system libraries were pulled into the package, while it should pull 64…

---

## [parallel cppcheck invocation corrupts common output file](https://discourse.cmake.org/t/parallel-cppcheck-invocation-corrupts-common-output-file/3071)

<div class="topic-metadata">

**Author:** [@axel](https://discourse.cmake.org/u/axel)\
**Replies:** 6\
**Last updated:** [April 2, 2021, 6:09pm UTC](https://discourse.cmake.org/t/parallel-cppcheck-invocation-corrupts-common-output-file/3071 "2021-04-02T18:09:47Z")

</div>

I’m using set(CMAKE\_C\_CPPCHECK "....;--output-file=cppcheck\_output.txt") to capture the result of the run in one signe file. In many cases, this works well, but occasionally the output file is corrupted. It seem the root…

---

## [Qt5 CMake can't find C++ STD library if a definition is added in CMakeLists.txt](https://discourse.cmake.org/t/qt5-cmake-cant-find-c-std-library-if-a-definition-is-added-in-cmakelists-txt/3061)

<div class="topic-metadata">

**Author:** [@Ivan\_Petrov](https://discourse.cmake.org/u/Ivan_Petrov)\
**Replies:** 2\
**Last updated:** [April 2, 2021, 12:14pm UTC](https://discourse.cmake.org/t/qt5-cmake-cant-find-c-std-library-if-a-definition-is-added-in-cmakelists-txt/3061 "2021-04-02T12:14:44Z")

</div>

Here is the problem I am struggling with. I am using CMake to build my Qt5 GUI project. I am using a custom module QML-material project from GitHub. The problem is that as it is said in the project documentation - in or…

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

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