# Usage

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

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

**Page:** 68

---

## [what is preset's installDir](https://discourse.cmake.org/t/what-is-presets-installdir/4907)

<div class="topic-metadata">

**Author:** [@redbaron](https://discourse.cmake.org/u/redbaron)\
**Replies:** 4\
**Last updated:** [February 2, 2022, 3:30pm UTC](https://discourse.cmake.org/t/what-is-presets-installdir/4907 "2022-02-02T15:30:31Z")

</div>

I am switching to presets and can’t figure out how to use installDir. Is it the same or different than CMAKE\_INSTALL\_PREFIX? I have "installDir": "out/${presetName}" , but it still tries to install to the default CMAKE\_…

---

## [Using CMAKE\_CROSSCOMPILING evaluates to FALSE after -DCMAKE\_CROSSCOMPILING=ON](https://discourse.cmake.org/t/using-cmake-crosscompiling-evaluates-to-false-after-dcmake-crosscompiling-on/4911)

<div class="topic-metadata">

**Author:** [@agostini01](https://discourse.cmake.org/u/agostini01)\
**Replies:** 2\
**Last updated:** [February 1, 2022, 5:46pm UTC](https://discourse.cmake.org/t/using-cmake-crosscompiling-evaluates-to-false-after-dcmake-crosscompiling-on/4911 "2022-02-01T17:46:37Z")

</div>

Hi, I am scratching my head trying to find out why checks with if(CMAKE\_CROSSCOMPILING) return false (running cmake version 3.18.2). I am trying to cross compile pieces of the llvm-project with the following command-lin…

---

## [Examples of ExternalProject](https://discourse.cmake.org/t/examples-of-externalproject/4687)

<div class="topic-metadata">

**Author:** [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)\
**Replies:** 2\
**Last updated:** [February 1, 2022, 4:19pm UTC](https://discourse.cmake.org/t/examples-of-externalproject/4687 "2022-02-01T16:19:49Z")

</div>

We need to incorporate a project that isn’t fully conducive to add\_subdirectory. This project is intended to be installed and found using find\_package. My understanding is we should use ExternalProject to add the project…

---

## [Difficulty with add\_executable() with generated files](https://discourse.cmake.org/t/difficulty-with-add-executable-with-generated-files/4921)

<div class="topic-metadata">

**Author:** [@Nicholas\_Yue](https://discourse.cmake.org/u/Nicholas_Yue)\
**Replies:** 8\
**Last updated:** [January 31, 2022, 4:55pm UTC](https://discourse.cmake.org/t/difficulty-with-add-executable-with-generated-files/4921 "2022-01-31T16:55:29Z")

</div>

The files does not get created in time to be included in add\_executable() What do I need to modify to get the files generation target run before add\_executable so that ${generated\_files} via file GLOB\_RECURSE have files…

---

## [does the IDE write to preset files?](https://discourse.cmake.org/t/does-the-ide-write-to-preset-files/4932)

<div class="topic-metadata">

**Author:** [@hex](https://discourse.cmake.org/u/hex)\
**Replies:** 0\
**Last updated:** [January 29, 2022, 8:19pm UTC](https://discourse.cmake.org/t/does-the-ide-write-to-preset-files/4932 "2022-01-29T20:19:38Z")

</div>

in the IDE integration guide about presets it reads: IDE vendors are encouraged to read and evaluate this file the same way CMake does, and present the user with the presets listed in the file. Users should be able to …

---

## [CMake and MPI Fortran: CMake doesn't see it](https://discourse.cmake.org/t/cmake-and-mpi-fortran-cmake-doesnt-see-it/4869)

<div class="topic-metadata">

**Author:** [@mathomp4](https://discourse.cmake.org/u/mathomp4)\
**Replies:** 13\
**Last updated:** [January 28, 2022, 5:19pm UTC](https://discourse.cmake.org/t/cmake-and-mpi-fortran-cmake-doesnt-see-it/4869 "2022-01-28T17:19:15Z")

</div>

All, This is a weird one. So for reasons unknown to me, when I’m building Open MPI with NAG Fortran and Clang on my MacBook, I need to do it as a static library. I know, I know…I don’t like that either, but even MPICH f…

---

## [how to disable CMake color for stderr?](https://discourse.cmake.org/t/how-to-disable-cmake-color-for-stderr/4923)

<div class="topic-metadata">

**Author:** [@hex](https://discourse.cmake.org/u/hex)\
**Replies:** 1\
**Last updated:** [January 28, 2022, 2:30pm UTC](https://discourse.cmake.org/t/how-to-disable-cmake-color-for-stderr/4923 "2022-01-28T14:30:14Z")

</div>

how do i disable colour for CMake’s stderr? My terminal doesn’t support colour.

---

## [Sublime Text + ninja multi config support](https://discourse.cmake.org/t/sublime-text-ninja-multi-config-support/4863)

<div class="topic-metadata">

**Author:** [@ratatouille](https://discourse.cmake.org/u/ratatouille)\
**Replies:** 5\
**Last updated:** [January 27, 2022, 11:27pm UTC](https://discourse.cmake.org/t/sublime-text-ninja-multi-config-support/4863 "2022-01-27T23:27:50Z")

</div>

Hey is sublime text2 + ninja multi config generator possible ? Really appreciated if added

---

## [Link errors on iOS](https://discourse.cmake.org/t/link-errors-on-ios/4915)

<div class="topic-metadata">

**Author:** [@fabiop](https://discourse.cmake.org/u/fabiop)\
**Replies:** 0\
**Last updated:** [January 27, 2022, 7:50am UTC](https://discourse.cmake.org/t/link-errors-on-ios/4915 "2022-01-27T07:50:56Z")

</div>

Hi, I have a strange issue on iOS platform. I have a C++ framework whose project file is generated via CMake. This project file is then manually added as dependency to a very simple iOS Bundle (we do this in order to t…

---

## [Is it possible to link and external library from my project in CMake](https://discourse.cmake.org/t/is-it-possible-to-link-and-external-library-from-my-project-in-cmake/4912)

<div class="topic-metadata">

**Author:** [@SHOAR](https://discourse.cmake.org/u/SHOAR)\
**Replies:** 1\
**Last updated:** [January 26, 2022, 10:20pm UTC](https://discourse.cmake.org/t/is-it-possible-to-link-and-external-library-from-my-project-in-cmake/4912 "2022-01-26T22:20:10Z")

</div>

Hello, I have a C project using National Instrument library (through visa.lib/dll and visa.h). I am implementing unit test on it (googletest). My unit test is testing a function that calls a NI visa function (viClose(…

---

## [Googletest CMAKE using library including library !](https://discourse.cmake.org/t/googletest-cmake-using-library-including-library/4902)

<div class="topic-metadata">

**Author:** [@SHOAR](https://discourse.cmake.org/u/SHOAR)\
**Replies:** 6\
**Last updated:** [January 26, 2022, 7:09am UTC](https://discourse.cmake.org/t/googletest-cmake-using-library-including-library/4902 "2022-01-26T07:09:56Z")

</div>

Hello, I do have the following workspace structure structure C:/Workspace/Project1 C:/Workspace/Project1/file1.c C:/Workspace/Project1/file1.h C:/Workspace/Project1/unit\_test.cpp C:/Workspace/externalLib/ C:/Works…

---

## [How to use CMAKE\_SYSTEM\_PROCESSOR policy?](https://discourse.cmake.org/t/how-to-use-cmake-system-processor-policy/4906)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 1\
**Last updated:** [January 25, 2022, 4:22pm UTC](https://discourse.cmake.org/t/how-to-use-cmake-system-processor-policy/4906 "2022-01-25T16:22:19Z")

</div>

There is a discussion in the following link about how CMAKE\_SYSTEM\_PROCESSOR is restrictive for armclang (it adds --cpu flag which may not be wanted). https://gitlab.kitware.com/cmake/cmake/-/issues/21173 Apparently th…

---

## [Visual Studio remote development with CMake - nothing happens when reopening the project](https://discourse.cmake.org/t/visual-studio-remote-development-with-cmake-nothing-happens-when-reopening-the-project/4900)

<div class="topic-metadata">

**Author:** [@hugo](https://discourse.cmake.org/u/hugo)\
**Replies:** 1\
**Last updated:** [January 25, 2022, 9:24am UTC](https://discourse.cmake.org/t/visual-studio-remote-development-with-cmake-nothing-happens-when-reopening-the-project/4900 "2022-01-25T09:24:46Z")

</div>

I’m using Visual Studio to connect to a docker container via SSH for remote development using CMake as the build system. When Visual Studio launches the project for the first time or a CMakeLists.txt file has been alter…

---

## [How to specify executable file type for ARM?](https://discourse.cmake.org/t/how-to-specify-executable-file-type-for-arm/4896)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 2\
**Last updated:** [January 24, 2022, 9:47pm UTC](https://discourse.cmake.org/t/how-to-specify-executable-file-type-for-arm/4896 "2022-01-24T21:47:27Z")

</div>

My CMake project for ARM Cortex-M4 contains: project(CMSIS-RTOS2\_Blinky) set(EXECUTABLE ${PROJECT\_NAME}) The generated executable is: CMSIS-RTOS2\_Blinky.elf Is it possible to specify that the executable file type sho…

---

## [How to specify Assembler options for ARM?](https://discourse.cmake.org/t/how-to-specify-assembler-options-for-arm/4897)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 0\
**Last updated:** [January 24, 2022, 6:51pm UTC](https://discourse.cmake.org/t/how-to-specify-assembler-options-for-arm/4897 "2022-01-24T18:51:09Z")

</div>

My CMake project for ARM Cortex-M4 contains: set(CMAKE\_ASM\_FLAGS "") set\_property(SOURCE ${RTX\_SOURCE\_PATH}/GCC/irq\_armv7m.S APPEND PROPERTY COMPILE\_OPTIONS "--target=arm-arm-none-eabi" "-x" "assembler-with-cpp" "-g" "-…

---

## [Issue with tests timing out way sooner than what their TIMEOUT property says](https://discourse.cmake.org/t/issue-with-tests-timing-out-way-sooner-than-what-their-timeout-property-says/4885)

<div class="topic-metadata">

**Author:** [@Marc\_Legendre](https://discourse.cmake.org/u/Marc_Legendre)\
**Replies:** 2\
**Last updated:** [January 23, 2022, 5:51pm UTC](https://discourse.cmake.org/t/issue-with-tests-timing-out-way-sooner-than-what-their-timeout-property-says/4885 "2022-01-23T17:51:30Z")

</div>

Hi there, We are running into an issue with ctest, where tests can time out after running for a time way shorter than their TIMEOUT property, sometimes as soon as a few seconds after starting. We are hitting this only …

---

## [fixup\_bundle does not copy files over ?](https://discourse.cmake.org/t/fixup-bundle-does-not-copy-files-over/4886)

<div class="topic-metadata">

**Author:** [@Nicholas\_Yue](https://discourse.cmake.org/u/Nicholas_Yue)\
**Replies:** 0\
**Last updated:** [January 22, 2022, 1:08am UTC](https://discourse.cmake.org/t/fixup-bundle-does-not-copy-files-over/4886 "2022-01-22T01:08:35Z")

</div>

I am trying to package up (cmake+cpack) a simple Qt application I see that fixup bundle is being provided with the relevant information but it does not seems to want to copy the \*.so file to the packing location that …

---

## [Building Documentation with Doxygen, the modular CMake way?](https://discourse.cmake.org/t/building-documentation-with-doxygen-the-modular-cmake-way/4823)

<div class="topic-metadata">

**Author:** [@Erik\_Rainey](https://discourse.cmake.org/u/Erik_Rainey)\
**Replies:** 5\
**Last updated:** [January 19, 2022, 4:13pm UTC](https://discourse.cmake.org/t/building-documentation-with-doxygen-the-modular-cmake-way/4823 "2022-01-19T16:13:12Z")

</div>

Is there a guide on writing your doxygen generation with the Modern CMake approach? I’d like to not have to re-write all the include paths and #defines a second time in the doxygen call, I’d like to be able to get those …

---

## [How is TOOLCHAIN\_LD used?](https://discourse.cmake.org/t/how-is-toolchain-ld-used/4841)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 5\
**Last updated:** [January 16, 2022, 6:01pm UTC](https://discourse.cmake.org/t/how-is-toolchain-ld-used/4841 "2022-01-16T18:01:41Z")

</div>

I am using the GNU ARM toolchain to cross-compile an ARM Cortex-M4 application on Windows. In my toolchain file I have: get\_filename\_component(TOOLCHAIN ${CROSS\_GCC\_PATH} PATH) set(CMAKE\_C\_COMPILER ${TOOLCHAIN}/arm-non…

---

## [Generate fIle-api query files from CMake](https://discourse.cmake.org/t/generate-file-api-query-files-from-cmake/3183)

<div class="topic-metadata">

**Author:** [@thefifo](https://discourse.cmake.org/u/thefifo)\
**Replies:** 6\
**Last updated:** [January 14, 2022, 5:31pm UTC](https://discourse.cmake.org/t/generate-file-api-query-files-from-cmake/3183 "2022-01-14T17:31:23Z")

</div>

Hello, Is it possible to generate a file-api query file during a CMake configure? I tried to generate the query file from within my toolchain file or even in the CMakeLists.txt file before the project statement. However…

---

## [File API: Is it okay to clean \`.cmake\` directory?](https://discourse.cmake.org/t/file-api-is-it-okay-to-clean-cmake-directory/4840)

<div class="topic-metadata">

**Author:** [@Semyon\_Kolton](https://discourse.cmake.org/u/Semyon_Kolton)\
**Replies:** 2\
**Last updated:** [January 13, 2022, 9:12pm UTC](https://discourse.cmake.org/t/file-api-is-it-okay-to-clean-cmake-directory/4840 "2022-01-13T21:12:21Z")

</div>

Currently, documentation for CMake File API states: CMake owns all reply files. Clients must never remove them. Why is that? What would happen if client would clear this directory? E.g. suppose IDE wants to clear ca…

---

## [CMAKE\_XXX\_OUTPUT\_DIRECTORY vs. target properties XXX\_OUTPUT\_DIRECTORY](https://discourse.cmake.org/t/cmake-xxx-output-directory-vs-target-properties-xxx-output-directory/4187)

<div class="topic-metadata">

**Author:** [@petermbauer](https://discourse.cmake.org/u/petermbauer)\
**Replies:** 4\
**Last updated:** [January 13, 2022, 7:43am UTC](https://discourse.cmake.org/t/cmake-xxx-output-directory-vs-target-properties-xxx-output-directory/4187 "2022-01-13T07:43:47Z")

</div>

Hello, my goal is to use the CMAKE\_XXX\_OUTPUT\_DIRECTORY variables to set the default location for the built binaries and use the respective target property XXX\_OUTPUT\_DIRECTORY (e.g. LIBRARY\_OUTPUT\_DIRECTORY) for specif…

---

## [How to automatically checkout git repository after FetchContent\_MakeAvailable](https://discourse.cmake.org/t/how-to-automatically-checkout-git-repository-after-fetchcontent-makeavailable/4807)

<div class="topic-metadata">

**Author:** [@zhang-qiang-github](https://discourse.cmake.org/u/zhang-qiang-github)\
**Replies:** 1\
**Last updated:** [January 10, 2022, 9:58am UTC](https://discourse.cmake.org/t/how-to-automatically-checkout-git-repository-after-fetchcontent-makeavailable/4807 "2022-01-10T09:58:12Z")

</div>

I am using FetchContent\_MakeAvailable in my project, and the code is: include(FetchContent) FetchContent\_Declare(opencv GIT\_REPOSITORY "https://github.com/opencv/opencv.git" GIT\_TAG "origin/master" SOURCE\_DIR "${C…

---

## [POCO: can not set the postfix](https://discourse.cmake.org/t/poco-can-not-set-the-postfix/4793)

<div class="topic-metadata">

**Author:** [@zhang-qiang-github](https://discourse.cmake.org/u/zhang-qiang-github)\
**Replies:** 6\
**Last updated:** [January 9, 2022, 3:32pm UTC](https://discourse.cmake.org/t/poco-can-not-set-the-postfix/4793 "2022-01-09T15:32:10Z")

</div>

I am using CMake to build POCO, and it suceed. Then, I want to install it. Befor installation, I want to set the postfix: I set CMAKE\_RELWITHDEBINFO\_POSTFIX as from " " to “rd”, then configure again. The stranger t…

---

## [trouble with interface targets](https://discourse.cmake.org/t/trouble-with-interface-targets/4796)

<div class="topic-metadata">

**Author:** [@Django1](https://discourse.cmake.org/u/Django1)\
**Replies:** 0\
**Last updated:** [January 8, 2022, 5:04am UTC](https://discourse.cmake.org/t/trouble-with-interface-targets/4796 "2022-01-08T05:04:52Z")

</div>

Hi, I just built cmake from repository and it does behave like 3.18 - no include directories are used from that interface targets. Do I have to specify some CMP-numbers or how can I get the described behaviour?

---

## [Problem with find\_program, HINTS and ENV](https://discourse.cmake.org/t/problem-with-find-program-hints-and-env/4794)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 3\
**Last updated:** [January 7, 2022, 2:28pm UTC](https://discourse.cmake.org/t/problem-with-find-program-hints-and-env/4794 "2022-01-07T14:28:44Z")

</div>

I’m running cmake 3.20.2 on Windows 10 and trying to use find\_program to find arm-none-eabi-gcc.exe: # Find the path of arm-none-eabi-gcc.exe set (SUFFIX .exe) set(CMAKE\_FIND\_DEBUG\_MODE TRUE) find\_program(CROSS\_GCC\_PATH…

---

## [scp fails in post build command](https://discourse.cmake.org/t/scp-fails-in-post-build-command/4795)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 3\
**Last updated:** [January 7, 2022, 2:02pm UTC](https://discourse.cmake.org/t/scp-fails-in-post-build-command/4795 "2022-01-07T14:02:05Z")

</div>

I’m running cmake 3.20.2 on Windows 10 and trying to call scp to copy an artefact to a remote machine after a successful build: add\_custom\_command( TARGET wdt\_interrupt\_gnu POST\_BUILD COMMAND ${CMAKE\_OBJCOPY…

---

## [How to find current INTERFACE library property whitelist?](https://discourse.cmake.org/t/how-to-find-current-interface-library-property-whitelist/4784)

<div class="topic-metadata">

**Author:** [@MathiasMagnus](https://discourse.cmake.org/u/MathiasMagnus)\
**Replies:** 1\
**Last updated:** [January 7, 2022, 1:54am UTC](https://discourse.cmake.org/t/how-to-find-current-interface-library-property-whitelist/4784 "2022-01-07T01:54:43Z")

</div>

I have a project where instead of meddling with global state for cleanness sake I inherit a common set of target properties via an INTERFACE library, including C\_EXTENSIONS and CXX\_EXTENSIONS, however I get the CMake Er…

---

## [cmake creates corrupt binaries](https://discourse.cmake.org/t/cmake-creates-corrupt-binaries/4772)

<div class="topic-metadata">

**Author:** [@DjangoReinhard](https://discourse.cmake.org/u/DjangoReinhard)\
**Replies:** 11\
**Last updated:** [January 6, 2022, 8:08am UTC](https://discourse.cmake.org/t/cmake-creates-corrupt-binaries/4772 "2022-01-06T08:08:54Z")

</div>

Hello, I was overjoyed when my cmake experiment finally built all subprojects successfully. Well - I thought that everything would be fine, since there were no translation errors - but unfortunately that is not the c…

---

## [misunderstanding interface library?](https://discourse.cmake.org/t/misunderstanding-interface-library/4777)

<div class="topic-metadata">

**Author:** [@Django1](https://discourse.cmake.org/u/Django1)\
**Replies:** 8\
**Last updated:** [January 6, 2022, 5:41am UTC](https://discourse.cmake.org/t/misunderstanding-interface-library/4777 "2022-01-06T05:41:26Z")

</div>

Hi, I tried to use interface library definition. May be my understanding is wrong. I thought, I could use an interface library as a virtual target which declares include directories and used libraries … So that a too…

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

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