# Usage

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

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

**Page:** 22

---

## [how to install a header file using cmake](https://discourse.cmake.org/t/how-to-install-a-header-file-using-cmake/11557)

<div class="topic-metadata">

**Author:** [@Jonathan\_Dawsa](https://discourse.cmake.org/u/Jonathan_Dawsa)\
**Replies:** 2\
**Last updated:** [September 15, 2024, 5:55am UTC](https://discourse.cmake.org/t/how-to-install-a-header-file-using-cmake/11557 "2024-09-15T05:55:14Z")

</div>

hello i am learning to use cmake better and i am now trying to learn to install header files in the computer(linux mint os ) using vscode so that i can use it in different projects and i am struggling a little bit the fo…

---

## ["Configure will be re-run and you may have to reset some variables"](https://discourse.cmake.org/t/configure-will-be-re-run-and-you-may-have-to-reset-some-variables/7325)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 4\
**Last updated:** [September 14, 2024, 11:40pm UTC](https://discourse.cmake.org/t/configure-will-be-re-run-and-you-may-have-to-reset-some-variables/7325 "2024-09-14T23:40:51Z")

</div>

Hi. When changing compiler from clang to gcc, I have the following message: You have changed variables that require your cache to be deleted. Configure will be re-run and you may have to reset some variables. The follo…

---

## [Increased count of compilation steps since CMake 3.30.3 update](https://discourse.cmake.org/t/increased-count-of-compilation-steps-since-cmake-3-30-3-update/11683)

<div class="topic-metadata">

**Author:** [@saschasc](https://discourse.cmake.org/u/saschasc)\
**Replies:** 1\
**Last updated:** [September 14, 2024, 2:39pm UTC](https://discourse.cmake.org/t/increased-count-of-compilation-steps-since-cmake-3-30-3-update/11683 "2024-09-14T14:39:57Z")

</div>

I was using CMake 3.26.4 before on several platforms (macOS, Linux, Windows). Since updating to the newest 3.30.3 the total number of steps to compile increased a lot (from 2k to almost 3.5k). The strange thing is that t…

---

## [Understanding documentation](https://discourse.cmake.org/t/understanding-documentation/11679)

<div class="topic-metadata">

**Author:** [@Selviniah](https://discourse.cmake.org/u/Selviniah)\
**Replies:** 1\
**Last updated:** [September 14, 2024, 8:43am UTC](https://discourse.cmake.org/t/understanding-documentation/11679 "2024-09-14T08:43:39Z")

</div>

I am trying to understand how should I read the documentation. My confusion arise in here $\<CONFIG\> generative expression is not properly explained and I should not have any idea how to understand it. In such cases I s…

---

## [trouble with PUBLIC\_HEADER](https://discourse.cmake.org/t/trouble-with-public-header/11665)

<div class="topic-metadata">

**Author:** [@wtholliday](https://discourse.cmake.org/u/wtholliday)\
**Replies:** 0\
**Last updated:** [September 12, 2024, 10:39pm UTC](https://discourse.cmake.org/t/trouble-with-public-header/11665 "2024-09-12T22:39:08Z")

</div>

I’m trying to build an xcframework for iOS and macOS for oneTBB. I’m having trouble getting the generated frameworks to have headers. I tried adding PUBLIC\_HEADER "../include/oneapi/tbb.h" but CMake doesn’t stick the …

---

## [How to compile linear assemble?](https://discourse.cmake.org/t/how-to-compile-linear-assemble/8122)

<div class="topic-metadata">

**Author:** [@Freed-Wu](https://discourse.cmake.org/u/Freed-Wu)\
**Replies:** 4\
**Last updated:** [September 13, 2024, 1:00am UTC](https://discourse.cmake.org/t/how-to-compile-linear-assemble/8122 "2024-09-13T01:00:33Z")

</div>

/usr/share/cmake/Modules/Compiler/TI-ASM.cmake: include(Compiler/TI) \_\_compiler\_ti(ASM) set(CMAKE\_ASM\_SOURCE\_FILE\_EXTENSIONS asm;s;abs) However, TI has a special assemble named linear assemble: $ cl6x --help ... Defa…

---

## [How to resolve the same target name error?](https://discourse.cmake.org/t/how-to-resolve-the-same-target-name-error/11659)

<div class="topic-metadata">

**Author:** [@Chili\_Nouilles\_de\_po](https://discourse.cmake.org/u/Chili_Nouilles_de_po)\
**Replies:** 2\
**Last updated:** [September 12, 2024, 3:44pm UTC](https://discourse.cmake.org/t/how-to-resolve-the-same-target-name-error/11659 "2024-09-12T15:44:18Z")

</div>

I have a cmake project having the structure like what is in the above image. When I run cmake, I got an error suggesting the same target already exits. My questions are how do I reserve both versions of spdlog in the …

---

## [CMake v3.3.0 Configuration and Build File Path issues](https://discourse.cmake.org/t/cmake-v3-3-0-configuration-and-build-file-path-issues/11570)

<div class="topic-metadata">

**Author:** [@Horsefeathers](https://discourse.cmake.org/u/Horsefeathers)\
**Replies:** 7\
**Last updated:** [September 11, 2024, 8:15pm UTC](https://discourse.cmake.org/t/cmake-v3-3-0-configuration-and-build-file-path-issues/11570 "2024-09-11T20:15:52Z")

</div>

Using Debian 6.1.106-3 (2024-08-26) x86\_64 GNU/Linux Using Docker Current version: 4.32.0 (157355) Using VSCode v 1.92.2 Using CMake v3.30 I’m including a copy of the CMake output during configuration and build. \[pr…

---

## [Linking a library created by cmake to my ios app gives me missing signing identifier](https://discourse.cmake.org/t/linking-a-library-created-by-cmake-to-my-ios-app-gives-me-missing-signing-identifier/11636)

<div class="topic-metadata">

**Author:** [@DridriLaBastos](https://discourse.cmake.org/u/DridriLaBastos)\
**Replies:** 0\
**Last updated:** [September 10, 2024, 9:18pm UTC](https://discourse.cmake.org/t/linking-a-library-created-by-cmake-to-my-ios-app-gives-me-missing-signing-identifier/11636 "2024-09-10T21:18:06Z")

</div>

I am creating an application with Flutter that uses a native library that I wrote myself in C++ to perform computationally intensive tasks. The library is compiled via Cmake and the compilation is automatically performed…

---

## [How can I execute CMake custom command with path to all included directories of all dependent libraries?](https://discourse.cmake.org/t/how-can-i-execute-cmake-custom-command-with-path-to-all-included-directories-of-all-dependent-libraries/11627)

<div class="topic-metadata">

**Author:** [@YoniSp](https://discourse.cmake.org/u/YoniSp)\
**Replies:** 0\
**Last updated:** [September 9, 2024, 2:10pm UTC](https://discourse.cmake.org/t/how-can-i-execute-cmake-custom-command-with-path-to-all-included-directories-of-all-dependent-libraries/11627 "2024-09-09T14:10:53Z")

</div>

I am trying to build a CMake function that builds cuda fatbins files with the included path of all dependent libraries. Those Libs are created for ease of use as an interface only. The problem is how to extract the recu…

---

## [How to add dynamically generated headers directory?](https://discourse.cmake.org/t/how-to-add-dynamically-generated-headers-directory/11623)

<div class="topic-metadata">

**Author:** [@arun.mani](https://discourse.cmake.org/u/arun.mani)\
**Replies:** 0\
**Last updated:** [September 9, 2024, 11:59am UTC](https://discourse.cmake.org/t/how-to-add-dynamically-generated-headers-directory/11623 "2024-09-09T11:59:43Z")

</div>

Hii all. I have a C project. This project has depends on a library named bar. bar is built using a custom command. However the issue is, the headers of the bar library is also available only after bar is built. In such …

---

## [How to trace through FetchContent code?](https://discourse.cmake.org/t/how-to-trace-through-fetchcontent-code/11621)

<div class="topic-metadata">

**Author:** [@tonh](https://discourse.cmake.org/u/tonh)\
**Replies:** 2\
**Last updated:** [September 9, 2024, 9:49am UTC](https://discourse.cmake.org/t/how-to-trace-through-fetchcontent-code/11621 "2024-09-09T09:49:40Z")

</div>

I am debugging an issue where FetchContent instead of checking out a requested branch leaves a repository in a detached HEAD state (where HEAD is pointing to the requested branch though). To debug this, I am looking at …

---

## [How to find FindPkgConfig.cmake on Windows](https://discourse.cmake.org/t/how-to-find-findpkgconfig-cmake-on-windows/11615)

<div class="topic-metadata">

**Author:** [@Rich\_Eakin](https://discourse.cmake.org/u/Rich_Eakin)\
**Replies:** 0\
**Last updated:** [September 8, 2024, 9:54pm UTC](https://discourse.cmake.org/t/how-to-find-findpkgconfig-cmake-on-windows/11615 "2024-09-08T21:54:11Z")

</div>

Hi, I’m trying to get a CMakeLists.txt file that works on Linux fine working on Windows using the MSVC toolchain and standalone CMake. My current issue is that FindPkgConfig.cmake can’t be found although I see it exists…

---

## [Cuda nvJitLink error because fatbin does not contains the correct function.](https://discourse.cmake.org/t/cuda-nvjitlink-error-because-fatbin-does-not-contains-the-correct-function/11612)

<div class="topic-metadata">

**Author:** [@YoniSp](https://discourse.cmake.org/u/YoniSp)\
**Replies:** 0\
**Last updated:** [September 8, 2024, 5:18pm UTC](https://discourse.cmake.org/t/cuda-nvjitlink-error-because-fatbin-does-not-contains-the-correct-function/11612 "2024-09-08T17:18:42Z")

</div>

Hi I am trying to compile my application with fatbin flag is active: set\_property(TARGET offline PROPERTY CUDA\_FATBIN\_COMPILATION ON) The error code is: error : Undefined reference to '\_Z7computefff' in 'ltoPtx' er…

---

## [Call CMake Cygwin with windows style path (C:\\)](https://discourse.cmake.org/t/call-cmake-cygwin-with-windows-style-path-c/11599)

<div class="topic-metadata">

**Author:** [@kuch3n](https://discourse.cmake.org/u/kuch3n)\
**Replies:** 3\
**Last updated:** [September 6, 2024, 2:07pm UTC](https://discourse.cmake.org/t/call-cmake-cygwin-with-windows-style-path-c/11599 "2024-09-06T14:07:17Z")

</div>

If cygwins cmake is called with windows style paths and the build directory is missing, cmake will create two build directories from -B "C:\\\\dir1\\\\dir2\\\\project\\\\build": C probably a relative path from the root of th…

---

## [trying to work out how to use XercesC as Fetched Content](https://discourse.cmake.org/t/trying-to-work-out-how-to-use-xercesc-as-fetched-content/11592)

<div class="topic-metadata">

**Author:** [@push-22](https://discourse.cmake.org/u/push-22)\
**Replies:** 8\
**Last updated:** [September 6, 2024, 9:45am UTC](https://discourse.cmake.org/t/trying-to-work-out-how-to-use-xercesc-as-fetched-content/11592 "2024-09-06T09:45:32Z")

</div>

We are trying the out various ways of including external libraries we have in a cpp project and have hit a problem using fetchcontent to download/configure xerces-c. Everything seems to download and build ok, but we can’…

---

## [Specify search path for find\_package](https://discourse.cmake.org/t/specify-search-path-for-find-package/11580)

<div class="topic-metadata">

**Author:** [@KSergeyP](https://discourse.cmake.org/u/KSergeyP)\
**Replies:** 1\
**Last updated:** [September 3, 2024, 5:55pm UTC](https://discourse.cmake.org/t/specify-search-path-for-find-package/11580 "2024-09-03T17:55:50Z")

</div>

How to specify search path for find\_package? I can add it to CMAKE\_MODULE\_PATH but if it is not there then the search continues in PATH - it is necessary that it searches only in the specified path. You can check the v…

---

## [project version vs target version](https://discourse.cmake.org/t/project-version-vs-target-version/11576)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 0\
**Last updated:** [September 3, 2024, 1:31pm UTC](https://discourse.cmake.org/t/project-version-vs-target-version/11576 "2024-09-03T13:31:12Z")

</div>

Hi, So far I overlooked version configuration files in my installation procedure. Wanting to add that, I realize that write\_basic\_package\_version\_file is taking the target version but the project has also a VERSION opti…

---

## [Should NO\_SET\_AND\_CHECK\_MACRO and NO\_CHECK\_REQUIRED\_COMPONENTS\_MACRO be used with configure\_package\_config\_file?](https://discourse.cmake.org/t/should-no-set-and-check-macro-and-no-check-required-components-macro-be-used-with-configure-package-config-file/11575)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 0\
**Last updated:** [September 3, 2024, 12:43pm UTC](https://discourse.cmake.org/t/should-no-set-and-check-macro-and-no-check-required-components-macro-be-used-with-configure-package-config-file/11575 "2024-09-03T12:43:16Z")

</div>

CMake tutorials uses these options but I can’t find documented motivation to do so. It seems to me that additional checks should be for the best. What is the recommended best practice and why? Regards A.

---

## [cmake Configuring problem visual studio](https://discourse.cmake.org/t/cmake-configuring-problem-visual-studio/11572)

<div class="topic-metadata">

**Author:** [@meme\_alemadi](https://discourse.cmake.org/u/meme_alemadi)\
**Replies:** 1\
**Last updated:** [September 3, 2024, 6:25am UTC](https://discourse.cmake.org/t/cmake-configuring-problem-visual-studio/11572 "2024-09-03T06:25:46Z")

</div>

i am tiring to make my library on Cmake inside of CmakeLists.txt # CMakeList.txt : CMake project for Engine, include source and define # project specific logic here. # cmake\_minimum\_required (VERSION 3.8) # Enable Hot…

---

## [CPack External generator runs CPACK\_EXTERNAL\_PACKAGE\_SCRIPT before creating JSON metadata](https://discourse.cmake.org/t/cpack-external-generator-runs-cpack-external-package-script-before-creating-json-metadata/1773)

<div class="topic-metadata">

**Author:** [@cheesy\_falafel](https://discourse.cmake.org/u/cheesy_falafel)\
**Replies:** 5\
**Last updated:** [August 30, 2024, 8:21pm UTC](https://discourse.cmake.org/t/cpack-external-generator-runs-cpack-external-package-script-before-creating-json-metadata/1773 "2024-08-30T20:21:54Z")

</div>

Hi. I’m having some trouble understanding how the CPack external generator is supposed to work. I’m running CPack via the CMake “package” target. In CMake I’m setting CPACK\_EXTERNAL\_PACKAGE\_SCRIPT to point to a CMake sc…

---

## [Creating an RPM sets RUNPATH to build directory](https://discourse.cmake.org/t/creating-an-rpm-sets-runpath-to-build-directory/11543)

<div class="topic-metadata">

**Author:** [@JanWielemaker](https://discourse.cmake.org/u/JanWielemaker)\
**Replies:** 2\
**Last updated:** [August 30, 2024, 7:53am UTC](https://discourse.cmake.org/t/creating-an-rpm-sets-runpath-to-build-directory/11543 "2024-08-30T07:53:34Z")

</div>

I have a project that by default installs into a self-contained directory, where it also keeps its project specific .so files. Running in the build dir works fine, as well as installing it. However, if I use CPack …

---

## [No SOURCES given to target: Eversite](https://discourse.cmake.org/t/no-sources-given-to-target-eversite/11537)

<div class="topic-metadata">

**Author:** [@wiktor\_wolos](https://discourse.cmake.org/u/wiktor_wolos)\
**Replies:** 1\
**Last updated:** [August 27, 2024, 6:47am UTC](https://discourse.cmake.org/t/no-sources-given-to-target-eversite/11537 "2024-08-27T06:47:35Z")

</div>

Hi, i have this file: cmake\_minimum\_required(VERSION 3.0.0) project(Eversite VERSION 0.1.0) cmake\_policy(SET CMP0072 NEW) find\_package(OpenGL REQUIRED) add\_executable(Eversite src/main.cpp …

---

## [Statically link libc while keeping executable dynamic?](https://discourse.cmake.org/t/statically-link-libc-while-keeping-executable-dynamic/11525)

<div class="topic-metadata">

**Author:** [@mechakotik](https://discourse.cmake.org/u/mechakotik)\
**Replies:** 3\
**Last updated:** [August 25, 2024, 10:26am UTC](https://discourse.cmake.org/t/statically-link-libc-while-keeping-executable-dynamic/11525 "2024-08-25T10:26:37Z")

</div>

I need this because my game uses SDL2 which needs dlopen, so completely static executable won’t work. Tried to do this with following: target\_link\_options(game PRIVATE -static-libgcc -static-libstdc++) target\_link\_libra…

---

## [CPack empty archive with absolute install DESTINATION path](https://discourse.cmake.org/t/cpack-empty-archive-with-absolute-install-destination-path/11503)

<div class="topic-metadata">

**Author:** [@smith\_dave\_k](https://discourse.cmake.org/u/smith_dave_k)\
**Replies:** 3\
**Last updated:** [August 24, 2024, 5:32am UTC](https://discourse.cmake.org/t/cpack-empty-archive-with-absolute-install-destination-path/11503 "2024-08-24T05:32:46Z")

</div>

CMake install(TARGETS) allows an absolute path, but then CPack produces an empty archive. Is this intended behavior? Example CMakeLists.txt: cmake\_minimum\_required(VERSION 3.30) project(EmptyArchive) add\_executable(mai…

---

## [\-Wall with Visual Studio + Clang toolchain results in way too many warnings](https://discourse.cmake.org/t/wall-with-visual-studio-clang-toolchain-results-in-way-too-many-warnings/7927)

<div class="topic-metadata">

**Author:** [@fry](https://discourse.cmake.org/u/fry)\
**Replies:** 13\
**Last updated:** [August 23, 2024, 5:13am UTC](https://discourse.cmake.org/t/wall-with-visual-studio-clang-toolchain-results-in-way-too-many-warnings/7927 "2024-08-23T05:13:02Z")

</div>

I have a cross platform project (Windows/macOS) that uses Clang for compilation. On macOS it is native. On Windows I use the Visual Studio Build Tools + Clang toolchain. I was able to boil down the issue to the followin…

---

## [New warning arrives in version 3.30.2: project() should be called prior to this enable\_language()](https://discourse.cmake.org/t/new-warning-arrives-in-version-3-30-2-project-should-be-called-prior-to-this-enable-language/11495)

<div class="topic-metadata">

**Author:** [@gino-ashling](https://discourse.cmake.org/u/gino-ashling)\
**Replies:** 3\
**Last updated:** [August 22, 2024, 8:09am UTC](https://discourse.cmake.org/t/new-warning-arrives-in-version-3-30-2-project-should-be-called-prior-to-this-enable-language/11495 "2024-08-22T08:09:15Z")

</div>

I understood that enable\_language() must not be called before the first call to \[project()\], and everything is okay if we follow this. Since the end-user shares the sample, we want to retain their flow and scripts. The …

---

## [Cross-compile for iOS and POSIX platforms](https://discourse.cmake.org/t/cross-compile-for-ios-and-posix-platforms/11491)

<div class="topic-metadata">

**Author:** [@Viktor\_Nagy](https://discourse.cmake.org/u/Viktor_Nagy)\
**Replies:** 0\
**Last updated:** [August 20, 2024, 5:38pm UTC](https://discourse.cmake.org/t/cross-compile-for-ios-and-posix-platforms/11491 "2024-08-20T17:38:21Z")

</div>

Hello everyone! I am about to build a simple 2 file test c++ library and than use it as a Cocoa Pod. The library does some basic logging. I am struggling to find the right resources to what and how should I approach th…

---

## ["unrecognized argument to ‘-flto=’ option" error](https://discourse.cmake.org/t/unrecognized-argument-to-flto-option-error/11480)

<div class="topic-metadata">

**Author:** [@syglon](https://discourse.cmake.org/u/syglon)\
**Replies:** 0\
**Last updated:** [August 18, 2024, 5:00pm UTC](https://discourse.cmake.org/t/unrecognized-argument-to-flto-option-error/11480 "2024-08-18T17:00:49Z")

</div>

I am currently trying to install a project on my Linux machine. My CMake version is 3.22.1. When I type ‘make’ command I am getting this error: unrecognized argument to ‘-flto=’ option: ‘auto -ffat-lto-objects -flto=aut…

---

## [set\_directory\_properties can't set subdirectory property](https://discourse.cmake.org/t/set-directory-properties-cant-set-subdirectory-property/11474)

<div class="topic-metadata">

**Author:** [@qiang\_huang](https://discourse.cmake.org/u/qiang_huang)\
**Replies:** 5\
**Last updated:** [August 18, 2024, 2:32pm UTC](https://discourse.cmake.org/t/set-directory-properties-cant-set-subdirectory-property/11474 "2024-08-18T14:32:27Z")

</div>

The CMake official documentation says ： set\_directory\_properties Set properties of the current directory and subdirectories. set\_directory\_properties(PROPERTIES \[ \] …) Sets properties of the current directory and…

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

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