# Usage

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

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

**Page:** 81

---

## [Where did \`--generate\` come from, and where did it go?](https://discourse.cmake.org/t/where-did-generate-come-from-and-where-did-it-go/3057)

<div class="topic-metadata">

**Author:** [@Chris](https://discourse.cmake.org/u/Chris)\
**Replies:** 3\
**Last updated:** [March 31, 2021, 6:59pm UTC](https://discourse.cmake.org/t/where-did-generate-come-from-and-where-did-it-go/3057 "2021-03-31T18:59:16Z")

</div>

I have some local build utility scripts that I use to keep different generates updated. Somehow, I wound up with this: cmake --generate \_ninja cmake --generate \_vs As a way to make sure local CMakeLists.txt changes are…

---

## [tar "--exclude" option not working](https://discourse.cmake.org/t/tar-exclude-option-not-working/3050)

<div class="topic-metadata">

**Author:** [@mb11193](https://discourse.cmake.org/u/mb11193)\
**Replies:** 2\
**Last updated:** [March 31, 2021, 6:14pm UTC](https://discourse.cmake.org/t/tar-exclude-option-not-working/3050 "2021-03-31T18:14:53Z")

</div>

I am running CMake v3.20.0 and trying to do the following: # Create .zip archive of the project add\_custom\_target( package COMMAND ${CMAKE\_COMMAND} -E tar -cfv "${PROJECT\_NAME}-source.tar" --exclude="bui…

---

## [catkin\_make is always trying to make one specific package](https://discourse.cmake.org/t/catkin-make-is-always-trying-to-make-one-specific-package/3043)

<div class="topic-metadata">

**Author:** [@MohamadHalwani](https://discourse.cmake.org/u/MohamadHalwani)\
**Replies:** 1\
**Last updated:** [March 30, 2021, 7:23pm UTC](https://discourse.cmake.org/t/catkin-make-is-always-trying-to-make-one-specific-package/3043 "2021-03-30T19:23:10Z")

</div>

I need help with this, please. The problem started when I tried making a new package in X workspace: went to the source file of X package created a new folder (Y) and an src folder in it. catkin\_make in the src folder…

---

## [How to generate a valgrind suppression file from \`ctest -D NightlyMemCheck\` command](https://discourse.cmake.org/t/how-to-generate-a-valgrind-suppression-file-from-ctest-d-nightlymemcheck-command/3037)

<div class="topic-metadata">

**Author:** [@boxerab](https://discourse.cmake.org/u/boxerab)\
**Replies:** 1\
**Last updated:** [March 29, 2021, 11:19am UTC](https://discourse.cmake.org/t/how-to-generate-a-valgrind-suppression-file-from-ctest-d-nightlymemcheck-command/3037 "2021-03-29T11:19:05Z")

</div>

Hello, I run ctest -D NightlyMemCheck on around 1800 unit tests. I would like to generate a valgrind suppression file from this command. What is the best way of doing this? For the valgrind command itself, there is --…

---

## [Unable to link CUDA device code with MPICH implementation](https://discourse.cmake.org/t/unable-to-link-cuda-device-code-with-mpich-implementation/3006)

<div class="topic-metadata">

**Author:** [@Neromaglio](https://discourse.cmake.org/u/Neromaglio)\
**Replies:** 8\
**Last updated:** [March 28, 2021, 1:42pm UTC](https://discourse.cmake.org/t/unable-to-link-cuda-device-code-with-mpich-implementation/3006 "2021-03-28T13:42:32Z")

</div>

Hello, i am struggling for compiling a code that requires both CUDA and MPI (MPICH implementation). In particular, when cmake is linking CUDA device code i get the following errors: gcc: error: unrecognized command line…

---

## [How to change toolchain without breaking developer workflows?](https://discourse.cmake.org/t/how-to-change-toolchain-without-breaking-developer-workflows/1166)

<div class="topic-metadata">

**Author:** [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)\
**Replies:** 8\
**Last updated:** [March 26, 2021, 10:35pm UTC](https://discourse.cmake.org/t/how-to-change-toolchain-without-breaking-developer-workflows/1166 "2021-03-26T22:35:58Z")

</div>

Here is the short of it. I have a toolchain. The toochain specifies these variables: CMAKE\_RC\_COMPILER=.../rc.exe CMAKE\_CXX\_COMPILER= .../cl.exe CMAKE\_C\_COMPILER= .../cl.exe etc... I update the toolchain to use a newe…

---

## [How does CMake find compilers?](https://discourse.cmake.org/t/how-does-cmake-find-compilers/3009)

<div class="topic-metadata">

**Author:** [@anon45792294](https://discourse.cmake.org/u/anon45792294)\
**Replies:** 3\
**Last updated:** [March 25, 2021, 11:49pm UTC](https://discourse.cmake.org/t/how-does-cmake-find-compilers/3009 "2021-03-25T23:49:37Z")

</div>

I’m a bit confused about the order of operations regarding finding the compilers. There are so many ways to set the compiler in CMake. You can set the environment variables CXX, CC. You can set the variables CMAKE\_C\_C…

---

## [Is there a way to show an add\_subdirectory() compile failure from a long list of add\_subdirectory() instances?](https://discourse.cmake.org/t/is-there-a-way-to-show-an-add-subdirectory-compile-failure-from-a-long-list-of-add-subdirectory-instances/3023)

<div class="topic-metadata">

**Author:** [@JRR](https://discourse.cmake.org/u/JRR)\
**Replies:** 0\
**Last updated:** [March 25, 2021, 7:41pm UTC](https://discourse.cmake.org/t/is-there-a-way-to-show-an-add-subdirectory-compile-failure-from-a-long-list-of-add-subdirectory-instances/3023 "2021-03-25T19:41:03Z")

</div>

My scenario is as follows. I have an example folder with 20+ examples in it. Each example is separated into it’s own sub-folder with it’s own CMakeLists.txt file, source/include folder, etc. Examples ├───Ex1 │ ├───in…

---

## [Generator property in presets](https://discourse.cmake.org/t/generator-property-in-presets/3010)

<div class="topic-metadata">

**Author:** [@friendlyanon](https://discourse.cmake.org/u/friendlyanon)\
**Replies:** 2\
**Last updated:** [March 25, 2021, 6:32pm UTC](https://discourse.cmake.org/t/generator-property-in-presets/3010 "2021-03-25T18:32:19Z")

</div>

I figured this would be better as a discource than an issue. Why is the generator property in the presets mandatory? This reduces the usability of presets and makes it difficult replace shell or other scripts to configu…

---

## [Preserving options with spaces in add\_compile\_options](https://discourse.cmake.org/t/preserving-options-with-spaces-in-add-compile-options/1551)

<div class="topic-metadata">

**Author:** [@kvrigor](https://discourse.cmake.org/u/kvrigor)\
**Replies:** 9\
**Last updated:** [March 24, 2021, 9:17pm UTC](https://discourse.cmake.org/t/preserving-options-with-spaces-in-add-compile-options/1551 "2021-03-24T21:17:09Z")

</div>

Hello, I have a CMake project with several targets and I wish to set global compile options through add\_compile\_options . These are the flags that I need to set: ifort icc -qno-opt-dynamic-align -qno-opt-dynami…

---

## [my.cdash.org account support?](https://discourse.cmake.org/t/my-cdash-org-account-support/2947)

<div class="topic-metadata">

**Author:** [@scivision](https://discourse.cmake.org/u/scivision)\
**Replies:** 2\
**Last updated:** [March 12, 2021, 10:38pm UTC](https://discourse.cmake.org/t/my-cdash-org-account-support/2947 "2021-03-12T22:38:18Z")

</div>

I tried emailing webmaster@cdash.org but the email bounces. Is there a means of fixing an account issue on my.cdash.org?

---

## [find\_package(Cython 0.10 REQUIRED) detects bash script called "cython", ignores version constraints](https://discourse.cmake.org/t/find-package-cython-0-10-required-detects-bash-script-called-cython-ignores-version-constraints/2996)

<div class="topic-metadata">

**Author:** [@RGDS](https://discourse.cmake.org/u/RGDS)\
**Replies:** 2\
**Last updated:** [March 24, 2021, 8:43am UTC](https://discourse.cmake.org/t/find-package-cython-0-10-required-detects-bash-script-called-cython-ignores-version-constraints/2996 "2021-03-24T08:43:20Z")

</div>

pyenv is a rather common virtualization tool in Python (15% of people that use venvs use pyenv) and it creates a global shim for every binary that is installed in any virtual env. When you are in an env that doesn’t have…

---

## [How to handle encapsulated/embedded packages?](https://discourse.cmake.org/t/how-to-handle-encapsulated-embedded-packages/2990)

<div class="topic-metadata">

**Author:** [@john-forrest](https://discourse.cmake.org/u/john-forrest)\
**Replies:** 4\
**Last updated:** [March 24, 2021, 6:09am UTC](https://discourse.cmake.org/t/how-to-handle-encapsulated-embedded-packages/2990 "2021-03-24T06:09:00Z")

</div>

This a “How do others handle this?” sort of question. The description is a bit long, but not sure how to say it that much shorter. Please bear with me. We have a reasonably mature codebase that is built using CMake and,…

---

## [cmake: check\_include\_files failing despite setting CMAKE\_REQUIRED\_INCLUDES](https://discourse.cmake.org/t/cmake-check-include-files-failing-despite-setting-cmake-required-includes/2998)

<div class="topic-metadata">

**Author:** [@s837jhc](https://discourse.cmake.org/u/s837jhc)\
**Replies:** 1\
**Last updated:** [March 23, 2021, 7:16pm UTC](https://discourse.cmake.org/t/cmake-check-include-files-failing-despite-setting-cmake-required-includes/2998 "2021-03-23T19:16:15Z")

</div>

I have the following in CMakeLists.txt: check\_include\_files("foo.h" HAVE\_FOO) Despite passing -DCMAKE\_REQUIRED\_INCLUDES=/directory/containing/fooincludefile to cmake, I still get: -- Looking for include file foo.h - n…

---

## [Unresonable checks of Linux headers, while running CMake on FreeBSD 13](https://discourse.cmake.org/t/unresonable-checks-of-linux-headers-while-running-cmake-on-freebsd-13/2539)

<div class="topic-metadata">

**Author:** [@Ivan\_Serdyuk](https://discourse.cmake.org/u/Ivan_Serdyuk)\
**Replies:** 3\
**Last updated:** [March 23, 2021, 6:54am UTC](https://discourse.cmake.org/t/unresonable-checks-of-linux-headers-while-running-cmake-on-freebsd-13/2539 "2021-03-23T06:54:01Z")

</div>

Hello. I am experiencing some inappropriate behavior of CMake (apparently cause of both lack of platform specific patch and due to a need to re-write project specific build rules). Some headers have no sense on BSD sys…

---

## [C++ CMake Debug Configuration (Visual Studio 2019)](https://discourse.cmake.org/t/c-cmake-debug-configuration-visual-studio-2019/2983)

<div class="topic-metadata">

**Author:** [@CppForMe](https://discourse.cmake.org/u/CppForMe)\
**Replies:** 3\
**Last updated:** [March 21, 2021, 4:50pm UTC](https://discourse.cmake.org/t/c-cmake-debug-configuration-visual-studio-2019/2983 "2021-03-21T16:50:00Z")

</div>

Hi Folks, I asked this question in the MSDN forum thinking it’s how Visual Studio deals with release/debug configuration specifically rather than a generic CMake thing. I also don’t think its a googletest specific thing…

---

## [CMAKE graphical interface](https://discourse.cmake.org/t/cmake-graphical-interface/2978)

<div class="topic-metadata">

**Author:** [@Henry\_Guaman](https://discourse.cmake.org/u/Henry_Guaman)\
**Replies:** 8\
**Last updated:** [March 19, 2021, 4:19pm UTC](https://discourse.cmake.org/t/cmake-graphical-interface/2978 "2021-03-19T16:19:39Z")

</div>

Excuse me, I’m new to this from CMAKE. I have installed it normally, but I cannot access the graphical interface. Thanks in advance.

---

## [Use of file(COPY) to copy scripts to build directory](https://discourse.cmake.org/t/use-of-file-copy-to-copy-scripts-to-build-directory/2976)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 2\
**Last updated:** [March 19, 2021, 2:56pm UTC](https://discourse.cmake.org/t/use-of-file-copy-to-copy-scripts-to-build-directory/2976 "2021-03-19T14:56:55Z")

</div>

We have a CMake project that builds a C++ app on Windows and Linux. Currently, at runtime, the developer/user needs to run some scripts from the source tree before running the app from the build directory. It has been s…

---

## [Is there no way to load a project into CMake GUI?](https://discourse.cmake.org/t/is-there-no-way-to-load-a-project-into-cmake-gui/2896)

<div class="topic-metadata">

**Author:** [@Stokestack](https://discourse.cmake.org/u/Stokestack)\
**Replies:** 9\
**Last updated:** [March 19, 2021, 12:37am UTC](https://discourse.cmake.org/t/is-there-no-way-to-load-a-project-into-cmake-gui/2896 "2021-03-19T00:37:45Z")

</div>

Hi all. Just getting started with CMake (in Qt 5). I was happy to discover that there’s an official GUI for CMake, but disappointed to find that there’s no apparent way to load a CMakeLists.txt file into it. Is that tru…

---

## [Conflicting docs on source package parameters](https://discourse.cmake.org/t/conflicting-docs-on-source-package-parameters/2968)

<div class="topic-metadata">

**Author:** [@jwuttke](https://discourse.cmake.org/u/jwuttke)\
**Replies:** 1\
**Last updated:** [March 17, 2021, 2:57pm UTC](https://discourse.cmake.org/t/conflicting-docs-on-source-package-parameters/2968 "2021-03-17T14:57:21Z")

</div>

CPack has a section on »Variables for Source Package Generators«. These variables start with CPACK\_SOURCE\_. CPack Archive Generator has a section on »Variables specific to CPack Archive generator«. These variables start…

---

## [Is 3.18.6 pre-compiled?](https://discourse.cmake.org/t/is-3-18-6-pre-compiled/2967)

<div class="topic-metadata">

**Author:** [@JoeAB](https://discourse.cmake.org/u/JoeAB)\
**Replies:** 2\
**Last updated:** [March 17, 2021, 2:56pm UTC](https://discourse.cmake.org/t/is-3-18-6-pre-compiled/2967 "2021-03-17T14:56:11Z")

</div>

I downloaded cmake-3.18.6-Linux-x86\_64.sh and ran it as ./cmake-3.18.6-Linux-x86\_64.sh. I also downloaded cmake-3.18.6-Linux-x86\_64.tar.gz and upacked it. Both gave me a directory that included bin/, doc/, man/ and share…

---

## [add\_subdirectory vs ExternalProject\_Add vs include(path/to/ProjectConfig.cmake)](https://discourse.cmake.org/t/add-subdirectory-vs-externalproject-add-vs-include-path-to-projectconfig-cmake/2959)

<div class="topic-metadata">

**Author:** [@TomzBench](https://discourse.cmake.org/u/TomzBench)\
**Replies:** 2\
**Last updated:** [March 17, 2021, 12:25pm UTC](https://discourse.cmake.org/t/add-subdirectory-vs-externalproject-add-vs-include-path-to-projectconfig-cmake/2959 "2021-03-17T12:25:21Z")

</div>

Hello all, I’m having trouble distinguishing the best way to include dependencies. Ultimately I would like to be able to do find my dependencies in the CMAKE\_INSTALL\_PREFIX and make sure to have reproducible builds and…

---

## [A very simple question](https://discourse.cmake.org/t/a-very-simple-question/2961)

<div class="topic-metadata">

**Author:** [@Sequoia](https://discourse.cmake.org/u/Sequoia)\
**Replies:** 7\
**Last updated:** [March 16, 2021, 8:03pm UTC](https://discourse.cmake.org/t/a-very-simple-question/2961 "2021-03-16T20:03:53Z")

</div>

I have a simple, simple Hello World main() function in C++ It is called Katz.?? It is a simple file just 5 lines long. Katz.cpp What can CMake do with it? Compile it? Make a “Makefile” for it? Nowhere can I find a cl…

---

## [Understanding CMake versions](https://discourse.cmake.org/t/understanding-cmake-versions/2955)

<div class="topic-metadata">

**Author:** [@Michael\_Loutris](https://discourse.cmake.org/u/Michael_Loutris)\
**Replies:** 1\
**Last updated:** [March 13, 2021, 11:12pm UTC](https://discourse.cmake.org/t/understanding-cmake-versions/2955 "2021-03-13T23:12:43Z")

</div>

There are a number of people that are trying to get wxWidgets built and integrated with CodeBlocks. Due to poor documentation, several of us have been led to a video by Yanson Tech who uses CMake as part of the process.…

---

## [Correct linkage library name generation for TI compilers](https://discourse.cmake.org/t/correct-linkage-library-name-generation-for-ti-compilers/1910)

<div class="topic-metadata">

**Author:** [@AJIOB](https://discourse.cmake.org/u/AJIOB)\
**Replies:** 3\
**Last updated:** [March 13, 2021, 5:30pm UTC](https://discourse.cmake.org/t/correct-linkage-library-name-generation-for-ti-compilers/1910 "2021-03-13T17:30:37Z")

</div>

Hello I’m using TI ARM CGT and TI C6000 CGT. After calling link\_libraries function (by myself or by conan tool) for linking mylibrary lib, linker flag --library=mylibrary was generated. But that two compilers (and I t…

---

## [CMake commands cause project build to walk entire drive.](https://discourse.cmake.org/t/cmake-commands-cause-project-build-to-walk-entire-drive/2913)

<div class="topic-metadata">

**Author:** [@alecazam](https://discourse.cmake.org/u/alecazam)\
**Replies:** 3\
**Last updated:** [March 13, 2021, 3:53am UTC](https://discourse.cmake.org/t/cmake-commands-cause-project-build-to-walk-entire-drive/2913 "2021-03-13T03:53:18Z")

</div>

These lines sent Cmake into a lengthy walk of the entire drive when trying to build a project, see if you can spot the mistake. I’ll post the answer in a bit, but seems like an easy mistake to make and that should be ca…

---

## [Custom command OUTPUTS not added to OBJECT Library's TARGET\_OBJECTS](https://discourse.cmake.org/t/custom-command-outputs-not-added-to-object-librarys-target-objects/2946)

<div class="topic-metadata">

**Author:** [@riggs](https://discourse.cmake.org/u/riggs)\
**Replies:** 2\
**Last updated:** [March 12, 2021, 11:03pm UTC](https://discourse.cmake.org/t/custom-command-outputs-not-added-to-object-librarys-target-objects/2946 "2021-03-12T23:03:43Z")

</div>

I have add\_custom\_command running objcopy to make some json files linkable. The object files get generated correctly, but when I pass a list of them to add\_library(jsons OBJECT ${OUTPUT\_FILES}), they don’t seem to get ad…

---

## [Cmake installation issue](https://discourse.cmake.org/t/cmake-installation-issue/2942)

<div class="topic-metadata">

**Author:** [@ComputerU](https://discourse.cmake.org/u/ComputerU)\
**Replies:** 3\
**Last updated:** [March 11, 2021, 7:36pm UTC](https://discourse.cmake.org/t/cmake-installation-issue/2942 "2021-03-11T19:36:25Z")

</div>

Hi, I’m trying to install cmake on my ubuntu 20.04 VM. I tried to install cmake manually by downloading the tar, and running through the installation. However, when i use apt-cache policy cmake, my machine says I don’t …

---

## [How to ensure the recursed package location is in the same as its above](https://discourse.cmake.org/t/how-to-ensure-the-recursed-package-location-is-in-the-same-as-its-above/2938)

<div class="topic-metadata">

**Author:** [@abd](https://discourse.cmake.org/u/abd)\
**Replies:** 1\
**Last updated:** [March 11, 2021, 6:09pm UTC](https://discourse.cmake.org/t/how-to-ensure-the-recursed-package-location-is-in-the-same-as-its-above/2938 "2021-03-11T18:09:09Z")

</div>

Is it automatically the default that a package location of recursive dependency is in the same as its dependent package above or we have to ensure, i.e. tell/instruct Cmake, to refer the recursed dependency package locat…

---

## [MSVC Custom Toolchain: CMAKE\_\<LANG\>\_STANDARD\_COMPUTED\_DEFAULT](https://discourse.cmake.org/t/msvc-custom-toolchain-cmake-lang-standard-computed-default/2936)

<div class="topic-metadata">

**Author:** [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)\
**Replies:** 1\
**Last updated:** [March 11, 2021, 5:52pm UTC](https://discourse.cmake.org/t/msvc-custom-toolchain-cmake-lang-standard-computed-default/2936 "2021-03-11T17:52:41Z")

</div>

Currently in our MSVC toolchain we need to specify the following variables in our toolchain: if (${CMAKE\_CXX\_COMPILER\_VERSION} VERSION\_GREATER "19.0") set(CMAKE\_CXX\_STANDARD\_COMPUTED\_DEFAULT "14" CACHE INTE…

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

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