# Usage

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

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

**Page:** 27

---

## [Get complete list of target's source files](https://discourse.cmake.org/t/get-complete-list-of-targets-source-files/10717)

<div class="topic-metadata">

**Author:** [@Kentzo](https://discourse.cmake.org/u/Kentzo)\
**Replies:** 1\
**Last updated:** [April 27, 2024, 3:47pm UTC](https://discourse.cmake.org/t/get-complete-list-of-targets-source-files/10717 "2024-04-27T15:47:33Z")

</div>

I’m using Qt’s CMake commands to define my targets. Under the hood, due to how Qt builds its source files, the generated project ends up with many dynamically added files. When the Xcode project is generated, these files…

---

## [Export and implicit library dependencies](https://discourse.cmake.org/t/export-and-implicit-library-dependencies/10716)

<div class="topic-metadata">

**Author:** [@Felix-El](https://discourse.cmake.org/u/Felix-El)\
**Replies:** 1\
**Last updated:** [April 27, 2024, 3:46pm UTC](https://discourse.cmake.org/t/export-and-implicit-library-dependencies/10716 "2024-04-27T15:46:31Z")

</div>

On Linux, I’m building a shared library with CMake and exporting a find config for other projects to find\_package it. Now the C++ linker adds dependencies on implicit libraries (libcplusplus and more). If I try to impor…

---

## [\[C++\] PE asking for .dll EVEN with static linker flag](https://discourse.cmake.org/t/c-pe-asking-for-dll-even-with-static-linker-flag/10703)

<div class="topic-metadata">

**Author:** [@Roberto](https://discourse.cmake.org/u/Roberto)\
**Replies:** 1\
**Last updated:** [April 27, 2024, 3:43pm UTC](https://discourse.cmake.org/t/c-pe-asking-for-dll-even-with-static-linker-flag/10703 "2024-04-27T15:43:13Z")

</div>

Good evening! My .exe has been built and worked well on my PC, but once I tried to run it on my Laptop, I got a bigger surprise than in Thailand :frowning:. “libcurl.dll was not found”, - What?? I use target\_link\_libra…

---

## [How to save ctest\_test() failed test summary into a variable/file?](https://discourse.cmake.org/t/how-to-save-ctest-test-failed-test-summary-into-a-variable-file/10694)

<div class="topic-metadata">

**Author:** [@solemnPonie0](https://discourse.cmake.org/u/solemnPonie0)\
**Replies:** 1\
**Last updated:** [April 27, 2024, 3:38pm UTC](https://discourse.cmake.org/t/how-to-save-ctest-test-failed-test-summary-into-a-variable-file/10694 "2024-04-27T15:38:48Z")

</div>

I am running ctest as a dashboard client, and I am running it like this: ctest\_test(INCLUDE\_LABEL “${MY\_LABELS}” RETURN\_VALUE MY\_CTEST\_RETVAL PARALLEL\_LEVEL ${MY\_NPROC}) This prints a nice summary of failed and succe…

---

## [Setting log level in cmake-ui](https://discourse.cmake.org/t/setting-log-level-in-cmake-ui/10693)

<div class="topic-metadata">

**Author:** [@codeling](https://discourse.cmake.org/u/codeling)\
**Replies:** 1\
**Last updated:** [April 27, 2024, 3:37pm UTC](https://discourse.cmake.org/t/setting-log-level-in-cmake-ui/10693 "2024-04-27T15:37:49Z")

</div>

Is there a simpler way of setting the log level (what is changed via --log-level on the command line) in the GUI, other than manually adding the CMAKE\_MESSAGE\_LOG\_LEVEL variable?

---

## [How to attach Nuget package.config file for cmake project](https://discourse.cmake.org/t/how-to-attach-nuget-package-config-file-for-cmake-project/10685)

<div class="topic-metadata">

**Author:** [@harshith\_raj](https://discourse.cmake.org/u/harshith_raj)\
**Replies:** 1\
**Last updated:** [April 27, 2024, 3:36pm UTC](https://discourse.cmake.org/t/how-to-attach-nuget-package-config-file-for-cmake-project/10685 "2024-04-27T15:36:08Z")

</div>

Hi, I’m working on CPP WinUI3 desktop application with cmake. By default WinUI3 project uses MSBuild. We made the project use cmake with the help of this sample project. ref - GitHub - fredemmott/cmake-cpp-winrt-winui3:…

---

## [VS: CMP0147 always triggers custom steps rebuild for CMake 3.27+](https://discourse.cmake.org/t/vs-cmp0147-always-triggers-custom-steps-rebuild-for-cmake-3-27/10548)

<div class="topic-metadata">

**Author:** [@AJIOB](https://discourse.cmake.org/u/AJIOB)\
**Replies:** 4\
**Last updated:** [April 27, 2024, 3:31pm UTC](https://discourse.cmake.org/t/vs-cmp0147-always-triggers-custom-steps-rebuild-for-cmake-3-27/10548 "2024-04-27T15:31:24Z")

</div>

Hello I have a big closed-source project, that uses CMake as a main build system. After upgrading from CMake 3.26 to CMake 3.27 I see, that my custom generators are always rebuild. I just run 5 sequential builds and a…

---

## [Multiple targets, propagate options to libraries, circular dependencies](https://discourse.cmake.org/t/multiple-targets-propagate-options-to-libraries-circular-dependencies/10651)

<div class="topic-metadata">

**Author:** [@ra-kal](https://discourse.cmake.org/u/ra-kal)\
**Replies:** 2\
**Last updated:** [April 27, 2024, 3:24pm UTC](https://discourse.cmake.org/t/multiple-targets-propagate-options-to-libraries-circular-dependencies/10651 "2024-04-27T15:24:14Z")

</div>

Hello. Ok, I’m a total newbee with CMake. I need a little help to point me into the right direction to go. I must solve several problems: I need to build to targets: Firmware and Bootloader. Both require different glo…

---

## [CDash: What do I have to do so that test time graphs appear?](https://discourse.cmake.org/t/cdash-what-do-i-have-to-do-so-that-test-time-graphs-appear/10630)

<div class="topic-metadata">

**Author:** [@solemnPonie0](https://discourse.cmake.org/u/solemnPonie0)\
**Replies:** 4\
**Last updated:** [April 26, 2024, 12:26pm UTC](https://discourse.cmake.org/t/cdash-what-do-i-have-to-do-so-that-test-time-graphs-appear/10630 "2024-04-26T12:26:41Z")

</div>

I am using CDash to display test results. Although the results are displayed correctly, the graph at " Display graphs: Test time" is empty. What do I have to do in order for it to appear? Do the “Build names” have to …

---

## [Regex quoting?](https://discourse.cmake.org/t/regex-quoting/10730)

<div class="topic-metadata">

**Author:** [@dabrahams](https://discourse.cmake.org/u/dabrahams)\
**Replies:** 4\
**Last updated:** [April 26, 2024, 9:43am UTC](https://discourse.cmake.org/t/regex-quoting/10730 "2024-04-26T09:43:28Z")

</div>

I have a string in a variable that I want to match literally as a regular expression. I want any special regex characters to be interpreted literally. In most environments there’s a “regex quote” operation that transfor…

---

## [Copying files with destination folder depending on build config](https://discourse.cmake.org/t/copying-files-with-destination-folder-depending-on-build-config/10686)

<div class="topic-metadata">

**Author:** [@codeling](https://discourse.cmake.org/u/codeling)\
**Replies:** 2\
**Last updated:** [April 24, 2024, 10:01am UTC](https://discourse.cmake.org/t/copying-files-with-destination-folder-depending-on-build-config/10686 "2024-04-24T10:01:09Z")

</div>

I have some files that I want to copy to the binary folder (let’s say, data files required for the program to run). I typically build on Windows with Visual Studio, so the copying should support multi-config generators. …

---

## [Header Linking not working](https://discourse.cmake.org/t/header-linking-not-working/10739)

<div class="topic-metadata">

**Author:** [@wieserfalke](https://discourse.cmake.org/u/wieserfalke)\
**Replies:** 2\
**Last updated:** [April 24, 2024, 9:31am UTC](https://discourse.cmake.org/t/header-linking-not-working/10739 "2024-04-24T09:31:48Z")

</div>

I have the Problem that when I compile the compiler complains that he can not find the header of a library that I have written. The CMake file looks like this: set(TitleBlock\_SOURCES titleblock.h titleblock.cpp ) a…

---

## [find\_package NAMES \<PackageName\>\_FOUND](https://discourse.cmake.org/t/find-package-names-packagename-found/10617)

<div class="topic-metadata">

**Author:** [@loesch](https://discourse.cmake.org/u/loesch)\
**Replies:** 4\
**Last updated:** [April 23, 2024, 5:36pm UTC](https://discourse.cmake.org/t/find-package-names-packagename-found/10617 "2024-04-23T17:36:16Z")

</div>

I am asking to help me for some find\_package behavior for two packages: PackageName1: a system supplied package PackageName2: self build newer version of PackageName1 If I apply the find\_package command with: find\_pa…

---

## [Tasking Toolchain: How to properly use it?](https://discourse.cmake.org/t/tasking-toolchain-how-to-properly-use-it/7615)

<div class="topic-metadata">

**Author:** [@KnoerleMan](https://discourse.cmake.org/u/KnoerleMan)\
**Replies:** 12\
**Last updated:** [April 23, 2024, 8:16am UTC](https://discourse.cmake.org/t/tasking-toolchain-how-to-properly-use-it/7615 "2024-04-23T08:16:53Z")

</div>

Hello, currently im trying to setup a cmake project which should be used to compile an application for the infineon aurix tc29xb microcontroller using the tasking toolchain. The cmake project must be usable under windo…

---

## [Before or after 'project' command](https://discourse.cmake.org/t/before-or-after-project-command/10700)

<div class="topic-metadata">

**Author:** [@output](https://discourse.cmake.org/u/output)\
**Replies:** 4\
**Last updated:** [April 20, 2024, 10:46pm UTC](https://discourse.cmake.org/t/before-or-after-project-command/10700 "2024-04-20T22:46:01Z")

</div>

During setup of a CMake file in QtCreator for cross compiling, I ran into an issue whit took me quite some time to find out. ( Using CMake 3.29.2 ) Usually I put the project() command somewhere on top of the CMakelists.…

---

## [add\_test function is prepending "/usr/bin/" to my command](https://discourse.cmake.org/t/add-test-function-is-prepending-usr-bin-to-my-command/10691)

<div class="topic-metadata">

**Author:** [@P11](https://discourse.cmake.org/u/P11)\
**Replies:** 6\
**Last updated:** [April 18, 2024, 6:28pm UTC](https://discourse.cmake.org/t/add-test-function-is-prepending-usr-bin-to-my-command/10691 "2024-04-18T18:28:25Z")

</div>

I’m trying to run a test via mpirun -n 2 python3 ... and the python3 on my path is not in /usr/bin but because, for some reason, /usr/bin is being used in the final command via ctest that the command looks like /usr/bin…

---

## [CMAKE\_BUILD\_TYPE is both a normal and a cache variable](https://discourse.cmake.org/t/cmake-build-type-is-both-a-normal-and-a-cache-variable/10664)

<div class="topic-metadata">

**Author:** [@mredenti](https://discourse.cmake.org/u/mredenti)\
**Replies:** 3\
**Last updated:** [April 17, 2024, 7:35pm UTC](https://discourse.cmake.org/t/cmake-build-type-is-both-a-normal-and-a-cache-variable/10664 "2024-04-17T19:35:58Z")

</div>

I am really confused by the following fact: CMAKE\_BUILD\_TYPE is both a “normal” variable and a cache variable in CMake. Indeed, it appears both in the CMakeCache.txt, whose value detaults to an empty string, and in the …

---

## [Windows resources file and manifest dpi awareness](https://discourse.cmake.org/t/windows-resources-file-and-manifest-dpi-awareness/10247)

<div class="topic-metadata">

**Author:** [@StillWaters77](https://discourse.cmake.org/u/StillWaters77)\
**Replies:** 2\
**Last updated:** [April 17, 2024, 6:10am UTC](https://discourse.cmake.org/t/windows-resources-file-and-manifest-dpi-awareness/10247 "2024-04-17T06:10:50Z")

</div>

I have trouble linking both resources (\*.rc for a windows icon) as well as a manifest into my application. First i only had a manifest in which i set the DPI awareness to PerMonitor. This worked as expected: moving the …

---

## [Various version of the same Fortran/C compiler](https://discourse.cmake.org/t/various-version-of-the-same-fortran-c-compiler/10661)

<div class="topic-metadata">

**Author:** [@Ruben\_Meana\_Paneda](https://discourse.cmake.org/u/Ruben_Meana_Paneda)\
**Replies:** 3\
**Last updated:** [April 17, 2024, 1:44am UTC](https://discourse.cmake.org/t/various-version-of-the-same-fortran-c-compiler/10661 "2024-04-17T01:44:47Z")

</div>

When we have several versions of the same compiler how can we make that cmake chooses the newest one by default?

---

## [add\_dependencies could not able to find system default libraries in 3.28.3](https://discourse.cmake.org/t/add-dependencies-could-not-able-to-find-system-default-libraries-in-3-28-3/10670)

<div class="topic-metadata">

**Author:** [@ramana](https://discourse.cmake.org/u/ramana)\
**Replies:** 9\
**Last updated:** [April 16, 2024, 4:49pm UTC](https://discourse.cmake.org/t/add-dependencies-could-not-able-to-find-system-default-libraries-in-3-28-3/10670 "2024-04-16T16:49:53Z")

</div>

In the cmake 3.28.3, when I give library ( example here is libdl.so.2) , in the add\_dependencies, its throwing an error: The dependency target “dl” of target “xxxx” does not exist. add\_dependencies(xxxx zzzz dl) The d…

---

## [No Cuda syntax highlighting/debugging when using CMake.](https://discourse.cmake.org/t/no-cuda-syntax-highlighting-debugging-when-using-cmake/10675)

<div class="topic-metadata">

**Author:** [@LouChiSoft](https://discourse.cmake.org/u/LouChiSoft)\
**Replies:** 0\
**Last updated:** [April 16, 2024, 11:58am UTC](https://discourse.cmake.org/t/no-cuda-syntax-highlighting-debugging-when-using-cmake/10675 "2024-04-16T11:58:45Z")

</div>

Hi, when using Visual Studio to open a CMake project (not a visual studio project generated by CMake) and pass the command line arguments --preset conan-default in CMakeSettings.json I get a valid project that builds wit…

---

## [FetchContent of an install tarball](https://discourse.cmake.org/t/fetchcontent-of-an-install-tarball/10479)

<div class="topic-metadata">

**Author:** [@dabrahams](https://discourse.cmake.org/u/dabrahams)\
**Replies:** 2\
**Last updated:** [April 15, 2024, 7:11pm UTC](https://discourse.cmake.org/t/fetchcontent-of-an-install-tarball/10479 "2024-04-15T19:11:39Z")

</div>

I have a tarball of a pre-compiled LLVM installation that I’d like to download with FetchContent and integrate into my project. I may have missed it in the docs if this use case is directly supported. I want to use Fet…

---

## [cpack: how to generate a deb package with dependencies ?](https://discourse.cmake.org/t/cpack-how-to-generate-a-deb-package-with-dependencies/10663)

<div class="topic-metadata">

**Author:** [@neundorf](https://discourse.cmake.org/u/neundorf)\
**Replies:** 1\
**Last updated:** [April 15, 2024, 4:32pm UTC](https://discourse.cmake.org/t/cpack-how-to-generate-a-deb-package-with-dependencies/10663 "2024-04-15T16:32:08Z")

</div>

Hi, when generating a rpm file using cpack, the rpm tools automatically scan the files which go into the rpm and generate the dependency info from that. Now I tried the same with deb, it tells me that CPACK\_DEBIAN\_PACK…

---

## [Can't build my own project even if I specify the include directories and all the libraries](https://discourse.cmake.org/t/cant-build-my-own-project-even-if-i-specify-the-include-directories-and-all-the-libraries/10659)

<div class="topic-metadata">

**Author:** [@manuelpagliuca](https://discourse.cmake.org/u/manuelpagliuca)\
**Replies:** 0\
**Last updated:** [April 15, 2024, 12:29pm UTC](https://discourse.cmake.org/t/cant-build-my-own-project-even-if-i-specify-the-include-directories-and-all-the-libraries/10659 "2024-04-15T12:29:05Z")

</div>

Good morning, I’ve an issue with my current build, I’m also using Conan 2.2.2 and I’m attempting to use the following cmake command for generating the build: cmake -DCMAKE\_BUILD\_TYPE=Debug -DCMAKE\_TOOLCHAIN\_FILE="./cona…

---

## [it seems to generate recursion and continue to print logs](https://discourse.cmake.org/t/it-seems-to-generate-recursion-and-continue-to-print-logs/10601)

<div class="topic-metadata">

**Author:** [@zhenye-tang](https://discourse.cmake.org/u/zhenye-tang)\
**Replies:** 3\
**Last updated:** [April 15, 2024, 4:48am UTC](https://discourse.cmake.org/t/it-seems-to-generate-recursion-and-continue-to-print-logs/10601 "2024-04-15T04:48:59Z")

</div>

Use cmake .. After the command, it seems to generate recursion and continue to print logs. Who can help me solve this problem? thanks -- The C compiler identification is GNU 11.4.0 -- The CXX compiler identification is …

---

## [Does ENVIRONMENT\_MODIFICATION property support generator expression?](https://discourse.cmake.org/t/does-environment-modification-property-support-generator-expression/10442)

<div class="topic-metadata">

**Author:** [@b1an](https://discourse.cmake.org/u/b1an)\
**Replies:** 7\
**Last updated:** [April 13, 2024, 12:22am UTC](https://discourse.cmake.org/t/does-environment-modification-property-support-generator-expression/10442 "2024-04-13T00:22:04Z")

</div>

I’m using set\_tests\_properties to prepend a new directory in $ENV{PATH}. What I expect is this test case can find a imported target shared library. set\_tests\_properties(normal\_test PROPERTIES ENVIRONMENT\_MODIFICAT…

---

## [FILE\_SET include directory manipulation](https://discourse.cmake.org/t/file-set-include-directory-manipulation/10648)

<div class="topic-metadata">

**Author:** [@pjfasano](https://discourse.cmake.org/u/pjfasano)\
**Replies:** 5\
**Last updated:** [April 12, 2024, 10:10pm UTC](https://discourse.cmake.org/t/file-set-include-directory-manipulation/10648 "2024-04-12T22:10:14Z")

</div>

I am trying to understand how to correctly install using FILE\_SET for a very simple (i.e. flat) directory structure: myproj/ |--- CMakeLists.txt |--- foo.h |--- foo.cpp After installation, I want the file tree to be: $…

---

## [How can I make the Xcode generator create a project with folders in alphabetical order?](https://discourse.cmake.org/t/how-can-i-make-the-xcode-generator-create-a-project-with-folders-in-alphabetical-order/10633)

<div class="topic-metadata">

**Author:** [@etjernlund](https://discourse.cmake.org/u/etjernlund)\
**Replies:** 2\
**Last updated:** [April 11, 2024, 6:21pm UTC](https://discourse.cmake.org/t/how-can-i-make-the-xcode-generator-create-a-project-with-folders-in-alphabetical-order/10633 "2024-04-11T18:21:36Z")

</div>

Is there a way to make the Xcode generator to create a project with the folders in alphabetical order? We have a very large project and it seems the folders end up in the order they are found when the generation is done. …

---

## [Remove a target dependency?](https://discourse.cmake.org/t/remove-a-target-dependency/10592)

<div class="topic-metadata">

**Author:** [@dabrahams](https://discourse.cmake.org/u/dabrahams)\
**Replies:** 1\
**Last updated:** [April 11, 2024, 4:48pm UTC](https://discourse.cmake.org/t/remove-a-target-dependency/10592 "2024-04-11T16:48:15Z")

</div>

I’m looking for a workaround for this bug. CMake is creating a dependency on a non-existent file for no good reason I can see. The exact same custom command pattern has been used elsewhere with success. It seems unlik…

---

## [Clarify how interface library is installed](https://discourse.cmake.org/t/clarify-how-interface-library-is-installed/10572)

<div class="topic-metadata">

**Author:** [@gaz0](https://discourse.cmake.org/u/gaz0)\
**Replies:** 1\
**Last updated:** [April 11, 2024, 4:45pm UTC](https://discourse.cmake.org/t/clarify-how-interface-library-is-installed/10572 "2024-04-11T16:45:26Z")

</div>

My question is a much simpler version of a question from 2020: INTERFACE library not getting installed and no error reported. In Step 5 of the tutorial, the interface library tutorial\_compiler\_flags is a member of the l…

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

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