# Usage

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

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

**Page:** 8

---

## [Why is cmake trying to use libstdc++ for C++ modules on android?](https://discourse.cmake.org/t/why-is-cmake-trying-to-use-libstdc-for-c-modules-on-android/15038)

<div class="topic-metadata">

**Author:** [@mccakit](https://discourse.cmake.org/u/mccakit)\
**Replies:** 1\
**Last updated:** [August 18, 2025, 3:21pm UTC](https://discourse.cmake.org/t/why-is-cmake-trying-to-use-libstdc-for-c-modules-on-android/15038 "2025-08-18T15:21:02Z")

</div>

set(ANDROID\_PLATFORM 30) set(ANDROID\_ABI arm64-v8a) set(ANDROID\_STL c++\_static) include( /home/mccakit/dev/android-clt/ndk/29.0.13599879/build/cmake/android.toolchain.cmake ) add\_compile\_options(-nostdinc++ -nostdlib…

---

## [does POST\_BUILD work with add\_custom\_target and Visual Studio?](https://discourse.cmake.org/t/does-post-build-work-with-add-custom-target-and-visual-studio/5290)

<div class="topic-metadata">

**Author:** [@dockd](https://discourse.cmake.org/u/dockd)\
**Replies:** 8\
**Last updated:** [August 17, 2025, 11:54pm UTC](https://discourse.cmake.org/t/does-post-build-work-with-add-custom-target-and-visual-studio/5290 "2025-08-17T23:54:58Z")

</div>

I build a static library and then want to add two more static libs to it after it is built. The documentation for add\_custom\_command/“BUILD EVENTS” says The command becomes part of the target and will only execute whe…

---

## [How to build for Android with my own clang](https://discourse.cmake.org/t/how-to-build-for-android-with-my-own-clang/15036)

<div class="topic-metadata">

**Author:** [@mccakit](https://discourse.cmake.org/u/mccakit)\
**Replies:** 0\
**Last updated:** [August 15, 2025, 11:30pm UTC](https://discourse.cmake.org/t/how-to-build-for-android-with-my-own-clang/15036 "2025-08-15T23:30:54Z")

</div>

Hi, I want to build a shared library I can later package with java glue code with my own compiler, I don’t want to use Android NDK provided clang. The problem I face is, cmake is hard coded to use ndk provided clang and…

---

## [How to specify TLS Client Certificate for ExternalProject/FetchContent](https://discourse.cmake.org/t/how-to-specify-tls-client-certificate-for-externalproject-fetchcontent/15000)

<div class="topic-metadata">

**Author:** [@kawk](https://discourse.cmake.org/u/kawk)\
**Replies:** 2\
**Last updated:** [August 14, 2025, 6:04pm UTC](https://discourse.cmake.org/t/how-to-specify-tls-client-certificate-for-externalproject-fetchcontent/15000 "2025-08-14T18:04:19Z")

</div>

Hi, Is it possible to specify a client certificate for use with GIT or SVN in ExternalProject or FetchContent (or do I have to formulate a custom DOWNLOAD\_COMMAND)? I have to fetch content from a GIT server that requir…

---

## [Is there's a way to generate a xcode project which will use ninja to compile?](https://discourse.cmake.org/t/is-theres-a-way-to-generate-a-xcode-project-which-will-use-ninja-to-compile/15002)

<div class="topic-metadata">

**Author:** [@pbskycrystal](https://discourse.cmake.org/u/pbskycrystal)\
**Replies:** 1\
**Last updated:** [August 14, 2025, 5:48pm UTC](https://discourse.cmake.org/t/is-theres-a-way-to-generate-a-xcode-project-which-will-use-ninja-to-compile/15002 "2025-08-14T17:48:14Z")

</div>

I’m trying to switch our generator from Xcode to Ninja Multi-config, which makes compile much faster. But some of our teammates said they prefer using Xcode for develop/debug. Is there’s a way to generate a xcode projec…

---

## [Error and Output logs missing with v3.29.5](https://discourse.cmake.org/t/error-and-output-logs-missing-with-v3-29-5/10978)

<div class="topic-metadata">

**Author:** [@osxtra](https://discourse.cmake.org/u/osxtra)\
**Replies:** 10\
**Last updated:** [August 13, 2025, 4:50pm UTC](https://discourse.cmake.org/t/error-and-output-logs-missing-with-v3-29-5/10978 "2025-08-13T16:50:56Z")

</div>

Hi, noticed after upgrading from v3.25.1 to v3.29.5 that neither CMakeOutput.log or CMakeError.log are being created. Am on Mac Ventura (13.6), installing to /usr/local Doing out of source builds with a folder for each…

---

## [Confused by OBJECT library](https://discourse.cmake.org/t/confused-by-object-library/14453)

<div class="topic-metadata">

**Author:** [@Adam\_BZH](https://discourse.cmake.org/u/Adam_BZH)\
**Replies:** 3\
**Last updated:** [August 13, 2025, 11:43am UTC](https://discourse.cmake.org/t/confused-by-object-library/14453 "2025-08-13T11:43:39Z")

</div>

My project was compile each subfolder cmake project to an STATIC library, but in this way gcc may strip some codes while compile or link, if later other things dependens on that library, symbol could not be found After …

---

## [ctest enabling colored output on windows?](https://discourse.cmake.org/t/ctest-enabling-colored-output-on-windows/7696)

<div class="topic-metadata">

**Author:** [@serge](https://discourse.cmake.org/u/serge)\
**Replies:** 10\
**Last updated:** [August 12, 2025, 11:43pm UTC](https://discourse.cmake.org/t/ctest-enabling-colored-output-on-windows/7696 "2025-08-12T23:43:01Z")

</div>

Hello guys, using ctest on Linux and the test output appeared according to the colors being set by the test. This does not happen on Windows, getting the color codes as plain text. I can see here: https://gitlab.kitwar…

---

## [How to use TARGET\_RUNTIME\_DLLS with find\_package DLL of UNKNOWN type](https://discourse.cmake.org/t/how-to-use-target-runtime-dlls-with-find-package-dll-of-unknown-type/14986)

<div class="topic-metadata">

**Author:** [@Gornhoth](https://discourse.cmake.org/u/Gornhoth)\
**Replies:** 1\
**Last updated:** [August 11, 2025, 1:29pm UTC](https://discourse.cmake.org/t/how-to-use-target-runtime-dlls-with-find-package-dll-of-unknown-type/14986 "2025-08-11T13:29:21Z")

</div>

I am using vcpkg on windows to add openssl and use it for a DLL target A which I then link against with executable B. This causes a well-known issue about A and its dependencies not being put into B’s output directory wh…

---

## [after clicking configure I was asked to click a generator but it didn't work](https://discourse.cmake.org/t/after-clicking-configure-i-was-asked-to-click-a-generator-but-it-didnt-work/14928)

<div class="topic-metadata">

**Author:** [@Vigor](https://discourse.cmake.org/u/Vigor)\
**Replies:** 9\
**Last updated:** [August 7, 2025, 9:06pm UTC](https://discourse.cmake.org/t/after-clicking-configure-i-was-asked-to-click-a-generator-but-it-didnt-work/14928 "2025-08-07T21:06:03Z")

</div>

I’ve never used CMake before. I am using it now to generate files for a computer graphics tutorial which uses OpenGL. I believe the tutorial is trying to compile all of the example projects and opengl binaries using …

---

## [uuid library linking](https://discourse.cmake.org/t/uuid-library-linking/14924)

<div class="topic-metadata">

**Author:** [@SS\_SS](https://discourse.cmake.org/u/SS_SS)\
**Replies:** 11\
**Last updated:** [August 7, 2025, 1:08pm UTC](https://discourse.cmake.org/t/uuid-library-linking/14924 "2025-08-07T13:08:25Z")

</div>

Hello, I’m learning how to use cmake for future projects. So far, i built a sample executable, library and linked them together. Wrote a ctest test case, ran code coverage, memcheck and generated a html report, all g…

---

## [target\_link\_libraries doesn't work correctly with C++/CLI compiled dll](https://discourse.cmake.org/t/target-link-libraries-doesnt-work-correctly-with-c-cli-compiled-dll/6406)

<div class="topic-metadata">

**Author:** [@lo1ol](https://discourse.cmake.org/u/lo1ol)\
**Replies:** 4\
**Last updated:** [August 6, 2025, 1:41pm UTC](https://discourse.cmake.org/t/target-link-libraries-doesnt-work-correctly-with-c-cli-compiled-dll/6406 "2025-08-06T13:41:55Z")

</div>

Hi! I noticed that cmake doesn’t link C++/CLI dll correctly. The problem is that cmake tries to link static version of library too, but it doesn’t exist. I write small example to reproduce a problem: cmake\_minimum\_requ…

---

## [Why does find\_library use PATH instead of LD\_LIBRARY\_PATH?](https://discourse.cmake.org/t/why-does-find-library-use-path-instead-of-ld-library-path/9808)

<div class="topic-metadata">

**Author:** [@elahav](https://discourse.cmake.org/u/elahav)\
**Replies:** 9\
**Last updated:** [August 5, 2025, 10:26am UTC](https://discourse.cmake.org/t/why-does-find-library-use-path-instead-of-ld-library-path/9808 "2025-08-05T10:26:34Z")

</div>

I’m building Qt6, which uses the FindZLIB.cmake module to find libz.so. It ends up finding it in the wrong place. When I tried debugging I noticed that the environment-based paths the cmake uses are based on the PATH var…

---

## [Don't use cmd.exe when generating with Ninja on Windows](https://discourse.cmake.org/t/dont-use-cmd-exe-when-generating-with-ninja-on-windows/3215)

<div class="topic-metadata">

**Author:** [@Andrei\_Datcu](https://discourse.cmake.org/u/Andrei_Datcu)\
**Replies:** 17\
**Last updated:** [August 4, 2025, 3:00pm UTC](https://discourse.cmake.org/t/dont-use-cmd-exe-when-generating-with-ninja-on-windows/3215 "2025-08-04T15:00:57Z")

</div>

Is there any way to use a different shell when generating a ninja file? Currently when ninja generates a run command it uses cmd.exe /c … Looking through the cmake code, it seems that’s hard coded and cannot be changed …

---

## [Execute patch from Cmake](https://discourse.cmake.org/t/execute-patch-from-cmake/7000)

<div class="topic-metadata">

**Author:** [@Joost\_v\_Doorn](https://discourse.cmake.org/u/Joost_v_Doorn)\
**Replies:** 4\
**Last updated:** [August 1, 2025, 3:21pm UTC](https://discourse.cmake.org/t/execute-patch-from-cmake/7000 "2025-08-01T15:21:45Z")

</div>

I run CMake under Windows to download a zipfile with source code and unzip it. After the unzip I want to execute patches over the directory with unzipped source code. I am taking the zipfile with source code from the Li…

---

## [Override CMake preset environment variable from the outside](https://discourse.cmake.org/t/override-cmake-preset-environment-variable-from-the-outside/10394)

<div class="topic-metadata">

**Author:** [@gtsc](https://discourse.cmake.org/u/gtsc)\
**Replies:** 1\
**Last updated:** [July 31, 2025, 10:26am UTC](https://discourse.cmake.org/t/override-cmake-preset-environment-variable-from-the-outside/10394 "2025-07-31T10:26:24Z")

</div>

Take this simple set up of CMake presets. { "version": 6, "cmakeMinimumRequired": { "major": 3, "minor": 27, "patch": 0 }, "configurePresets": \[ { "name": "base-preset", "hidden": tru…

---

## [Using FetchContent to download specific folders in a repo](https://discourse.cmake.org/t/using-fetchcontent-to-download-specific-folders-in-a-repo/14474)

<div class="topic-metadata">

**Author:** [@jasonaylward](https://discourse.cmake.org/u/jasonaylward)\
**Replies:** 3\
**Last updated:** [July 30, 2025, 10:23pm UTC](https://discourse.cmake.org/t/using-fetchcontent-to-download-specific-folders-in-a-repo/14474 "2025-07-30T22:23:05Z")

</div>

Is it possible to use FetchContent to pull down specific folders in a repo OR exclude specific folders? I have a dependency in one of my projects that has a folder of images and other assets that I don’t need. It would…

---

## [install\_name\_tool is sporadically required by CMake when targetting macos](https://discourse.cmake.org/t/install-name-tool-is-sporadically-required-by-cmake-when-targetting-macos/14473)

<div class="topic-metadata">

**Author:** [@meator](https://discourse.cmake.org/u/meator)\
**Replies:** 0\
**Last updated:** [July 30, 2025, 8:36pm UTC](https://discourse.cmake.org/t/install-name-tool-is-sporadically-required-by-cmake-when-targetting-macos/14473 "2025-07-30T20:36:18Z")

</div>

I’m trying to cross compile from a Linux host to a MacOS target. I am using Zig as my cross compiler (but I don’t think that’s relevant here, any linux-\>macos cross compiler should exhibit the same issue). Zig is special…

---

## [Can the VS 2019 generator be used if only VS2022 is installed?](https://discourse.cmake.org/t/can-the-vs-2019-generator-be-used-if-only-vs2022-is-installed/6972)

<div class="topic-metadata">

**Author:** [@Garrick](https://discourse.cmake.org/u/Garrick)\
**Replies:** 6\
**Last updated:** [July 30, 2025, 3:28pm UTC](https://discourse.cmake.org/t/can-the-vs-2019-generator-be-used-if-only-vs2022-is-installed/6972 "2025-07-30T15:28:26Z")

</div>

If Visual Studio 2022 is installed, including the older Toolset V142, and NO VS2019 is installed, can the ‘Visual Studio 16 2019 Generator’ be used, to create a solution targeting the old toolset? Our large application …

---

## [Using two different Visual Studio installations as generator](https://discourse.cmake.org/t/using-two-different-visual-studio-installations-as-generator/14465)

<div class="topic-metadata">

**Author:** [@bernb](https://discourse.cmake.org/u/bernb)\
**Replies:** 3\
**Last updated:** [July 30, 2025, 10:17am UTC](https://discourse.cmake.org/t/using-two-different-visual-studio-installations-as-generator/14465 "2025-07-30T10:17:06Z")

</div>

For our software, we want to set a fixed MSVC compiler version (including patch version) when building and want to build two different versions: cmake -G "Visual Studio 17 2022" -A x64,version=10.0 -T "v143,version=14.4…

---

## [Build with "RelWithDebInfo" flag is much bigger than "Debug"](https://discourse.cmake.org/t/build-with-relwithdebinfo-flag-is-much-bigger-than-debug/14461)

<div class="topic-metadata">

**Author:** [@zer0deck](https://discourse.cmake.org/u/zer0deck)\
**Replies:** 2\
**Last updated:** [July 30, 2025, 7:57am UTC](https://discourse.cmake.org/t/build-with-relwithdebinfo-flag-is-much-bigger-than-debug/14461 "2025-07-30T07:57:24Z")

</div>

I have a large project with three main dependencies: drogon, swredis and hiredis. All three dependencies are shared libraries. Project itself contains multiple static libs (tools, models, schemas, services, etc.) linkin…

---

## [Can't get NEW CMP0147 (BuildInParallel) to work](https://discourse.cmake.org/t/cant-get-new-cmp0147-buildinparallel-to-work/11478)

<div class="topic-metadata">

**Author:** [@JanK](https://discourse.cmake.org/u/JanK)\
**Replies:** 3\
**Last updated:** [July 29, 2025, 6:48pm UTC](https://discourse.cmake.org/t/cant-get-new-cmp0147-buildinparallel-to-work/11478 "2025-07-29T18:48:50Z")

</div>

I’m generating projects for Visual Studio 2022. I upgraded my CMake.exe to version 3.30.2. Then I bumped my cmake\_minimum\_required to 3.30. I also added cmake\_policy(SET CMP0147 NEW) a couple of times into my top-leve…

---

## [Working with generated header files on Xcode](https://discourse.cmake.org/t/working-with-generated-header-files-on-xcode/14457)

<div class="topic-metadata">

**Author:** [@SamCoutteauHybrid](https://discourse.cmake.org/u/SamCoutteauHybrid)\
**Replies:** 0\
**Last updated:** [July 28, 2025, 2:06pm UTC](https://discourse.cmake.org/t/working-with-generated-header-files-on-xcode/14457 "2025-07-28T14:06:46Z")

</div>

I would like to generate some headers to be able to export some data as preprocessor defines (context: exporting a project such that it can be consumed by non cmake projects). This is quite simple using file(GENERATE) a…

---

## [Override the default \`-O3 -DNDEBUG\` Release flags?](https://discourse.cmake.org/t/override-the-default-o3-dndebug-release-flags/11085)

<div class="topic-metadata">

**Author:** [@intelfx](https://discourse.cmake.org/u/intelfx)\
**Replies:** 13\
**Last updated:** [July 26, 2025, 2:34pm UTC](https://discourse.cmake.org/t/override-the-default-o3-dndebug-release-flags/11085 "2025-07-26T14:34:48Z")

</div>

Hi, What is the least-breaking way to override the -O3 -DNDEBUG flags automatically set by CMake for Release configurations, without touching any flags that the build system itself might have set in addition? This ques…

---

## [CPACK\_INSTALLED\_DIRECTORIES, How to use?](https://discourse.cmake.org/t/cpack-installed-directories-how-to-use/11496)

<div class="topic-metadata">

**Author:** [@Li\_Haohuang](https://discourse.cmake.org/u/Li_Haohuang)\
**Replies:** 1\
**Last updated:** [July 25, 2025, 4:08pm UTC](https://discourse.cmake.org/t/cpack-installed-directories-how-to-use/11496 "2025-07-25T16:08:41Z")

</div>

Too less description! I don’t know how to specify value to this variable to meet my needs Packaging With CPack — Mastering CMake Can I get a demo please!! Thank you very much :sob:! How should I specify the pairs o…

---

## [Find non-terminated tests with ctest -j](https://discourse.cmake.org/t/find-non-terminated-tests-with-ctest-j/9389)

<div class="topic-metadata">

**Author:** [@JanWielemaker](https://discourse.cmake.org/u/JanWielemaker)\
**Replies:** 13\
**Last updated:** [July 25, 2025, 1:02pm UTC](https://discourse.cmake.org/t/find-non-terminated-tests-with-ctest-j/9389 "2025-07-25T13:02:12Z")

</div>

Sometimes some test under ctest does not (or not timely) terminate. When running with -j and a high number of tasks it is very hard to figure out which test has not ended yet. On Linux we have a decent ps or pstree,…

---

## [path seems not escaped in rsp file using ninja](https://discourse.cmake.org/t/path-seems-not-escaped-in-rsp-file-using-ninja/14444)

<div class="topic-metadata">

**Author:** [@DH\_S](https://discourse.cmake.org/u/DH_S)\
**Replies:** 0\
**Last updated:** [July 25, 2025, 9:17am UTC](https://discourse.cmake.org/t/path-seems-not-escaped-in-rsp-file-using-ninja/14444 "2025-07-25T09:17:20Z")

</div>

cmake version 4.0.3 ninja version: 1.11.1 Compiler: Hightech tricore-gcc When archiving the object files, the tricore-ar gives the error in below image. It seems missing the path separator. Parts of rsp file cont…

---

## [FetchContent: why re-pulling unchanged child project under Gitlab CI?](https://discourse.cmake.org/t/fetchcontent-why-re-pulling-unchanged-child-project-under-gitlab-ci/14436)

<div class="topic-metadata">

**Author:** [@franki](https://discourse.cmake.org/u/franki)\
**Replies:** 2\
**Last updated:** [July 24, 2025, 8:23pm UTC](https://discourse.cmake.org/t/fetchcontent-why-re-pulling-unchanged-child-project-under-gitlab-ci/14436 "2025-07-24T20:23:15Z")

</div>

Synopsis: On standalone workstation, child project is not re-pulled by FetchContent unless it changes, whereas under Gitlab CI it is re-pulled every pipeline run, even if unchanged. I have two projects, Parent and Child…

---

## [CMake is not an operatable batch file, ...](https://discourse.cmake.org/t/cmake-is-not-an-operatable-batch-file/14423)

<div class="topic-metadata">

**Author:** [@Astrox](https://discourse.cmake.org/u/Astrox)\
**Replies:** 3\
**Last updated:** [July 24, 2025, 9:57am UTC](https://discourse.cmake.org/t/cmake-is-not-an-operatable-batch-file/14423 "2025-07-24T09:57:26Z")

</div>

I downloaded CMake version 3.3 something and I unzipped it, and I added it to my path and vscode cmake path and when I do “cmake --version” in the terminal it says “CMake is not an operatable batch file, …” but, it does …

---

## [Query about policy CMP0128](https://discourse.cmake.org/t/query-about-policy-cmp0128/14386)

<div class="topic-metadata">

**Author:** [@Chardrazle](https://discourse.cmake.org/u/Chardrazle)\
**Replies:** 3\
**Last updated:** [July 23, 2025, 7:34pm UTC](https://discourse.cmake.org/t/query-about-policy-cmp0128/14386 "2025-07-23T19:34:56Z")

</div>

We recently ran into an issue when the cmake\_minimum\_required was bumped above 3.21, and policy CMP0128 came into force. There were common project settings with: set(CMAKE\_CXX\_STANDARD 20) set(CMAKE\_CXX\_EXTENSIONS …

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

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