# Usage

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

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

**Page:** 13

---

## [Help with "Generate Debug Symbols" - build setting in Xcode project generated by CMake](https://discourse.cmake.org/t/help-with-generate-debug-symbols-build-setting-in-xcode-project-generated-by-cmake/11141)

<div class="topic-metadata">

**Author:** [@johnwick](https://discourse.cmake.org/u/johnwick)\
**Replies:** 1\
**Last updated:** [April 15, 2025, 1:14pm UTC](https://discourse.cmake.org/t/help-with-generate-debug-symbols-build-setting-in-xcode-project-generated-by-cmake/11141 "2025-04-15T13:14:40Z")

</div>

I’m trying to generate Xcode project file of some libraries with CMake. I want to generate dSYM file in all build config type. I set values in all my CMakelists.txt as below: set(CMAKE\_CXX\_FLAGS "${CMAKE\_CXX\_FLAGS}…

---

## [CMake compiler autodetection does not work for emscripten when generator is set to Visual Studio](https://discourse.cmake.org/t/cmake-compiler-autodetection-does-not-work-for-emscripten-when-generator-is-set-to-visual-studio/13933)

<div class="topic-metadata">

**Author:** [@chasun](https://discourse.cmake.org/u/chasun)\
**Replies:** 0\
**Last updated:** [April 14, 2025, 11:30pm UTC](https://discourse.cmake.org/t/cmake-compiler-autodetection-does-not-work-for-emscripten-when-generator-is-set-to-visual-studio/13933 "2025-04-14T23:30:54Z")

</div>

Actually I don’t know if it is a problem of cmake or emscripten. emscripten is a toolchain that compiles C/C++ code to webassembly so that they can be run in web browsers. Here is the toolchain cmake file that we need…

---

## [Preset macro expansion for binaryDir](https://discourse.cmake.org/t/preset-macro-expansion-for-binarydir/3650)

<div class="topic-metadata">

**Author:** [@KUGA2](https://discourse.cmake.org/u/KUGA2)\
**Replies:** 8\
**Last updated:** [April 12, 2025, 8:49pm UTC](https://discourse.cmake.org/t/preset-macro-expansion-for-binarydir/3650 "2025-04-12T20:49:05Z")

</div>

Please add this functionality. It is useful for deduplication of config when specifying cache or environment variables for extra tools like code coverage (Bullseye coverage COVFILE) or static code analysis (SonarQube wra…

---

## [workflow usage](https://discourse.cmake.org/t/workflow-usage/8288)

<div class="topic-metadata">

**Author:** [@phread](https://discourse.cmake.org/u/phread)\
**Replies:** 9\
**Last updated:** [April 11, 2025, 9:52pm UTC](https://discourse.cmake.org/t/workflow-usage/8288 "2025-04-11T21:52:07Z")

</div>

I am wondering what the thinking is behind options associated with --preset . It appears that -S is allowed for configuration presets but not build and workflow presets. Why is -S not allowed? Secondary Topic: Why is…

---

## [How to use oneAPI Fortran ifx on WIndows Visual Studio generator?](https://discourse.cmake.org/t/how-to-use-oneapi-fortran-ifx-on-windows-visual-studio-generator/10370)

<div class="topic-metadata">

**Author:** [@scivision](https://discourse.cmake.org/u/scivision)\
**Replies:** 5\
**Last updated:** [April 11, 2025, 4:42pm UTC](https://discourse.cmake.org/t/how-to-use-oneapi-fortran-ifx-on-windows-visual-studio-generator/10370 "2025-04-11T16:42:49Z")

</div>

CMake 3.29 is to have enabled oneAPI ifx with Visual Studio generator on Windows. I use oneAPI Fortran on Windows all the time with Ninja successfully, but have not figured out how to do so with Visual Studio generator. …

---

## [Cmake Cannot Find my Fortran Compiler](https://discourse.cmake.org/t/cmake-cannot-find-my-fortran-compiler/13902)

<div class="topic-metadata">

**Author:** [@rymanjc](https://discourse.cmake.org/u/rymanjc)\
**Replies:** 4\
**Last updated:** [April 10, 2025, 11:08pm UTC](https://discourse.cmake.org/t/cmake-cannot-find-my-fortran-compiler/13902 "2025-04-10T23:08:34Z")

</div>

I am trying to compile the NJOY 2016 program from Los Alamos National Laboratory on Windows Professional v10. It comes with its own CMakeLists.txt and searches for the Fortran compiler because it is designed to run on a …

---

## [CMAKE\_SHARED\_LINKER\_FLAGS and "-Wl,..." in CMake 4.0.0](https://discourse.cmake.org/t/cmake-shared-linker-flags-and-wl-in-cmake-4-0-0/13905)

<div class="topic-metadata">

**Author:** [@johan556](https://discourse.cmake.org/u/johan556)\
**Replies:** 3\
**Last updated:** [April 10, 2025, 6:38pm UTC](https://discourse.cmake.org/t/cmake-shared-linker-flags-and-wl-in-cmake-4-0-0/13905 "2025-04-10T18:38:01Z")

</div>

I have recently tried CMake 4.0.0 on my source code. We have a setting like this: set(CMAKE\_SHARED\_LINKER\_FLAGS "${CMAKE\_SHARED\_LINKER\_FLAGS} -Wl,-rpath=\\\\\\$ORIGIN,-rpath=\\\\\\$ORIGIN/../../common/bin") With CMake …

---

## [Add CMakeLists.txt that only uses add\_subdirectory() to Visual Studio solution](https://discourse.cmake.org/t/add-cmakelists-txt-that-only-uses-add-subdirectory-to-visual-studio-solution/13903)

<div class="topic-metadata">

**Author:** [@Andreas](https://discourse.cmake.org/u/Andreas)\
**Replies:** 0\
**Last updated:** [April 9, 2025, 9:30am UTC](https://discourse.cmake.org/t/add-cmakelists-txt-that-only-uses-add-subdirectory-to-visual-studio-solution/13903 "2025-04-09T09:30:15Z")

</div>

We have the following structure /libs/CMakeLists.txt /libs/lib1/CMakeLists.txt /libs/lib1/src/... /libs/lib2/CMakeLists.txt /libs/lib2/src/... In /libs/CMakeLists.txt we only include other CMakeLists.txt files: add\_su…

---

## [How to not apply compile setting for my own code onto dependencies?](https://discourse.cmake.org/t/how-to-not-apply-compile-setting-for-my-own-code-onto-dependencies/13888)

<div class="topic-metadata">

**Author:** [@fabian\_schutze](https://discourse.cmake.org/u/fabian_schutze)\
**Replies:** 5\
**Last updated:** [April 7, 2025, 11:22am UTC](https://discourse.cmake.org/t/how-to-not-apply-compile-setting-for-my-own-code-onto-dependencies/13888 "2025-04-07T11:22:39Z")

</div>

How can I apply the target compile options only to the code I’ve written and not to dependencies? I depend on a large project (tensorflow) and its code doesn’t compile with options such -Wall -Werror. I want the code I’…

---

## [Is it possible to bypass the compile/link phase in toolchain?](https://discourse.cmake.org/t/is-it-possible-to-bypass-the-compile-link-phase-in-toolchain/13885)

<div class="topic-metadata">

**Author:** [@leha-bot](https://discourse.cmake.org/u/leha-bot)\
**Replies:** 0\
**Last updated:** [April 4, 2025, 8:18pm UTC](https://discourse.cmake.org/t/is-it-possible-to-bypass-the-compile-link-phase-in-toolchain/13885 "2025-04-04T20:18:51Z")

</div>

We have an experimental research C compiler which simply builds into final binary without separate compilation into object form. It compiles binary with the command “cesium.exe \<SOURCE\> -o \<OUTPUT\>”

---

## [Policy changes in CMake version 4.0.0](https://discourse.cmake.org/t/policy-changes-in-cmake-version-4-0-0/13883)

<div class="topic-metadata">

**Author:** [@fsimonis](https://discourse.cmake.org/u/fsimonis)\
**Replies:** 3\
**Last updated:** [April 4, 2025, 2:47pm UTC](https://discourse.cmake.org/t/policy-changes-in-cmake-version-4-0-0/13883 "2025-04-04T14:47:23Z")

</div>

Hi, The CMake release 4.0.0 removes the OLD behaviour of the policies CMP0000 to CMP0065. If you run into issues after the upgrade, this may be the reason why. Either directly or indirectly. I had to manually grep the…

---

## [CMake 4.0.0 doesn't seem to look in it's own Modules directory for modules by default](https://discourse.cmake.org/t/cmake-4-0-0-doesnt-seem-to-look-in-its-own-modules-directory-for-modules-by-default/13882)

<div class="topic-metadata">

**Author:** [@SirCodeAlot](https://discourse.cmake.org/u/SirCodeAlot)\
**Replies:** 1\
**Last updated:** [April 4, 2025, 8:32am UTC](https://discourse.cmake.org/t/cmake-4-0-0-doesnt-seem-to-look-in-its-own-modules-directory-for-modules-by-default/13882 "2025-04-04T08:32:44Z")

</div>

I built CMake 4.0.0 like this (on a Rocky Linux 9 host): bootstrap --prefix=/usr/local make -j$(nproc) && make -j$(nproc) install/strip /usr/local/share/cmake-4.0/Modules/FindBoost.cmake (among 444 other modules) was …

---

## [CMake 4.0 appears to have broken my github CI builds](https://discourse.cmake.org/t/cmake-4-0-appears-to-have-broken-my-github-ci-builds/13865)

<div class="topic-metadata">

**Author:** [@LegalizeAdulthood](https://discourse.cmake.org/u/LegalizeAdulthood)\
**Replies:** 2\
**Last updated:** [April 3, 2025, 7:54pm UTC](https://discourse.cmake.org/t/cmake-4-0-appears-to-have-broken-my-github-ci-builds/13865 "2025-04-03T19:54:08Z")

</div>

See these workflow runs: The most recent builds are me flailing around trying to get cmake to work, but the vcpkg step where the manifest is processed and dependent packages are installed always fails on ubuntu where c…

---

## [Linking C shared library - Undefined symbols](https://discourse.cmake.org/t/linking-c-shared-library-undefined-symbols/13864)

<div class="topic-metadata">

**Author:** [@ghenry](https://discourse.cmake.org/u/ghenry)\
**Replies:** 3\
**Last updated:** [April 2, 2025, 8:58pm UTC](https://discourse.cmake.org/t/linking-c-shared-library-undefined-symbols/13864 "2025-04-02T20:58:40Z")

</div>

Hi all, Looking for a second pair of eyes. My CI is failing on macOS for my shared lib. I’m not sure why linking is failing. My CMakeLists.txt High level: C binary project builds a lib of itself Rust library uses an…

---

## [Making policy warnings hard failures](https://discourse.cmake.org/t/making-policy-warnings-hard-failures/13860)

<div class="topic-metadata">

**Author:** [@whitty](https://discourse.cmake.org/u/whitty)\
**Replies:** 0\
**Last updated:** [March 31, 2025, 11:06pm UTC](https://discourse.cmake.org/t/making-policy-warnings-hard-failures/13860 "2025-03-31T23:06:02Z")

</div>

Hi, Not sure if its just by google-fu is failing, but is there a way to make policy warnings hard failures? Essentially -Werror=policy My intent is to add some CI jobs to download later versions of CMake for pre-testi…

---

## [Fetch Content EXCLUDE\_FROM\_ALL still adds targets to Xcode IDE](https://discourse.cmake.org/t/fetch-content-exclude-from-all-still-adds-targets-to-xcode-ide/13841)

<div class="topic-metadata">

**Author:** [@K20shores](https://discourse.cmake.org/u/K20shores)\
**Replies:** 4\
**Last updated:** [March 28, 2025, 11:23pm UTC](https://discourse.cmake.org/t/fetch-content-exclude-from-all-still-adds-targets-to-xcode-ide/13841 "2025-03-28T23:23:06Z")

</div>

Below is a minimal cmake file that includes eigen with fetch content. cmake\_minimum\_required(VERSION 3.28) project(EigenFetchExample LANGUAGES CXX) include(FetchContent) FetchContent\_Declare( eigen GIT\_REPOSIT…

---

## [CMake Cache Issue](https://discourse.cmake.org/t/cmake-cache-issue/13807)

<div class="topic-metadata">

**Author:** [@WiggishPlanet](https://discourse.cmake.org/u/WiggishPlanet)\
**Replies:** 6\
**Last updated:** [March 28, 2025, 11:10pm UTC](https://discourse.cmake.org/t/cmake-cache-issue/13807 "2025-03-28T23:10:01Z")

</div>

Hi everybody. I have a problem with CMake cache and FindBoost module. I use CMake 4.0; however, I have experienced this in the past with other versions as well. My subdirectory (src) CMakeFiles.txt includes this for fin…

---

## [CDash build name customizability?](https://discourse.cmake.org/t/cdash-build-name-customizability/13819)

<div class="topic-metadata">

**Author:** [@benthevining](https://discourse.cmake.org/u/benthevining)\
**Replies:** 5\
**Last updated:** [March 28, 2025, 8:39pm UTC](https://discourse.cmake.org/t/cdash-build-name-customizability/13819 "2025-03-28T20:39:18Z")

</div>

I’d like my CDash build names to include the build configuration (not sure why that’s not listed anywhere in CDash by default). Unless I’m missing something, it seems non-trivial to override this, I can’t find any CLI fl…

---

## [imported target enforcing overly restrictive compile options](https://discourse.cmake.org/t/imported-target-enforcing-overly-restrictive-compile-options/13830)

<div class="topic-metadata">

**Author:** [@jwm](https://discourse.cmake.org/u/jwm)\
**Replies:** 3\
**Last updated:** [March 27, 2025, 10:35pm UTC](https://discourse.cmake.org/t/imported-target-enforcing-overly-restrictive-compile-options/13830 "2025-03-27T22:35:07Z")

</div>

I’ve been hurt by this a couple of times now, and I’m wondering if there is any support to protect a project from an imported target “enforcing” unwanted or conflicting compilation arguments through INTERFACE\_COMPILE\_OPT…

---

## [dependency file(\*.d) file generation in cmake](https://discourse.cmake.org/t/dependency-file-d-file-generation-in-cmake/2680)

<div class="topic-metadata">

**Author:** [@deepan](https://discourse.cmake.org/u/deepan)\
**Replies:** 8\
**Last updated:** [March 27, 2025, 4:08pm UTC](https://discourse.cmake.org/t/dependency-file-d-file-generation-in-cmake/2680 "2025-03-27T16:08:57Z")

</div>

I am using cmake version 3.18.5. I have a C project for embedded system in cmake. I want the build system to generate .d files while building. my project compilation is successful but i don’t see the .d files anywhere. H…

---

## [Project with C++ and C# in Linux and Mac](https://discourse.cmake.org/t/project-with-c-and-c-in-linux-and-mac/13836)

<div class="topic-metadata">

**Author:** [@tuket](https://discourse.cmake.org/u/tuket)\
**Replies:** 0\
**Last updated:** [March 27, 2025, 9:56am UTC](https://discourse.cmake.org/t/project-with-c-and-c-in-linux-and-mac/13836 "2025-03-27T09:56:54Z")

</div>

I’m trying to compile an existing project to Linux and Mac. The project combines both C++ and C# libraries. Apparently, the CMake C# generator only produces VS project files. But C++ I need to use either Make or Ninja. …

---

## [Usage of "CMAKE\_MSVC\_RUNTIME\_LIBRARY" prior to project() or not?](https://discourse.cmake.org/t/usage-of-cmake-msvc-runtime-library-prior-to-project-or-not/13810)

<div class="topic-metadata">

**Author:** [@Taw\_Moto](https://discourse.cmake.org/u/Taw_Moto)\
**Replies:** 3\
**Last updated:** [March 25, 2025, 4:43pm UTC](https://discourse.cmake.org/t/usage-of-cmake-msvc-runtime-library-prior-to-project-or-not/13810 "2025-03-25T16:43:39Z")

</div>

Hi, In CMake, some options (like CMAKE\_OSX\_ARCHITECTURES), should be set before the first “project()” command, which is pretty clear. But, I need a somehow similar option, CMAKE\_MSVC\_RUNTIME\_LIBRARY, and I want to be 1…

---

## [Adding an external library to my project](https://discourse.cmake.org/t/adding-an-external-library-to-my-project/13784)

<div class="topic-metadata">

**Author:** [@fracton](https://discourse.cmake.org/u/fracton)\
**Replies:** 10\
**Last updated:** [March 25, 2025, 9:16am UTC](https://discourse.cmake.org/t/adding-an-external-library-to-my-project/13784 "2025-03-25T09:16:15Z")

</div>

Hi, I am new to cmake and am trying to build my fortran project with an external library that has been added as a git submodule to my project repository. The external project has a CMakeLists.txt file and can be built u…

---

## [hide target from file-api](https://discourse.cmake.org/t/hide-target-from-file-api/13800)

<div class="topic-metadata">

**Author:** [@KSergeyP](https://discourse.cmake.org/u/KSergeyP)\
**Replies:** 1\
**Last updated:** [March 24, 2025, 7:47pm UTC](https://discourse.cmake.org/t/hide-target-from-file-api/13800 "2025-03-24T19:47:02Z")

</div>

VSCode lists all targets as a flat list. I don’t need to see GoogleTests targets for example. How can I specify in the Cmake script that the target should not be displayed in file-api?

---

## [problem compilation cmake V3.26.0 raspberry3B+ debian11](https://discourse.cmake.org/t/problem-compilation-cmake-v3-26-0-raspberry3b-debian11/13805)

<div class="topic-metadata">

**Author:** [@spearman](https://discourse.cmake.org/u/spearman)\
**Replies:** 0\
**Last updated:** [March 24, 2025, 5:07pm UTC](https://discourse.cmake.org/t/problem-compilation-cmake-v3-26-0-raspberry3b-debian11/13805 "2025-03-24T17:07:29Z")

</div>

hello, i need Cmake v3.26.0 minimal. probleme during make. Environmt: Raspberry3B+/debian11 Cmake version: 3.18.4 Openssl version:OpenSSL 1.1.1w 11 Sep 2023 Where is my mystake? Thanks. ... \[ 25%\] Building C ob…

---

## [CMake executed by a Python script can't find the file which exists.](https://discourse.cmake.org/t/cmake-executed-by-a-python-script-cant-find-the-file-which-exists/13798)

<div class="topic-metadata">

**Author:** [@ay0ks](https://discourse.cmake.org/u/ay0ks)\
**Replies:** 2\
**Last updated:** [March 24, 2025, 7:07am UTC](https://discourse.cmake.org/t/cmake-executed-by-a-python-script-cant-find-the-file-which-exists/13798 "2025-03-24T07:07:29Z")

</div>

For some unclear reason the command executed by a Python script doesn’t work both in WSL and Windows, however works if I execute the command myself in a shell. Script on GitHub Gist: Project configurator script · GitHub …

---

## [Need help using swig](https://discourse.cmake.org/t/need-help-using-swig/13791)

<div class="topic-metadata">

**Author:** [@emanuel](https://discourse.cmake.org/u/emanuel)\
**Replies:** 1\
**Last updated:** [March 23, 2025, 12:00pm UTC](https://discourse.cmake.org/t/need-help-using-swig/13791 "2025-03-23T12:00:55Z")

</div>

Hello, I’m brand new to CMake. I’ve been building interpreters into LibreCAD for a while now. It works well with QtCreator. LibreCAD also has a Pixi build with CMake. I’m trying in vain to port my configs. The res…

---

## [BUILD\_TYPE not set during \`cmake --install\`](https://discourse.cmake.org/t/build-type-not-set-during-cmake-install/10894)

<div class="topic-metadata">

**Author:** [@JRR](https://discourse.cmake.org/u/JRR)\
**Replies:** 2\
**Last updated:** [March 21, 2025, 4:02pm UTC](https://discourse.cmake.org/t/build-type-not-set-during-cmake-install/10894 "2025-03-21T16:02:13Z")

</div>

I’ve been looking into installing my code into different directories depending upon the configuration type. This is for Visual Studios – multi-config compiler. I’ve done this by setting CMAKE\_INSTALL\_PATH=\<path\>/\\${BUI…

---

## [Need to build twice to copy all dependencies in post build step](https://discourse.cmake.org/t/need-to-build-twice-to-copy-all-dependencies-in-post-build-step/13785)

<div class="topic-metadata">

**Author:** [@cen](https://discourse.cmake.org/u/cen)\
**Replies:** 3\
**Last updated:** [March 21, 2025, 3:29pm UTC](https://discourse.cmake.org/t/need-to-build-twice-to-copy-all-dependencies-in-post-build-step/13785 "2025-03-21T15:29:02Z")

</div>

I have a root cmake project consisting of two subprojects, one is a library, the other are unit tests. Unit tests link to the library. On Windows, I need to copy all dependend .dll-s for shared builds next to the unit t…

---

## [CMake on zOS?](https://discourse.cmake.org/t/cmake-on-zos/6880)

<div class="topic-metadata">

**Author:** [@nshustov](https://discourse.cmake.org/u/nshustov)\
**Replies:** 9\
**Last updated:** [March 21, 2025, 12:19pm UTC](https://discourse.cmake.org/t/cmake-on-zos/6880 "2025-03-21T12:19:30Z")

</div>

Is CMake supported on zOS? If not, any plans for that?

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

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