# Usage

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

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

**Page:** 58

---

## [Build external library in subdirectory](https://discourse.cmake.org/t/build-external-library-in-subdirectory/6342)

<div class="topic-metadata">

**Author:** [@andarius](https://discourse.cmake.org/u/andarius)\
**Replies:** 8\
**Last updated:** [August 30, 2022, 8:54pm UTC](https://discourse.cmake.org/t/build-external-library-in-subdirectory/6342 "2022-08-30T20:54:46Z")

</div>

Hi, First, I would like to say I’m new to using CMake to there might be an obvious solution to this that I’m missing. I’m trying to build zstd to be used in Android with jni with the following CMakeLists.txt. I cloned …

---

## [Using Boost with CMake](https://discourse.cmake.org/t/using-boost-with-cmake/6299)

<div class="topic-metadata">

**Author:** [@developer](https://discourse.cmake.org/u/developer)\
**Replies:** 2\
**Last updated:** [August 30, 2022, 5:54pm UTC](https://discourse.cmake.org/t/using-boost-with-cmake/6299 "2022-08-30T17:54:20Z")

</div>

I’m curious to hear common setup of Boost with CMake by the community. I used to only be aware of FindBoost but have recently learned of some more options. I’d be interested to hear pros/cons people have run into. Fi…

---

## [make: \*\*\* \[Makefile:156: all\] Error 2](https://discourse.cmake.org/t/make-makefile-all-error-2/6373)

<div class="topic-metadata">

**Author:** [@Asmae](https://discourse.cmake.org/u/Asmae)\
**Replies:** 4\
**Last updated:** [August 29, 2022, 12:39pm UTC](https://discourse.cmake.org/t/make-makefile-all-error-2/6373 "2022-08-29T12:39:46Z")

</div>

I did this command make -j8 until 97% of the installation, I got this Error: make\[2\]: \*\*\* \[source/persistency/CMakeFiles/G4persistency.dir/build.make:398: source/persistency/CMakeFiles/G4persistency.dir/ascii/src/G4tgrE…

---

## [CMake version related problem?](https://discourse.cmake.org/t/cmake-version-related-problem/6367)

<div class="topic-metadata">

**Author:** [@skgoswami](https://discourse.cmake.org/u/skgoswami)\
**Replies:** 0\
**Last updated:** [August 28, 2022, 12:17pm UTC](https://discourse.cmake.org/t/cmake-version-related-problem/6367 "2022-08-28T12:17:27Z")

</div>

I found a same CMakeLists.txt file behaving differently on Linux. I was using Qt Creator IDE with cmake. In previous version without target\_link\_libraries() command the project was building alright but with recent versi…

---

## [error MSB6004: The specified task executable location "C:\\WINDOWS\\system32\\cmd.exe" is invalid.](https://discourse.cmake.org/t/error-msb6004-the-specified-task-executable-location-c-windows-system32-cmd-exe-is-invalid/6352)

<div class="topic-metadata">

**Author:** [@Pospelove](https://discourse.cmake.org/u/Pospelove)\
**Replies:** 6\
**Last updated:** [August 28, 2022, 12:00pm UTC](https://discourse.cmake.org/t/error-msb6004-the-specified-task-executable-location-c-windows-system32-cmd-exe-is-invalid/6352 "2022-08-28T12:00:08Z")

</div>

Hey! I’m running into an issue with CMake on my Windows machine (Visual Studio 2019 generator). It seems this is specific to my system, but hope you have a clue on how to workaround. Non-cmake generated Visual Studio pr…

---

## [Adding a BOM to NMake artefacts to properly support UTF-8](https://discourse.cmake.org/t/adding-a-bom-to-nmake-artefacts-to-properly-support-utf-8/2715)

<div class="topic-metadata">

**Author:** [@Amine\_Najahi](https://discourse.cmake.org/u/Amine_Najahi)\
**Replies:** 1\
**Last updated:** [February 8, 2021, 5:58pm UTC](https://discourse.cmake.org/t/adding-a-bom-to-nmake-artefacts-to-properly-support-utf-8/2715 "2021-02-08T17:58:33Z")

</div>

Hi, I am reaching out to suggest that, when the ‘NMake Makefiles’ generator is used, response files should be encoded using UTF-8 with BOM. Without this enhancement, the following build fails using CMake (3.18.5): cr…

---

## [Can we change/set the export target name](https://discourse.cmake.org/t/can-we-change-set-the-export-target-name/6357)

<div class="topic-metadata">

**Author:** [@JRR](https://discourse.cmake.org/u/JRR)\
**Replies:** 2\
**Last updated:** [August 26, 2022, 10:13pm UTC](https://discourse.cmake.org/t/can-we-change-set-the-export-target-name/6357 "2022-08-26T22:13:31Z")

</div>

Hello, Is it possible to change a package export target’s name? For example, if foo is my target to create a library I understand that install(TARGETS foo EXPORT foo\_targets ...) Will cause files: fooTargets.cm…

---

## [Limit on add\_custom\_command COMMAND arguments](https://discourse.cmake.org/t/limit-on-add-custom-command-command-arguments/6346)

<div class="topic-metadata">

**Author:** [@tkacvins](https://discourse.cmake.org/u/tkacvins)\
**Replies:** 3\
**Last updated:** [August 26, 2022, 5:11pm UTC](https://discourse.cmake.org/t/limit-on-add-custom-command-command-arguments/6346 "2022-08-26T17:11:34Z")

</div>

Hi, Recently I have run into a problem where the data I pass to COMMAND in an add\_custom\_command, like this: add\_custom\_command( OUTPUT "${CMAKE\_BINARY\_DIR}/list.txt" COMMAND python3 "${CMAKE\_SOURCE\_DIR}/make\_list.py"…

---

## [Need CMake M Plugin help: Single target, Single source, multiple objects, multiples libraries](https://discourse.cmake.org/t/need-cmake-m-plugin-help-single-target-single-source-multiple-objects-multiples-libraries/2951)

<div class="topic-metadata">

**Author:** [@shabiel](https://discourse.cmake.org/u/shabiel)\
**Replies:** 13\
**Last updated:** [August 26, 2022, 1:53pm UTC](https://discourse.cmake.org/t/need-cmake-m-plugin-help-single-target-single-source-multiple-objects-multiples-libraries/2951 "2022-08-26T13:53:40Z")

</div>

Hello everybody, Some of you may remember me. I work with YottaDB now on the M compiler. We have a longstanding issue with our CMake toolchain located here: https://gitlab.com/YottaDB/Tools/YDBCMake. Let’s start with a…

---

## [Target "unity" requires the language dialect "C11"](https://discourse.cmake.org/t/target-unity-requires-the-language-dialect-c11/6333)

<div class="topic-metadata">

**Author:** [@lkahir](https://discourse.cmake.org/u/lkahir)\
**Replies:** 4\
**Last updated:** [August 26, 2022, 12:35pm UTC](https://discourse.cmake.org/t/target-unity-requires-the-language-dialect-c11/6333 "2022-08-26T12:35:20Z")

</div>

Code build is working fine with CMake Version 3.19 but when version upgrade onward, It is showing below error, any suggestion Error: Target “unity” requires the language dialect “C11” . But the current compiler “IAR” d…

---

## [Generator expressions in add\_dependencies](https://discourse.cmake.org/t/generator-expressions-in-add-dependencies/5991)

<div class="topic-metadata">

**Author:** [@fuzzard](https://discourse.cmake.org/u/fuzzard)\
**Replies:** 1\
**Last updated:** [August 25, 2022, 6:01am UTC](https://discourse.cmake.org/t/generator-expressions-in-add-dependencies/5991 "2022-08-25T06:01:57Z")

</div>

Looking for potential info on how to handle the following case I help maintain a piece of software, and im trying to bring our dependency building into the main cmake project. Essentially a meta build to build the proje…

---

## [How do I determine the default bit architecture that cmake selects in windows](https://discourse.cmake.org/t/how-do-i-determine-the-default-bit-architecture-that-cmake-selects-in-windows/6324)

<div class="topic-metadata">

**Author:** [@JRR](https://discourse.cmake.org/u/JRR)\
**Replies:** 1\
**Last updated:** [August 23, 2022, 8:05pm UTC](https://discourse.cmake.org/t/how-do-i-determine-the-default-bit-architecture-that-cmake-selects-in-windows/6324 "2022-08-23T20:05:06Z")

</div>

How do I determine the default bit architecture that cmake selects in windows? I thought I could check the CMAKE\_GENERATOR and/or CMAKE\_GENERATOR\_PLATFORM but this information doesn’t seem to be consistent. For example…

---

## [Cmake Error (unknown argument specified)](https://discourse.cmake.org/t/cmake-error-unknown-argument-specified/6320)

<div class="topic-metadata">

**Author:** [@hoyu-ui](https://discourse.cmake.org/u/hoyu-ui)\
**Replies:** 1\
**Last updated:** [August 23, 2022, 12:04pm UTC](https://discourse.cmake.org/t/cmake-error-unknown-argument-specified/6320 "2022-08-23T12:04:31Z")

</div>

I’m using ubuntu 22.04, and python 3.10. when i run cmake comman while installing package it say CMake Error at cmake/ecbuild\_find\_python.cmake:165 (if): if given arguments: "PYTHON\_LIBRARY" "AND" "PYTHON\_PREFIX" "AND…

---

## [ALIAS and (not) globally visible targets](https://discourse.cmake.org/t/alias-and-not-globally-visible-targets/6305)

<div class="topic-metadata">

**Author:** [@jwm](https://discourse.cmake.org/u/jwm)\
**Replies:** 3\
**Last updated:** [August 22, 2022, 6:50pm UTC](https://discourse.cmake.org/t/alias-and-not-globally-visible-targets/6305 "2022-08-22T18:50:10Z")

</div>

I’m getting an error with CMake 3.16.3 that is not failing in 3.24. The code is working around a legacy construct of created imported targets when the package already has imported targets. So rather than create an import…

---

## [Proper "scope" of Find Modules](https://discourse.cmake.org/t/proper-scope-of-find-modules/6300)

<div class="topic-metadata">

**Author:** [@jwm](https://discourse.cmake.org/u/jwm)\
**Replies:** 3\
**Last updated:** [August 22, 2022, 5:35pm UTC](https://discourse.cmake.org/t/proper-scope-of-find-modules/6300 "2022-08-22T17:35:29Z")

</div>

I apologize at the outset for any lack of clarity in this question. I’m swimming in deep waters and not always staying above the surface. I have tried to figure this out, and have come to a fork in the road, and need to …

---

## [Is there a way to disable incremental linking for Visual Studio 2022](https://discourse.cmake.org/t/is-there-a-way-to-disable-incremental-linking-for-visual-studio-2022/4817)

<div class="topic-metadata">

**Author:** [@tksuoran](https://discourse.cmake.org/u/tksuoran)\
**Replies:** 2\
**Last updated:** [August 19, 2022, 12:10pm UTC](https://discourse.cmake.org/t/is-there-a-way-to-disable-incremental-linking-for-visual-studio-2022/4817 "2022-08-19T12:10:59Z")

</div>

CMake 3.21.3, Windows 10, Visual Studio 2022 I am trying to create executable that I can examine with SizeBench. For that, I need full debug info, and no incremental linking. I’ve tried disabling incremental linking by …

---

## [To find a library for perticular header](https://discourse.cmake.org/t/to-find-a-library-for-perticular-header/6271)

<div class="topic-metadata">

**Author:** [@Om4143](https://discourse.cmake.org/u/Om4143)\
**Replies:** 1\
**Last updated:** [August 17, 2022, 8:14pm UTC](https://discourse.cmake.org/t/to-find-a-library-for-perticular-header/6271 "2022-08-17T20:14:04Z")

</div>

Hello, How I can find the library name of any linked header file? Is there any way to find the dependencies(to find library name) for particular header? Thanks and Regards Omveer Singh

---

## [Is it possible to see what targets are imported and how?](https://discourse.cmake.org/t/is-it-possible-to-see-what-targets-are-imported-and-how/6252)

<div class="topic-metadata">

**Author:** [@rollastre\_gmail.com](https://discourse.cmake.org/u/rollastre_gmail.com)\
**Replies:** 2\
**Last updated:** [August 17, 2022, 8:05pm UTC](https://discourse.cmake.org/t/is-it-possible-to-see-what-targets-are-imported-and-how/6252 "2022-08-17T20:05:30Z")

</div>

Hi. I have a very strange problem I am unable to solve. In a project of mine, I have a dependency on VulkanSceneGraph which, when built it produces a vsg::vsg target. VulkanSceneGraph depends on Vulkan::Vulkan. So wh…

---

## [Help with CPack ignore regex](https://discourse.cmake.org/t/help-with-cpack-ignore-regex/6283)

<div class="topic-metadata">

**Author:** [@mathomp4](https://discourse.cmake.org/u/mathomp4)\
**Replies:** 2\
**Last updated:** [August 16, 2022, 10:09pm UTC](https://discourse.cmake.org/t/help-with-cpack-ignore-regex/6283 "2022-08-16T22:09:37Z")

</div>

All, I’m hoping for some help here. We recently found that we need to add some extra files to our CPACK\_SOURCE\_IGNORE\_FILES and, well, I need help. I currently have: set(CPACK\_SOURCE\_IGNORE\_FILES /.git/ /.mepo/ /…

---

## [Question about unity build and interface library / ODR](https://discourse.cmake.org/t/question-about-unity-build-and-interface-library-odr/6279)

<div class="topic-metadata">

**Author:** [@Milerius](https://discourse.cmake.org/u/Milerius)\
**Replies:** 2\
**Last updated:** [August 16, 2022, 8:37pm UTC](https://discourse.cmake.org/t/question-about-unity-build-and-interface-library-odr/6279 "2022-08-16T20:37:23Z")

</div>

Let’s take the following example: add\_library(tw\_base INTERFACE) target\_sources(tw\_base INTERFACE Data.cpp) target\_include\_directories(tw\_base INTERFACE ${CMAKE\_CURRENT\_SOURCE\_DIR}) set\_target\_properties(tw\_base PROPERT…

---

## [Questions about \`--find-package\` CLI & MSVC](https://discourse.cmake.org/t/questions-about-find-package-cli-msvc/6194)

<div class="topic-metadata">

**Author:** [@h-vetinari](https://discourse.cmake.org/u/h-vetinari)\
**Replies:** 6\
**Last updated:** [August 15, 2022, 8:21pm UTC](https://discourse.cmake.org/t/questions-about-find-package-cli-msvc/6194 "2022-08-15T20:21:38Z")

</div>

The output of cmake --help says --find-package = Legacy pkg-config like mode. Do not use. However, incorrect CMake metadata it is one of the possible failure modes in integration work like conda-forge …

---

## [Cross compiling a Qt application for arm but the target rcc and moc executables are used instead of the host versions](https://discourse.cmake.org/t/cross-compiling-a-qt-application-for-arm-but-the-target-rcc-and-moc-executables-are-used-instead-of-the-host-versions/6240)

<div class="topic-metadata">

**Author:** [@GlennCoombs](https://discourse.cmake.org/u/GlennCoombs)\
**Replies:** 4\
**Last updated:** [August 12, 2022, 2:37pm UTC](https://discourse.cmake.org/t/cross-compiling-a-qt-application-for-arm-but-the-target-rcc-and-moc-executables-are-used-instead-of-the-host-versions/6240 "2022-08-12T14:37:10Z")

</div>

I am using Debian 10 running on AMD64 and trying to setup a cross compilation environment for an aarch64 target. I have used the following command: sbuild-createchroot --debootstrap=qemu-debootstrap --arch=arm64 --chr…

---

## [installer remove file with upgrade specific version](https://discourse.cmake.org/t/installer-remove-file-with-upgrade-specific-version/6231)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.cmake.org/u/alice)\
**Replies:** 1\
**Last updated:** [August 12, 2022, 1:01am UTC](https://discourse.cmake.org/t/installer-remove-file-with-upgrade-specific-version/6231 "2022-08-12T01:01:17Z")

</div>

I use cmake to generate the installer. Assume the installer version: cmake-3.24.0-windows-x86\_64.msi cmake-3.23.3-windows-x86\_64.msi cmake-3.21.3-windows-x86\_64.msi My computer cmake current version is cmake-3.23.3 …

---

## [Install sources and rebuild from installed sources after build?](https://discourse.cmake.org/t/install-sources-and-rebuild-from-installed-sources-after-build/6233)

<div class="topic-metadata">

**Author:** [@shabiel](https://discourse.cmake.org/u/shabiel)\
**Replies:** 4\
**Last updated:** [August 11, 2022, 3:29pm UTC](https://discourse.cmake.org/t/install-sources-and-rebuild-from-installed-sources-after-build/6233 "2022-08-11T15:29:28Z")

</div>

Hello CMakers, Bear with me, as I think this may be an unusual scenario. I will illustrate it with an example. Let’s say we have a file /home/sam/project/x.m. This file is compiled into /home/sam/project/x.o and then l…

---

## [use 'source\_group' generate the Xcode project can't jump the right directory path](https://discourse.cmake.org/t/use-source-group-generate-the-xcode-project-cant-jump-the-right-directory-path/6238)

<div class="topic-metadata">

**Author:** [@Princekin](https://discourse.cmake.org/u/Princekin)\
**Replies:** 0\
**Last updated:** [August 11, 2022, 7:55am UTC](https://discourse.cmake.org/t/use-source-group-generate-the-xcode-project-cant-jump-the-right-directory-path/6238 "2022-08-11T07:55:53Z")

</div>

Hi: I used the CMake to build an iOS XCode project, I have a multiple level source code, so I use ‘source\_group’ to organize them, here is my CMake code file(GLOB\_RECURSE MODULE\_DEMO\_DIR\_FILES "${MODULE\_DEMO\_DIR}…

---

## [LNK4098 use /NODEFAULTLIB:library](https://discourse.cmake.org/t/lnk4098-use-nodefaultlib-library/5427)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.cmake.org/u/alice)\
**Replies:** 4\
**Last updated:** [August 10, 2022, 8:17am UTC](https://discourse.cmake.org/t/lnk4098-use-nodefaultlib-library/5427 "2022-08-10T08:17:16Z")

</div>

I try to use ninja -j4 project It happen this error. I search some comment and it say use vs2019 to setting cpp-docs/nodefaultlib-ignore-libraries.md at main · MicrosoftDocs/cpp-docs · GitHub But I use the command lin…

---

## [Installer sample code](https://discourse.cmake.org/t/installer-sample-code/6232)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.cmake.org/u/alice)\
**Replies:** 0\
**Last updated:** [August 10, 2022, 8:13am UTC](https://discourse.cmake.org/t/installer-sample-code/6232 "2022-08-10T08:13:38Z")

</div>

Windows x64 Installer: https://cmake.org/download/ How can I reference the generated cmake installer sample code

---

## [GLAD CMake](https://discourse.cmake.org/t/glad-cmake/6227)

<div class="topic-metadata">

**Author:** [@petrasvestartas](https://discourse.cmake.org/u/petrasvestartas)\
**Replies:** 0\
**Last updated:** [August 8, 2022, 8:57pm UTC](https://discourse.cmake.org/t/glad-cmake/6227 "2022-08-08T20:57:12Z")

</div>

Hi, I am quite sure that a lot of people already used OpenGL and GLFW. To make GLFW work I need to install manually GLAD from here: https://glad.dav1d.de/ Is there any way to avoid the manual installation and downloa…

---

## [Cannot find wxWidgets - no vcpkg and no HKEY](https://discourse.cmake.org/t/cannot-find-wxwidgets-no-vcpkg-and-no-hkey/6173)

<div class="topic-metadata">

**Author:** [@Robert\_Kamarowski](https://discourse.cmake.org/u/Robert_Kamarowski)\
**Replies:** 6\
**Last updated:** [August 7, 2022, 2:34pm UTC](https://discourse.cmake.org/t/cannot-find-wxwidgets-no-vcpkg-and-no-hkey/6173 "2022-08-07T14:34:37Z")

</div>

I searched other messages and couldn’t find a reference to my particular problem. I have wxWidgets installed with just the wxwin variable set to the install location. I looked at the FindwxWidgets.cmake file, and it onl…

---

## [Q: Are there ways to control the response file item delimiter?](https://discourse.cmake.org/t/q-are-there-ways-to-control-the-response-file-item-delimiter/6207)

<div class="topic-metadata">

**Author:** [@objectx](https://discourse.cmake.org/u/objectx)\
**Replies:** 3\
**Last updated:** [August 6, 2022, 10:48pm UTC](https://discourse.cmake.org/t/q-are-there-ways-to-control-the-response-file-item-delimiter/6207 "2022-08-06T22:48:25Z")

</div>

The linker used in my current development environment (running on Windows) does not accept the newline as an argument delimiter. This triggers linker error (under -G Ninja). Are there ways to control it? Source/cmNinja…

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

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