# Usage

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

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

**Page:** 7

---

## [Using --trace or --debug with the -E option (from a newbie)](https://discourse.cmake.org/t/using-trace-or-debug-with-the-e-option-from-a-newbie/15211)

<div class="topic-metadata">

**Author:** [@AlbertM](https://discourse.cmake.org/u/AlbertM)\
**Replies:** 1\
**Last updated:** [October 2, 2025, 10:59pm UTC](https://discourse.cmake.org/t/using-trace-or-debug-with-the-e-option-from-a-newbie/15211 "2025-10-02T22:59:41Z")

</div>

Hi, Specifying -trace or –debug before the -E option messes up the -E option. I can’t find this documented in the options page (https://cmake.org/cmake/help/v4.0/manual/cmake.1.html#run-a-command-line-tool) This might…

---

## [IMPORTED\_IMPLIB not set for imported target](https://discourse.cmake.org/t/imported-implib-not-set-for-imported-target/5398)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.cmake.org/u/alice)\
**Replies:** 6\
**Last updated:** [October 2, 2025, 3:28pm UTC](https://discourse.cmake.org/t/imported-implib-not-set-for-imported-target/5398 "2025-10-02T15:28:27Z")

</div>

I build a opencv library and use it on vs2019. What is the error ? the folder ‘opencv\\x64\\vc16\\lib’ that I include have the opencv\_reg455d.lib CMake Error in CMakeLists.txt: IMPORTED\_IMPLIB not set for imported targ…

---

## [Configuration-time compiler checks: how to run them once and reuse their result?](https://discourse.cmake.org/t/configuration-time-compiler-checks-how-to-run-them-once-and-reuse-their-result/15201)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 0\
**Last updated:** [September 29, 2025, 12:10pm UTC](https://discourse.cmake.org/t/configuration-time-compiler-checks-how-to-run-them-once-and-reuse-their-result/15201 "2025-09-29T12:10:07Z")

</div>

Hi, I’ve seen many discussions on how to skip compiler checks but they haven’t provided me with a good comprehension of what they were and how to avoid redundant checks. I’ve got situations where I configure independen…

---

## [FindMPI Intel ILP64 does not include the correct .mod file on Windows/ifx](https://discourse.cmake.org/t/findmpi-intel-ilp64-does-not-include-the-correct-mod-file-on-windows-ifx/15204)

<div class="topic-metadata">

**Author:** [@Istvan\_L](https://discourse.cmake.org/u/Istvan_L)\
**Replies:** 0\
**Last updated:** [September 30, 2025, 9:10am UTC](https://discourse.cmake.org/t/findmpi-intel-ilp64-does-not-include-the-correct-mod-file-on-windows-ifx/15204 "2025-09-30T09:10:09Z")

</div>

Hello, i’m trying to use Intel MPI in a CMakefile (\>= 4.1) with the 64-bit default integer size ( -ilp64 / -i8 / -integer-size:64 ) I wrote set(MPI\_Fortran\_COMPILER\_FLAGS "-i8") find\_package(MPI REQUIRED) On Windows…

---

## [git submodule with add\_executable](https://discourse.cmake.org/t/git-submodule-with-add-executable/15203)

<div class="topic-metadata">

**Author:** [@Antoine\_DeBlois](https://discourse.cmake.org/u/Antoine_DeBlois)\
**Replies:** 0\
**Last updated:** [September 29, 2025, 8:22pm UTC](https://discourse.cmake.org/t/git-submodule-with-add-executable/15203 "2025-09-29T20:22:43Z")

</div>

Hello everyone, I would need your guidance on the usage of a git submodule that generates an executable, which I want to call from the main cmake project. So far, my project compiles properly, but the exe built from th…

---

## [How to determine build type?](https://discourse.cmake.org/t/how-to-determine-build-type/15200)

<div class="topic-metadata">

**Author:** [@alexandr](https://discourse.cmake.org/u/alexandr)\
**Replies:** 1\
**Last updated:** [September 28, 2025, 12:54pm UTC](https://discourse.cmake.org/t/how-to-determine-build-type/15200 "2025-09-28T12:54:15Z")

</div>

Hello all! My CMake project is for iOS and using XCode generator. For now there are troubles with getting build type. The command that calling CMake is: cmake --build /Project/build/iOS\_Simulator --target ALL\_BUILD --c…

---

## [Silencing \`Compatibility with CMake \< 3.10 will be removed\` message](https://discourse.cmake.org/t/silencing-compatibility-with-cmake-3-10-will-be-removed-message/15197)

<div class="topic-metadata">

**Author:** [@alcroito](https://discourse.cmake.org/u/alcroito)\
**Replies:** 2\
**Last updated:** [September 25, 2025, 6:21pm UTC](https://discourse.cmake.org/t/silencing-compatibility-with-cmake-3-10-will-be-removed-message/15197 "2025-09-25T18:21:02Z")

</div>

Hi, When configuring a project with cmake 3.31+ and a cmake toolchain file provided by an Android NDK \< r28, one will see the following deprecation warning: $ cat ../CMakeLists.txt cmake\_minimum\_required(VERSION 3.16) …

---

## [How can you use the cmake file api to determine whether a test is defined for a target ?](https://discourse.cmake.org/t/how-can-you-use-the-cmake-file-api-to-determine-whether-a-test-is-defined-for-a-target/15191)

<div class="topic-metadata">

**Author:** [@rhabacker](https://discourse.cmake.org/u/rhabacker)\
**Replies:** 4\
**Last updated:** [September 24, 2025, 9:27pm UTC](https://discourse.cmake.org/t/how-can-you-use-the-cmake-file-api-to-determine-whether-a-test-is-defined-for-a-target/15191 "2025-09-24T21:27:55Z")

</div>

A problem has been identified in Qt Creator that causes running or debugging targets to always use the launcher defined with CMAKE\_TEST\_LAUNCHER, see https://bugreports.qt.io/browse/QTCREATORBUG-32550. The current worka…

---

## [File Copy Error, claiming files do not exist or are unmodifiable](https://discourse.cmake.org/t/file-copy-error-claiming-files-do-not-exist-or-are-unmodifiable/15193)

<div class="topic-metadata">

**Author:** [@SamCoutteauHybrid](https://discourse.cmake.org/u/SamCoutteauHybrid)\
**Replies:** 0\
**Last updated:** [September 24, 2025, 9:59am UTC](https://discourse.cmake.org/t/file-copy-error-claiming-files-do-not-exist-or-are-unmodifiable/15193 "2025-09-24T09:59:07Z")

</div>

Whilst running project in CI, I get weird errors related to file copy on specific platform generator combinations. Error cases 1 (only sometimes) Ubuntu CMAKE\_C\_COMPILER=/usr/bin/gcc CMAKE\_CXX\_COMPILER=/usr/bin/g++ CMAK…

---

## [Generating a toochain from a successful configuration](https://discourse.cmake.org/t/generating-a-toochain-from-a-successful-configuration/15190)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 1\
**Last updated:** [September 23, 2025, 3:17pm UTC](https://discourse.cmake.org/t/generating-a-toochain-from-a-successful-configuration/15190 "2025-09-23T15:17:13Z")

</div>

Hi, this is a follow-up of \[this topic\]( check\_ipo\_supported taking a long time ). My actual goal is to launch a bunch of configuration commands on different projects (which are not defined as a submodule of a main proj…

---

## [CDash subprojects for spliting information from unit and acceptance tests](https://discourse.cmake.org/t/cdash-subprojects-for-spliting-information-from-unit-and-acceptance-tests/14478)

<div class="topic-metadata">

**Author:** [@nickvdbroeck](https://discourse.cmake.org/u/nickvdbroeck)\
**Replies:** 2\
**Last updated:** [September 23, 2025, 10:15am UTC](https://discourse.cmake.org/t/cdash-subprojects-for-spliting-information-from-unit-and-acceptance-tests/14478 "2025-09-23T10:15:08Z")

</div>

Hello all, I am trying my hand at cdash to get more feedback from our nightly build pipeline. To do this I am using a ctest script and am I using the “all-at-once” method. i followed this explanation: https://www.kitwa…

---

## [Finding auxiliary files in a library](https://discourse.cmake.org/t/finding-auxiliary-files-in-a-library/15181)

<div class="topic-metadata">

**Author:** [@ramcdona](https://discourse.cmake.org/u/ramcdona)\
**Replies:** 8\
**Last updated:** [September 20, 2025, 9:51am UTC](https://discourse.cmake.org/t/finding-auxiliary-files-in-a-library/15181 "2025-09-20T09:51:11Z")

</div>

I have a library that needs some auxiliary files to accompany the binary and headers. I tell CMake to install these files along with everything else… install( TARGETS foo EXPORT footargets ) install( DIRECTORY…

---

## [FetchContent, find\_package, and missing package files](https://discourse.cmake.org/t/fetchcontent-find-package-and-missing-package-files/15143)

<div class="topic-metadata">

**Author:** [@oursland](https://discourse.cmake.org/u/oursland)\
**Replies:** 5\
**Last updated:** [September 20, 2025, 9:23am UTC](https://discourse.cmake.org/t/fetchcontent-find-package-and-missing-package-files/15143 "2025-09-20T09:23:45Z")

</div>

I am attempting to use coin3d as a vendored project through the FetchContent() and find\_package() mechanism. Unfortunately, the package files are not generated by configure\_package\_config\_file() and write\_basic\_package\_…

---

## [Clarification: Interaction between CMAKE\_POLICY\_VERSION\_MINIMUM and cmake\_minimum\_required()](https://discourse.cmake.org/t/clarification-interaction-between-cmake-policy-version-minimum-and-cmake-minimum-required/15183)

<div class="topic-metadata">

**Author:** [@perseoGI](https://discourse.cmake.org/u/perseoGI)\
**Replies:** 2\
**Last updated:** [September 22, 2025, 8:14am UTC](https://discourse.cmake.org/t/clarification-interaction-between-cmake-policy-version-minimum-and-cmake-minimum-required/15183 "2025-09-22T08:14:12Z")

</div>

Hi CMake team, Conan member here! I’d like to clarify the intended behavior of CMAKE\_POLICY\_VERSION\_MINIMUM when it is set to a version lower than the one explicitly specified by cmake\_minimum\_required(). Given the fo…

---

## [CMake config-only memory usage](https://discourse.cmake.org/t/cmake-config-only-memory-usage/15156)

<div class="topic-metadata">

**Author:** [@warmcat](https://discourse.cmake.org/u/warmcat)\
**Replies:** 2\
**Last updated:** [September 15, 2025, 5:53am UTC](https://discourse.cmake.org/t/cmake-config-only-memory-usage/15156 "2025-09-15T05:53:37Z")

</div>

I am using cmake on libwebsockets for a long time, with great success. Recently I have been working on our CI, in particular splitting the build process into separate spawn actions each of which records the cpu usage an…

---

## [CMake Generated VS 2022 Project File references to the library "rt.lib" instead of "msvcrt.lib"](https://discourse.cmake.org/t/cmake-generated-vs-2022-project-file-references-to-the-library-rt-lib-instead-of-msvcrt-lib/15155)

<div class="topic-metadata">

**Author:** [@darbysobha](https://discourse.cmake.org/u/darbysobha)\
**Replies:** 1\
**Last updated:** [September 8, 2025, 3:46am UTC](https://discourse.cmake.org/t/cmake-generated-vs-2022-project-file-references-to-the-library-rt-lib-instead-of-msvcrt-lib/15155 "2025-09-08T03:46:07Z")

</div>

Hello, When I build my project, I get the following error message: LINK : fatal error LNK1181: cannot open input file 'rt.lib' \[D:\\conan2-libraries\\hdbreader-source\\build-release\\src\\tests\\SavecaseReader\_unittest\\Savec…

---

## [\`submodule.\<name\>.shallow=true\` don't work in the CMakeLists.txt](https://discourse.cmake.org/t/submodule-name-shallow-true-dont-work-in-the-cmakelists-txt/15136)

<div class="topic-metadata">

**Author:** [@anlexN](https://discourse.cmake.org/u/anlexN)\
**Replies:** 9\
**Last updated:** [September 5, 2025, 5:38am UTC](https://discourse.cmake.org/t/submodule-name-shallow-true-dont-work-in-the-cmakelists-txt/15136 "2025-09-05T05:38:18Z")

</div>

$ cmake -B build-by-cmake-2 -G Ninja -DCMAKE\_C\_COMPILER=gcc-15 -DCMAKE\_CXX\_COMPILER=g++-15 -DFETCHCONTENT\_QUIET=OFF -DFETCHCONTENT\_FULL\_VERBOSE=ON CMake Warning: This project has been configured with a project file oth…

---

## [FILE\_SET Usage](https://discourse.cmake.org/t/file-set-usage/15144)

<div class="topic-metadata">

**Author:** [@ArmanMass](https://discourse.cmake.org/u/ArmanMass)\
**Replies:** 0\
**Last updated:** [September 2, 2025, 12:45am UTC](https://discourse.cmake.org/t/file-set-usage/15144 "2025-09-02T00:45:38Z")

</div>

Project Directory: . ├── CMakeLists.txt ├── CMakeUserPresets.json ├── README.md ├── build\_all.sh ├── conanfile.py ├── include │ ├── itch\_msg.h │ ├── itchparser.h │ ├── orderbook │ │ ├── LevelInfo.h …

---

## [MSVC default compiler/linker settings invoked by CMake](https://discourse.cmake.org/t/msvc-default-compiler-linker-settings-invoked-by-cmake/15128)

<div class="topic-metadata">

**Author:** [@Ebbo](https://discourse.cmake.org/u/Ebbo)\
**Replies:** 2\
**Last updated:** [September 1, 2025, 10:35am UTC](https://discourse.cmake.org/t/msvc-default-compiler-linker-settings-invoked-by-cmake/15128 "2025-09-01T10:35:18Z")

</div>

Hi, I wonder where CMake gets the default settings when building the toolchain from scratch…? So with a primitive 3 line CMakeLists.txt cmake\_minimum\_required(VERSION 3.22.0) project(DEFAULT\_TEST VERSION 0.1.1) add\_…

---

## [Why can't I find curl when cross compiling?](https://discourse.cmake.org/t/why-cant-i-find-curl-when-cross-compiling/11041)

<div class="topic-metadata">

**Author:** [@bertulli](https://discourse.cmake.org/u/bertulli)\
**Replies:** 14\
**Last updated:** [August 31, 2025, 9:48pm UTC](https://discourse.cmake.org/t/why-cant-i-find-curl-when-cross-compiling/11041 "2025-08-31T21:48:46Z")

</div>

EDIT: to reach more people, cross posted here Hi all! I’m trying to add curl to my project. I made some tests on native build, and it works fine like this: find\_package(CURL REQUIRED) include\_directories(${CURL\_INCLUDE…

---

## [Setting CMake with a library INTERFACE (DS3231)](https://discourse.cmake.org/t/setting-cmake-with-a-library-interface-ds3231/15134)

<div class="topic-metadata">

**Author:** [@SCosimo](https://discourse.cmake.org/u/SCosimo)\
**Replies:** 0\
**Last updated:** [August 30, 2025, 9:14pm UTC](https://discourse.cmake.org/t/setting-cmake-with-a-library-interface-ds3231/15134 "2025-08-30T21:14:38Z")

</div>

Hello everyone, really I don’t understand what’s wrong. Simple folder tree: - Development - CMakeLists.txt (1) - main.cpp - hwconfig.c - pico\_sdk\_import - build - lib - CMakeLists.txt (2) …

---

## [A correct way to add \`\_d\` debug prefix for Debug Python extensions on Windows](https://discourse.cmake.org/t/a-correct-way-to-add-d-debug-prefix-for-debug-python-extensions-on-windows/15132)

<div class="topic-metadata">

**Author:** [@Andrej730](https://discourse.cmake.org/u/Andrej730)\
**Replies:** 2\
**Last updated:** [August 30, 2025, 3:46pm UTC](https://discourse.cmake.org/t/a-correct-way-to-add-d-debug-prefix-for-debug-python-extensions-on-windows/15132 "2025-08-30T15:46:28Z")

</div>

On Windows when you run debug version of Python (python\_d.exe) it only accepts extensions that were linked against python311\_d.dll and also it requires them to have \_d suffix. For example: # Let's say we've compiled '\_…

---

## [Feature Request: warning for conflicting FetchContent options](https://discourse.cmake.org/t/feature-request-warning-for-conflicting-fetchcontent-options/15116)

<div class="topic-metadata">

**Author:** [@devreal](https://discourse.cmake.org/u/devreal)\
**Replies:** 1\
**Last updated:** [August 27, 2025, 10:26pm UTC](https://discourse.cmake.org/t/feature-request-warning-for-conflicting-fetchcontent-options/15116 "2025-08-27T22:26:15Z")

</div>

The documentation for FetchContent\_Declare states The FetchContent\_Declare() function records the options that describe how to populate the specified content. If such details have already been recorded earlier in this …

---

## [MAKE\_TERMOUT environment variable causes a number of CMake generated variables to not be set correctly](https://discourse.cmake.org/t/make-termout-environment-variable-causes-a-number-of-cmake-generated-variables-to-not-be-set-correctly/15104)

<div class="topic-metadata">

**Author:** [@Amguls](https://discourse.cmake.org/u/Amguls)\
**Replies:** 4\
**Last updated:** [August 25, 2025, 3:28pm UTC](https://discourse.cmake.org/t/make-termout-environment-variable-causes-a-number-of-cmake-generated-variables-to-not-be-set-correctly/15104 "2025-08-25T15:28:56Z")

</div>

When using the Unix Makefiles generator, if the MAKE\_TERMOUT environment variable is set to a non-empty value at CMake generation time (for example, if invoking cmake from a Makefile recipe), many CMake variables are not…

---

## [Incorrect log output during clang-tidy error with -p option](https://discourse.cmake.org/t/incorrect-log-output-during-clang-tidy-error-with-p-option/15106)

<div class="topic-metadata">

**Author:** [@Detect1ve](https://discourse.cmake.org/u/Detect1ve)\
**Replies:** 3\
**Last updated:** [August 24, 2025, 10:06pm UTC](https://discourse.cmake.org/t/incorrect-log-output-during-clang-tidy-error-with-p-option/15106 "2025-08-24T22:06:18Z")

</div>

So, in continuation of issue 27160 TL;DR Using the Ninja generator, I see an incorrect command for clang-tidy launch with the -p option in case of error. Is it a problem on the Ninja side or CMake? It appears that the c…

---

## [Copy runtime DLLs on Windows working on cli but not on add\_custom\_comand](https://discourse.cmake.org/t/copy-runtime-dlls-on-windows-working-on-cli-but-not-on-add-custom-comand/15035)

<div class="topic-metadata">

**Author:** [@pablosalarolli](https://discourse.cmake.org/u/pablosalarolli)\
**Replies:** 4\
**Last updated:** [August 21, 2025, 4:03pm UTC](https://discourse.cmake.org/t/copy-runtime-dlls-on-windows-working-on-cli-but-not-on-add-custom-comand/15035 "2025-08-21T16:03:35Z")

</div>

I have a function to copy my targets runtime DLLs. function(copy\_runtime\_dlls\_at\_build \_\_targetName) if (WIN32) add\_custom\_command( TARGET ${\_\_targetName} POST\_BUILD COMMAND ${CMAKE\_C…

---

## [CMake doesn't let me use my own compiler when targeting Android](https://discourse.cmake.org/t/cmake-doesnt-let-me-use-my-own-compiler-when-targeting-android/15080)

<div class="topic-metadata">

**Author:** [@mccakit](https://discourse.cmake.org/u/mccakit)\
**Replies:** 0\
**Last updated:** [August 20, 2025, 8:52pm UTC](https://discourse.cmake.org/t/cmake-doesnt-let-me-use-my-own-compiler-when-targeting-android/15080 "2025-08-20T20:52:52Z")

</div>

When I specify sysroot, cmake tries to look for gcc compilers, which is absurd. When I specify ndk directory cmake tries to use ndk clang regardless of what input for the compilers I give, even forced cache variables do…

---

## [CPack \`REQUIRED\` in \`cpack\_add\_component\` is not working as intended with WiX](https://discourse.cmake.org/t/cpack-required-in-cpack-add-component-is-not-working-as-intended-with-wix/15074)

<div class="topic-metadata">

**Author:** [@alina](https://discourse.cmake.org/u/alina)\
**Replies:** 1\
**Last updated:** [August 19, 2025, 11:20pm UTC](https://discourse.cmake.org/t/cpack-required-in-cpack-add-component-is-not-working-as-intended-with-wix/15074 "2025-08-19T23:20:49Z")

</div>

I am passing keyword REQUIRED to cpack\_add\_component, but the component my\_lib still shows as optional with the WiX msi installer, meaning the user can still select “feature will be installed when required,” and selectin…

---

## [Possible typo in Mastering CMake - Policies section](https://discourse.cmake.org/t/possible-typo-in-mastering-cmake-policies-section/14972)

<div class="topic-metadata">

**Author:** [@james-advatek](https://discourse.cmake.org/u/james-advatek)\
**Replies:** 1\
**Last updated:** [August 19, 2025, 9:12pm UTC](https://discourse.cmake.org/t/possible-typo-in-mastering-cmake-policies-section/14972 "2025-08-19T21:12:31Z")

</div>

The “The Policy Stack” section under the Policies chapter in the Mastering CMake book refers to a command projectS. I’m not sure if this is a typo, as I couldn’t find any documentation about this command.

---

## [No CMAKE\_C\_COMPILER could be found. No CMAKE\_CXX\_COMPILER could be found.](https://discourse.cmake.org/t/no-cmake-c-compiler-could-be-found-no-cmake-cxx-compiler-could-be-found/3948)

<div class="topic-metadata">

**Author:** [@rco](https://discourse.cmake.org/u/rco)\
**Replies:** 65\
**Last updated:** [August 19, 2025, 8:54pm UTC](https://discourse.cmake.org/t/no-cmake-c-compiler-could-be-found-no-cmake-cxx-compiler-could-be-found/3948 "2025-08-19T20:54:19Z")

</div>

Hi, Long story short, I’ve been struggling with a project in both VS2017 and VS2019, with both CMake 3.18 and CMake 3.21.1. In VS2019, in the CMakeSettings.json file… If i set CMake generator to “Visual Studio 16 201…

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

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