# Usage

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

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

**Page:** 55

---

## [Issue about armClang compiler](https://discourse.cmake.org/t/issue-about-armclang-compiler/6735)

<div class="topic-metadata">

**Author:** [@ddddxie](https://discourse.cmake.org/u/ddddxie)\
**Replies:** 3\
**Last updated:** [October 28, 2022, 6:28am UTC](https://discourse.cmake.org/t/issue-about-armclang-compiler/6735 "2022-10-28T06:28:04Z")

</div>

HI, Experts, I am using TI armClang compiler the version is ti-cgt-armllvm\_1.3.0.LTS. I am facing a issue that the linker report a error that file name or extension is too long. Then I am checking the rules.ninja, I fo…

---

## [running CMAKE\_TRY\_COMPILE shows error armv7 is deprecated](https://discourse.cmake.org/t/running-cmake-try-compile-shows-error-armv7-is-deprecated/6746)

<div class="topic-metadata">

**Author:** [@sshsu](https://discourse.cmake.org/u/sshsu)\
**Replies:** 0\
**Last updated:** [October 28, 2022, 1:47am UTC](https://discourse.cmake.org/t/running-cmake-try-compile-shows-error-armv7-is-deprecated/6746 "2022-10-28T01:47:10Z")

</div>

I am trying to use cmake to generate xcode project but fail and get error as below, it is said that the cmake project CMAKE\_TRY\_COMPILE tries to use armv7 architecture but armv7 is deprecated since xcode14 doesn’t suppor…

---

## [How do I export (or import) just the Release version of an exeutable](https://discourse.cmake.org/t/how-do-i-export-or-import-just-the-release-version-of-an-exeutable/6707)

<div class="topic-metadata">

**Author:** [@JRR](https://discourse.cmake.org/u/JRR)\
**Replies:** 7\
**Last updated:** [October 28, 2022, 12:34am UTC](https://discourse.cmake.org/t/how-do-i-export-or-import-just-the-release-version-of-an-exeutable/6707 "2022-10-28T00:34:35Z")

</div>

I’ve followed the instructions for creating relocatable export packages as defined in the documenation at this location \[https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html#exporting-targets\] We hav…

---

## [What is the different between target\_sources and target\_include\_directory when I add a header file to a target](https://discourse.cmake.org/t/what-is-the-different-between-target-sources-and-target-include-directory-when-i-add-a-header-file-to-a-target/6727)

<div class="topic-metadata">

**Author:** [@dglz.hyj](https://discourse.cmake.org/u/dglz.hyj)\
**Replies:** 3\
**Last updated:** [October 27, 2022, 11:48pm UTC](https://discourse.cmake.org/t/what-is-the-different-between-target-sources-and-target-include-directory-when-i-add-a-header-file-to-a-target/6727 "2022-10-27T23:48:23Z")

</div>

I watched some videos about modern cmake. for example ######################## 1 add\_library(timer SHARED) target\_source(timer PRIVATE src/timer.cpp PUBLIC include/timer.h) ############################ ##########…

---

## [Install Target only if Shared Library](https://discourse.cmake.org/t/install-target-only-if-shared-library/6728)

<div class="topic-metadata">

**Author:** [@developer](https://discourse.cmake.org/u/developer)\
**Replies:** 1\
**Last updated:** [October 26, 2022, 5:46pm UTC](https://discourse.cmake.org/t/install-target-only-if-shared-library/6728 "2022-10-26T17:46:56Z")

</div>

I’m learning about how to install targets, and I’ve stumbled across the following situation. I understand that if I have a library Foo, you can specify a variety of paths for the install. install(Targets Foo LIBRARY …

---

## [How do I force an EXE import to always use RELEASE?](https://discourse.cmake.org/t/how-do-i-force-an-exe-import-to-always-use-release/6723)

<div class="topic-metadata">

**Author:** [@JRR](https://discourse.cmake.org/u/JRR)\
**Replies:** 1\
**Last updated:** [October 25, 2022, 9:56pm UTC](https://discourse.cmake.org/t/how-do-i-force-an-exe-import-to-always-use-release/6723 "2022-10-25T21:56:04Z")

</div>

We’ve done library export/imports for awhile and they’re great! We follow the documentation from the Importing and Exporting Guide and it all works beautifully. We are now delving into executable exports/imports. It se…

---

## [cpack/rpm error when generating debuginfo with user specified](https://discourse.cmake.org/t/cpack-rpm-error-when-generating-debuginfo-with-user-specified/6719)

<div class="topic-metadata">

**Author:** [@bmagistro](https://discourse.cmake.org/u/bmagistro)\
**Replies:** 0\
**Last updated:** [October 25, 2022, 5:23pm UTC](https://discourse.cmake.org/t/cpack-rpm-error-when-generating-debuginfo-with-user-specified/6719 "2022-10-25T17:23:13Z")

</div>

I don’t have the full error message readily available but not sure it is necessary. To recreate this, specify a default user + group for the files and generate debuginfo. The %files block for the main rpm will have a d…

---

## [Error running cmake](https://discourse.cmake.org/t/error-running-cmake/6709)

<div class="topic-metadata">

**Author:** [@Heiner\_Rodriguez](https://discourse.cmake.org/u/Heiner_Rodriguez)\
**Replies:** 2\
**Last updated:** [October 25, 2022, 4:18pm UTC](https://discourse.cmake.org/t/error-running-cmake/6709 "2022-10-25T16:18:13Z")

</div>

Hello, good afternoon. I’m installing janus on a centos 7 server, I run the following commands: wget https://cmake.org/files/v3.6/cmake-3.6.2.tar.gz tar -zxvf cmake-3.6.2.tar.gz cd cmake-3.6.2 ./bootstrap --prefix=/…

---

## [CMAKE issues in creation of DLIB for GPU in Windows](https://discourse.cmake.org/t/cmake-issues-in-creation-of-dlib-for-gpu-in-windows/6260)

<div class="topic-metadata">

**Author:** [@Bill\_Strum](https://discourse.cmake.org/u/Bill_Strum)\
**Replies:** 5\
**Last updated:** [October 25, 2022, 4:11am UTC](https://discourse.cmake.org/t/cmake-issues-in-creation-of-dlib-for-gpu-in-windows/6260 "2022-10-25T04:11:40Z")

</div>

I am trying to install DLIB with GPU support for windows and have been running into errors I can not resolve. I have visual studio 2022 installed with C++,C++ CMAKE TOOLS for Windows etc. all installed Below is CMAKE c…

---

## [include vs find\_package rules of thumb](https://discourse.cmake.org/t/include-vs-find-package-rules-of-thumb/6713)

<div class="topic-metadata">

**Author:** [@Rich\_von\_Lehe](https://discourse.cmake.org/u/Rich_von_Lehe)\
**Replies:** 1\
**Last updated:** [October 25, 2022, 12:45am UTC](https://discourse.cmake.org/t/include-vs-find-package-rules-of-thumb/6713 "2022-10-25T00:45:00Z")

</div>

Looking for what other people use as rules of thumb for using include() vs find\_package(). I was reviewing a PR and a coworker wanted to use find\_package() to pull in a CMake module that defined some helpful functions. …

---

## [Getting All Library Dependencies](https://discourse.cmake.org/t/getting-all-library-dependencies/6168)

<div class="topic-metadata">

**Author:** [@Drue\_Peters](https://discourse.cmake.org/u/Drue_Peters)\
**Replies:** 7\
**Last updated:** [October 25, 2022, 12:40am UTC](https://discourse.cmake.org/t/getting-all-library-dependencies/6168 "2022-10-25T00:40:46Z")

</div>

Hey, I’ll try my best to describe my issue. I’m in a situation where our current build system uses a script that generates C++ code. I have this process completed in CMake. But the difficult part, is that the code gene…

---

## [CentOS7 and OpenSSL 1.1](https://discourse.cmake.org/t/centos7-and-openssl-1-1/6229)

<div class="topic-metadata">

**Author:** [@jwm](https://discourse.cmake.org/u/jwm)\
**Replies:** 6\
**Last updated:** [October 23, 2022, 5:19pm UTC](https://discourse.cmake.org/t/centos7-and-openssl-1-1/6229 "2022-10-23T17:19:46Z")

</div>

Similar to QNX7.0 and openssl 1.1.1, on CentOS 7 (at least) OpenSSL 1.1 is installed as openssl11. On CMake 3.23.2, this causes the pkg\_check\_modules(\_OPENSSL QUIET openssl) in FindOpenSSL.cmake to fail. Has this by ch…

---

## [ament\_cmake not found when using Ninja generator and Android toolchain on Windows](https://discourse.cmake.org/t/ament-cmake-not-found-when-using-ninja-generator-and-android-toolchain-on-windows/6703)

<div class="topic-metadata">

**Author:** [@mpconte](https://discourse.cmake.org/u/mpconte)\
**Replies:** 1\
**Last updated:** [October 21, 2022, 10:11pm UTC](https://discourse.cmake.org/t/ament-cmake-not-found-when-using-ninja-generator-and-android-toolchain-on-windows/6703 "2022-10-21T22:11:56Z")

</div>

When attempting to build a ros2 cpp application that include the following the CMakeLists.txt file (generated by ros2 sample script ros2 pkg create --build-type ament\_cmake \<package\_name\>): cmake\_minimum\_required(VERSIO…

---

## [/showIncludes option added automatically](https://discourse.cmake.org/t/showincludes-option-added-automatically/6706)

<div class="topic-metadata">

**Author:** [@serge](https://discourse.cmake.org/u/serge)\
**Replies:** 2\
**Last updated:** [October 21, 2022, 3:31pm UTC](https://discourse.cmake.org/t/showincludes-option-added-automatically/6706 "2022-10-21T15:31:53Z")

</div>

Hi everyone, I am using cmake 3.23 with Ninja generator on Windows. clang-cl compiler is in use. Somehow I can see in the build log that /showIncludes has been added project wide as a compilation flag and not by our c…

---

## [Concurrent running FetchContent\_MakeAvailable() with shared SOURCE\_DIR](https://discourse.cmake.org/t/concurrent-running-fetchcontent-makeavailable-with-shared-source-dir/5726)

<div class="topic-metadata">

**Author:** [@gerhardol](https://discourse.cmake.org/u/gerhardol)\
**Replies:** 7\
**Last updated:** [October 21, 2022, 2:50pm UTC](https://discourse.cmake.org/t/concurrent-running-fetchcontent-makeavailable-with-shared-source-dir/5726 "2022-10-21T14:50:57Z")

</div>

We fetch some large SDKs (several GB), to speedup builds and avoid full disks the SDKs should be put on a shared and persistent path. The code is not too complicated and uses flock to make sure that only one version at a…

---

## [How to exclude "Unspecified" components from CPack archive generator?](https://discourse.cmake.org/t/how-to-exclude-unspecified-components-from-cpack-archive-generator/6673)

<div class="topic-metadata">

**Author:** [@mojca](https://discourse.cmake.org/u/mojca)\
**Replies:** 8\
**Last updated:** [October 20, 2022, 5:46pm UTC](https://discourse.cmake.org/t/how-to-exclude-unspecified-components-from-cpack-archive-generator/6673 "2022-10-20T17:46:07Z")

</div>

I would like to exclude nearly all the files installed by external projects (that are otherwise needed as dependencies) when installing a project and when creating the packages, but I cannot quite figure out how to do th…

---

## [CPackDeb : is it possible to generate .changes and .buildinfo files ?](https://discourse.cmake.org/t/cpackdeb-is-it-possible-to-generate-changes-and-buildinfo-files/6701)

<div class="topic-metadata">

**Author:** [@Ubiquite](https://discourse.cmake.org/u/Ubiquite)\
**Replies:** 1\
**Last updated:** [October 20, 2022, 5:26pm UTC](https://discourse.cmake.org/t/cpackdeb-is-it-possible-to-generate-changes-and-buildinfo-files/6701 "2022-10-20T17:26:27Z")

</div>

Hi Is it possible to generate .changes and .buildinfo files while using CPackDeb ? With dpkg-genbuildinfo and dpkg-genchanges ? This files seems necessary to publish the .deb for reprepo. Regards

---

## [only g++/linux - undefined reference to symbol 'dlclose@@GLIBC\_2.2.5'](https://discourse.cmake.org/t/only-g-linux-undefined-reference-to-symbol-dlclose-glibc-2-2-5/6683)

<div class="topic-metadata">

**Author:** [@kmilo9999](https://discourse.cmake.org/u/kmilo9999)\
**Replies:** 4\
**Last updated:** [October 19, 2022, 7:50pm UTC](https://discourse.cmake.org/t/only-g-linux-undefined-reference-to-symbol-dlclose-glibc-2-2-5/6683 "2022-10-19T19:50:29Z")

</div>

Hello, I know this might be a non-cmake related issue, but I cant figure out the problem. Giving it a shot here. I build my c++ application using CMake on different platforms. It builds/compiles on windows ( visual stu…

---

## [Is \`CMAKE\_ARGS\` ignored if \`CONFIGURE\_COMMANDS\` is used?](https://discourse.cmake.org/t/is-cmake-args-ignored-if-configure-commands-is-used/6694)

<div class="topic-metadata">

**Author:** [@dundargoc](https://discourse.cmake.org/u/dundargoc)\
**Replies:** 1\
**Last updated:** [October 19, 2022, 11:39am UTC](https://discourse.cmake.org/t/is-cmake-args-ignored-if-configure-commands-is-used/6694 "2022-10-19T11:39:38Z")

</div>

Long story short, I’d like to use both CONFIGURE\_COMMAND and CMAKE\_ARGS in an ExternalProject\_Add. When I move -DCMAKE\_INSTALL\_PREFIX=${DEPS\_INSTALL\_DIR} from CONFIGURE\_COMMAND to CMAKE\_ARGS my build stops working and it…

---

## [Default compile definition: how to get rid of those](https://discourse.cmake.org/t/default-compile-definition-how-to-get-rid-of-those/3744)

<div class="topic-metadata">

**Author:** [@serge](https://discourse.cmake.org/u/serge)\
**Replies:** 9\
**Last updated:** [October 19, 2022, 5:55am UTC](https://discourse.cmake.org/t/default-compile-definition-how-to-get-rid-of-those/3744 "2022-10-19T05:55:17Z")

</div>

Hello guys, I am using cmake generator ninja to build my project. cmake / ninja adds a compile definition: -DNDEBUG automatically and it breaks the build. What is the method to get rid of this default specifically and…

---

## [How can I add '-cpu=v850' with GreenHills compiler](https://discourse.cmake.org/t/how-can-i-add-cpu-v850-with-greenhills-compiler/6692)

<div class="topic-metadata">

**Author:** [@JasonLuo](https://discourse.cmake.org/u/JasonLuo)\
**Replies:** 0\
**Last updated:** [October 19, 2022, 10:11am UTC](https://discourse.cmake.org/t/how-can-i-add-cpu-v850-with-greenhills-compiler/6692 "2022-10-19T10:11:40Z")

</div>

Hello, I want to creat top-gpj like this: #!gbuild primaryTarget=v800\_standalone.tgt #component top\_level\_project \[Project\] -bsp generic -cpu=v850 -G -object\_dir=objs :sourceDir=. src\_hello\_cc\\hello\_cc.gpj \[Progr…

---

## [Strictly appending to CMAKE\_\<LANG\>\_FLAGS](https://discourse.cmake.org/t/strictly-appending-to-cmake-lang-flags/6478)

<div class="topic-metadata">

**Author:** [@mrjoel](https://discourse.cmake.org/u/mrjoel)\
**Replies:** 9\
**Last updated:** [October 18, 2022, 6:11pm UTC](https://discourse.cmake.org/t/strictly-appending-to-cmake-lang-flags/6478 "2022-10-18T18:11:29Z")

</div>

I haven’t been able to identify any mechanism to specify strictly additional compiler flags from a commandline cmake execution. I usually just use -D CMAKE\_CXX\_FLAGS=foo which in practice works in most cases. However, I …

---

## [Problem with armclang environment](https://discourse.cmake.org/t/problem-with-armclang-environment/4922)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 1\
**Last updated:** [October 18, 2022, 1:31pm UTC](https://discourse.cmake.org/t/problem-with-armclang-environment/4922 "2022-10-18T13:31:32Z")

</div>

I have a proven toolchain and CMakeLists.txt for the ARM Compiler 6 armclang toolchain. I am running on Windows. It works fine when I run cmake from the ARM Dev Studio Command Prompt (which sets appropriate environment v…

---

## [INTERFACE\_INCLUDE\_DIRECTORIES from Imported Target can not be seen in Visual Studio](https://discourse.cmake.org/t/interface-include-directories-from-imported-target-can-not-be-seen-in-visual-studio/6507)

<div class="topic-metadata">

**Author:** [@Pei\_Wang](https://discourse.cmake.org/u/Pei_Wang)\
**Replies:** 2\
**Last updated:** [October 18, 2022, 6:44am UTC](https://discourse.cmake.org/t/interface-include-directories-from-imported-target-can-not-be-seen-in-visual-studio/6507 "2022-10-18T06:44:50Z")

</div>

Consider this cmake scripts: find\_package(Nxx 1.0.0 REQUIRED COMPONENTS Math IO) add\_compile\_definitions(NXX) target\_link\_librariesSolver PRIVATE Nxx::Math) target\_link\_librariesSolver PRIVATE Nxx::IO)…

---

## [CMAKE\_CXX\_STANDARD: cmake 3.16 vs 3.24](https://discourse.cmake.org/t/cmake-cxx-standard-cmake-3-16-vs-3-24/6623)

<div class="topic-metadata">

**Author:** [@malaterre](https://discourse.cmake.org/u/malaterre)\
**Replies:** 7\
**Last updated:** [October 18, 2022, 5:58am UTC](https://discourse.cmake.org/t/cmake-cxx-standard-cmake-3-16-vs-3-24/6623 "2022-10-18T05:58:46Z")

</div>

I am observing a change in behavior in between cmake 3.16.3 and 3.24.2. Basically the following is working as expected in cmake 3.16.3 : cmake\_minimum\_required(VERSION 3.10) project(p) set(CMAKE\_REQUIRED\_FLAGS "-std=c+…

---

## [Anyone using C++ modules with CMake?](https://discourse.cmake.org/t/anyone-using-c-modules-with-cmake/6638)

<div class="topic-metadata">

**Author:** [@RobN](https://discourse.cmake.org/u/RobN)\
**Replies:** 7\
**Last updated:** [October 18, 2022, 4:10am UTC](https://discourse.cmake.org/t/anyone-using-c-modules-with-cmake/6638 "2022-10-18T04:10:09Z")

</div>

I’m using Clang 15 and it looks like it has a fair amount C++ modules support. But what’s the status in CMake. Is it usable? ~ Rob

---

## [Generator expression to evaluate strings given a certain context](https://discourse.cmake.org/t/generator-expression-to-evaluate-strings-given-a-certain-context/6475)

<div class="topic-metadata">

**Author:** [@decimad](https://discourse.cmake.org/u/decimad)\
**Replies:** 1\
**Last updated:** [October 17, 2022, 8:56pm UTC](https://discourse.cmake.org/t/generator-expression-to-evaluate-strings-given-a-certain-context/6475 "2022-10-17T20:56:06Z")

</div>

Hello, I’ve been working on a C project that learns to also use C++ recently. I’ve up to now generated (as in file(GENERATE) a summary file with compilation options of certain targets, which used $\<TARGET\_PROPERTY:xyz,C…

---

## [I got \`unresolved external symbol\` while using \`ExternalProject\_Add\`, how should I solve this?](https://discourse.cmake.org/t/i-got-unresolved-external-symbol-while-using-externalproject-add-how-should-i-solve-this/6469)

<div class="topic-metadata">

**Author:** [@Kiki](https://discourse.cmake.org/u/Kiki)\
**Replies:** 3\
**Last updated:** [October 17, 2022, 8:55pm UTC](https://discourse.cmake.org/t/i-got-unresolved-external-symbol-while-using-externalproject-add-how-should-i-solve-this/6469 "2022-10-17T20:55:06Z")

</div>

Here is my CMakeLists.txt: ExternalProject\_Add( subhook GIT\_REPOSITORY https://github.com/Zeex/subhook.git GIT\_TAG v0.8.2 SOURCE\_DIR "${CMAKE\_CURRENT\_BINARY\_DIR}/subhook-src" BINARY\_DIR "${CMAKE\_…

---

## [Beginner question about sub-directory / library layout?](https://discourse.cmake.org/t/beginner-question-about-sub-directory-library-layout/6428)

<div class="topic-metadata">

**Author:** [@RobN](https://discourse.cmake.org/u/RobN)\
**Replies:** 1\
**Last updated:** [October 17, 2022, 8:53pm UTC](https://discourse.cmake.org/t/beginner-question-about-sub-directory-library-layout/6428 "2022-10-17T20:53:20Z")

</div>

I followed the tutorial steps where it shows linking to a subdirectory/library named “MathFunctions”. The CMakeLists.txt in that subdirectory has: # state that anybody linking to us needs to include the current source d…

---

## [\[MSVC\] How does cmake determine which host architecture to use](https://discourse.cmake.org/t/msvc-how-does-cmake-determine-which-host-architecture-to-use/6647)

<div class="topic-metadata">

**Author:** [@QuellaZhang](https://discourse.cmake.org/u/QuellaZhang)\
**Replies:** 2\
**Last updated:** [October 17, 2022, 2:46pm UTC](https://discourse.cmake.org/t/msvc-how-does-cmake-determine-which-host-architecture-to-use/6647 "2022-10-17T14:46:10Z")

</div>

Hi All, We have a question, why does CMake call x64/x86/cl.exe instead of x86/x86/cl.exe when we have clean cmd set to VS x86\_x86 command prompt and generator set to MSVC? But setting the generator to Ninja it calls x86…

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

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