# Usage

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

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

**Page:** 77

---

## [protobuf\_generate\_cpp and fetchedconttent](https://discourse.cmake.org/t/protobuf-generate-cpp-and-fetchedconttent/3644)

<div class="topic-metadata">

**Author:** [@wannamak](https://discourse.cmake.org/u/wannamak)\
**Replies:** 5\
**Last updated:** [June 28, 2021, 11:33pm UTC](https://discourse.cmake.org/t/protobuf-generate-cpp-and-fetchedconttent/3644 "2021-06-28T23:33:59Z")

</div>

Is it possible to FetchContent\_Declare and FetchContent\_MakeAvailable a Google protocol buffers version, then have find\_package(Protobuf) use the resulting built protoc and libraries? If I force find\_package to use the …

---

## [Checking for empty string doesn't work as expected](https://discourse.cmake.org/t/checking-for-empty-string-doesnt-work-as-expected/3639)

<div class="topic-metadata">

**Author:** [@zaufi](https://discourse.cmake.org/u/zaufi)\
**Replies:** 4\
**Last updated:** [June 28, 2021, 1:58pm UTC](https://discourse.cmake.org/t/checking-for-empty-string-doesnt-work-as-expected/3639 "2021-06-28T13:58:21Z")

</div>

Hi, I’ve faced w/ contr-intuitive behavior when trying to check for empty string: cmake\_policy(VERSION 3.20) message(STATUS "ENABLE\_LIBCXX=\`${ENABLE\_LIBCXX}\`") if(NOT ENABLE\_LIBCXX STREQUAL "") list(APPEND \_extra\_a…

---

## [Install components with presets](https://discourse.cmake.org/t/install-components-with-presets/3590)

<div class="topic-metadata">

**Author:** [@KUGA2](https://discourse.cmake.org/u/KUGA2)\
**Replies:** 2\
**Last updated:** [June 27, 2021, 3:49pm UTC](https://discourse.cmake.org/t/install-components-with-presets/3590 "2021-06-27T15:49:59Z")

</div>

I usually install components with: cmake -DCOMPONENT=componentA -P cmake\_install.cmake With workdir in Build dir (specified in configure call) With presets, the Build dir is burried somewhere in the CMakePresets.json …

---

## [Could NOT find OpenCascade (missing: OPENCASCADE\_LIBRARIES)](https://discourse.cmake.org/t/could-not-find-opencascade-missing-opencascade-libraries/3627)

<div class="topic-metadata">

**Author:** [@Marc\_Weber](https://discourse.cmake.org/u/Marc_Weber)\
**Replies:** 1\
**Last updated:** [June 25, 2021, 4:56pm UTC](https://discourse.cmake.org/t/could-not-find-opencascade-missing-opencascade-libraries/3627 "2021-06-25T16:56:21Z")

</div>

Hello, I am trying to compile OCP. find\_package\_handle\_standard\_args( OpenCascade DEFAULT\_MSG OPENCASCADE\_LIBRARIES OPENCASCADE\_INCLUDE\_DIR ) I try using -DOPENCASCADE\_LIBRARIES= … but still I get the message. With d…

---

## [is CMake a good alternative for general project task automation](https://discourse.cmake.org/t/is-cmake-a-good-alternative-for-general-project-task-automation/3416)

<div class="topic-metadata">

**Author:** [@malmbergoe](https://discourse.cmake.org/u/malmbergoe)\
**Replies:** 4\
**Last updated:** [June 25, 2021, 12:00pm UTC](https://discourse.cmake.org/t/is-cmake-a-good-alternative-for-general-project-task-automation/3416 "2021-06-25T12:00:24Z")

</div>

Hello Forum! I am quite a new user of cmake, but I have pretty good experience with gradle and maven. When googling around for cmake capabilities, most resources I find are focused on fulfilling different aspects of bu…

---

## [Aggregating Build Information across the entire configure step](https://discourse.cmake.org/t/aggregating-build-information-across-the-entire-configure-step/3622)

<div class="topic-metadata">

**Author:** [@Zachary\_Turner](https://discourse.cmake.org/u/Zachary_Turner)\
**Replies:** 3\
**Last updated:** [June 24, 2021, 8:13pm UTC](https://discourse.cmake.org/t/aggregating-build-information-across-the-entire-configure-step/3622 "2021-06-24T20:13:25Z")

</div>

We have multiple different ways this arises, but one example is that we don’t use ctest. Instead, we have an in-house testing framework that serves a similar purpose. Our list files specify test executables via a custo…

---

## [Most correct way to deal with a header that configures a source library?](https://discourse.cmake.org/t/most-correct-way-to-deal-with-a-header-that-configures-a-source-library/3611)

<div class="topic-metadata">

**Author:** [@apullin](https://discourse.cmake.org/u/apullin)\
**Replies:** 1\
**Last updated:** [June 23, 2021, 3:14pm UTC](https://discourse.cmake.org/t/most-correct-way-to-deal-with-a-header-that-configures-a-source-library/3611 "2021-06-23T15:14:27Z")

</div>

Hi all. I had a question about what the most correct way to approach a source code arrangement that I encounter now and again, and how to deal with it in cmake. I am trying to self-educate on CMake after having a fair …

---

## [Compile unit test natively and cross compile code for embedded target](https://discourse.cmake.org/t/compile-unit-test-natively-and-cross-compile-code-for-embedded-target/3607)

<div class="topic-metadata">

**Author:** [@murtiko](https://discourse.cmake.org/u/murtiko)\
**Replies:** 1\
**Last updated:** [June 23, 2021, 8:47am UTC](https://discourse.cmake.org/t/compile-unit-test-natively-and-cross-compile-code-for-embedded-target/3607 "2021-06-23T08:47:35Z")

</div>

Hello, I am working on a project for an embedded MCU (STM32). And I am trying to set up unit testing with googletest which builds and runs natively. How can I build these two with one single cmake --build command? I…

---

## [The bug that was pushed to discourse. Libtiff not being included in link.txt despite pkg-config providing clear indication of how to include it.](https://discourse.cmake.org/t/the-bug-that-was-pushed-to-discourse-libtiff-not-being-included-in-link-txt-despite-pkg-config-providing-clear-indication-of-how-to-include-it/3609)

<div class="topic-metadata">

**Author:** [@makingglitches](https://discourse.cmake.org/u/makingglitches)\
**Replies:** 0\
**Last updated:** [June 22, 2021, 6:41pm UTC](https://discourse.cmake.org/t/the-bug-that-was-pushed-to-discourse-libtiff-not-being-included-in-link-txt-despite-pkg-config-providing-clear-indication-of-how-to-include-it/3609 "2021-06-22T18:41:35Z")

</div>

The github issue is included down below. Please also feel free to view the amazingly long out.txt attached. link.txt does not include -l option for library cmake indicated was found. Specifically the tiff library which…

---

## [Macro expansion for binaryDir in CMakePresets.json](https://discourse.cmake.org/t/macro-expansion-for-binarydir-in-cmakepresets-json/3591)

<div class="topic-metadata">

**Author:** [@KUGA2](https://discourse.cmake.org/u/KUGA2)\
**Replies:** 1\
**Last updated:** [June 18, 2021, 2:05pm UTC](https://discourse.cmake.org/t/macro-expansion-for-binarydir-in-cmakepresets-json/3591 "2021-06-18T14:05:59Z")

</div>

The top section in the presets macro expansion documentation is unclear to me: Macro Expansion As mentioned above, some fields support macro expansion. Macros are recognized in the form $\<macro-namespace\>{\<macro-name\>}.…

---

## [Cyclone DDS installer-Error creating Installer](https://discourse.cmake.org/t/cyclone-dds-installer-error-creating-installer/3584)

<div class="topic-metadata">

**Author:** [@rahulkp19861986](https://discourse.cmake.org/u/rahulkp19861986)\
**Replies:** 1\
**Last updated:** [June 17, 2021, 4:35pm UTC](https://discourse.cmake.org/t/cyclone-dds-installer-error-creating-installer/3584 "2021-06-17T16:35:18Z")

</div>

Hello, Im facing difficulties in creating an installer for Cyclone DDS for Eclipse in windows 10 , we successfully cloned the Git codes and the reference document used for it is This when tried to build, we are getting…

---

## [Loading data file](https://discourse.cmake.org/t/loading-data-file/3571)

<div class="topic-metadata">

**Author:** [@poseid](https://discourse.cmake.org/u/poseid)\
**Replies:** 3\
**Last updated:** [June 16, 2021, 7:32am UTC](https://discourse.cmake.org/t/loading-data-file/3571 "2021-06-16T07:32:54Z")

</div>

Hello, I want to set CMake variables from a text file. For example, the text file contains a set of paths where special header files are located and these paths change for different projects. Is something like this pos…

---

## [Letting the user choose a git clone protocol](https://discourse.cmake.org/t/letting-the-user-choose-a-git-clone-protocol/3572)

<div class="topic-metadata">

**Author:** [@pscl](https://discourse.cmake.org/u/pscl)\
**Replies:** 1\
**Last updated:** [June 15, 2021, 4:26pm UTC](https://discourse.cmake.org/t/letting-the-user-choose-a-git-clone-protocol/3572 "2021-06-15T16:26:17Z")

</div>

I am trying to use FetchContent to replace git submodules pointing to other local projects. One problem I have is that the protocol provided to FetchContent is fixed and forced to the user. For example, If I provide a SS…

---

## [targets with parameters](https://discourse.cmake.org/t/targets-with-parameters/3566)

<div class="topic-metadata">

**Author:** [@poseid](https://discourse.cmake.org/u/poseid)\
**Replies:** 3\
**Last updated:** [June 14, 2021, 12:41pm UTC](https://discourse.cmake.org/t/targets-with-parameters/3566 "2021-06-14T12:41:41Z")

</div>

Hello, I sometimes want to pass parameters to targets. Example: set(project\_path “/tmp/proj\_10122021”) add\_custom\_target(ls\_project COMMAND ls ${project\_path}) I now could run: make ls\_project and would get the co…

---

## [FindHDF5 module failing](https://discourse.cmake.org/t/findhdf5-module-failing/3518)

<div class="topic-metadata">

**Author:** [@jpfeuffer](https://discourse.cmake.org/u/jpfeuffer)\
**Replies:** 5\
**Last updated:** [June 14, 2021, 9:25am UTC](https://discourse.cmake.org/t/findhdf5-module-failing/3518 "2021-06-14T09:25:38Z")

</div>

Hi everyone, I am trying to compile a project that uses HDF5. It configures fine on 99% of our platforms, however we are encountering the following error on one: CMake Error: Generator: execution of make failed. Make c…

---

## [How to specify build directory](https://discourse.cmake.org/t/how-to-specify-build-directory/3562)

<div class="topic-metadata">

**Author:** [@sayandip18](https://discourse.cmake.org/u/sayandip18)\
**Replies:** 1\
**Last updated:** [June 14, 2021, 1:09am UTC](https://discourse.cmake.org/t/how-to-specify-build-directory/3562 "2021-06-14T01:09:01Z")

</div>

My project looks something like this - src - hello - hello.py - init.py - pyproject.toml - setup.py - CMakeLists.txt - build When I run pip install ., is there any way to specify that I want the…

---

## [CMake gets freezed during compilation on Windows 10](https://discourse.cmake.org/t/cmake-gets-freezed-during-compilation-on-windows-10/3543)

<div class="topic-metadata">

**Author:** [@DMB](https://discourse.cmake.org/u/DMB)\
**Replies:** 4\
**Last updated:** [June 11, 2021, 11:21pm UTC](https://discourse.cmake.org/t/cmake-gets-freezed-during-compilation-on-windows-10/3543 "2021-06-11T23:21:31Z")

</div>

I am having some issues while compiling my CMAKE project, it gets freezed once in a while during the compilation process. Sometimes I saw the issue once in a week, and sometimes several times in an hour. I migrated my co…

---

## [Possible Bug in cmake-file-api related to relative paths](https://discourse.cmake.org/t/possible-bug-in-cmake-file-api-related-to-relative-paths/3552)

<div class="topic-metadata">

**Author:** [@Zachary\_Turner](https://discourse.cmake.org/u/Zachary_Turner)\
**Replies:** 3\
**Last updated:** [June 11, 2021, 4:56pm UTC](https://discourse.cmake.org/t/possible-bug-in-cmake-file-api-related-to-relative-paths/3552 "2021-06-11T16:56:20Z")

</div>

I know the following is going to sound Android Studio / Gradle specific, but please hear me out as I think this is a bug in file api, not in Gradle / Android. Also, apologies in advance for the long message, but there’s…

---

## [buildPresets - configurePresets one to one mapping?](https://discourse.cmake.org/t/buildpresets-configurepresets-one-to-one-mapping/3549)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 1\
**Last updated:** [June 10, 2021, 4:01pm UTC](https://discourse.cmake.org/t/buildpresets-configurepresets-one-to-one-mapping/3549 "2021-06-10T16:01:01Z")

</div>

I am using a build preset to specify whether or not to run ninja in verbose mode: { "version": 2, "configurePresets": \[ { "name": "linux-A", "displayName": "Linux A", "inherits": "linux-remote-base", "cache…

---

## [CMake hung while compiling libical](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018)

<div class="topic-metadata">

**Author:** [@prakashcv13](https://discourse.cmake.org/u/prakashcv13)\
**Replies:** 30\
**Last updated:** [June 11, 2021, 5:17am UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018 "2021-06-11T05:17:39Z")

</div>

Hi All, While compiling libical using CMake on SLES12 - we see that CMake gets hung. CMake details - cmake --version cmake version 3.5.2 On cranking gdb to CMake, we see the below backtrace. (gdb) bt #0 0x00007fe4…

---

## ["No such file or directory" error in CMake build using arm-none-eabi](https://discourse.cmake.org/t/no-such-file-or-directory-error-in-cmake-build-using-arm-none-eabi/3533)

<div class="topic-metadata">

**Author:** [@honestech](https://discourse.cmake.org/u/honestech)\
**Replies:** 3\
**Last updated:** [June 10, 2021, 7:51pm UTC](https://discourse.cmake.org/t/no-such-file-or-directory-error-in-cmake-build-using-arm-none-eabi/3533 "2021-06-10T19:51:18Z")

</div>

Hi Everyone, I am new here and trying to get my STM32WL55 project build using CMake. It’s my first trying to use CMake with STM32CubeMx and I have experienced it in ZephyrRTOS. After read many topics on google, I have…

---

## [ctest --interactive-debug-mode not allowing error dialog on Windows](https://discourse.cmake.org/t/ctest-interactive-debug-mode-not-allowing-error-dialog-on-windows/3526)

<div class="topic-metadata">

**Author:** [@scivision](https://discourse.cmake.org/u/scivision)\
**Replies:** 5\
**Last updated:** [June 9, 2021, 8:45pm UTC](https://discourse.cmake.org/t/ctest-interactive-debug-mode-not-allowing-error-dialog-on-windows/3526 "2021-06-09T20:45:19Z")

</div>

Running a Windows executable with PATH missing the path to a required .dll that’s not on the working directory typically causes error code 0xc0000135 and a popup dialog telling which .dll file is missing. With CTest (ac…

---

## [Flag -DCMAKE\_Fortran\_FLAGS not changing the Makefile](https://discourse.cmake.org/t/flag-dcmake-fortran-flags-not-changing-the-makefile/3523)

<div class="topic-metadata">

**Author:** [@afernandezody](https://discourse.cmake.org/u/afernandezody)\
**Replies:** 10\
**Last updated:** [June 9, 2021, 6:12pm UTC](https://discourse.cmake.org/t/flag-dcmake-fortran-flags-not-changing-the-makefile/3523 "2021-06-09T18:12:44Z")

</div>

Hello, I need to set a flag (“Mfree”) for my Fortran compiler. However, using the -DCMAKE\_Fortran\_FLAGS is not making any difference. I have compared both Makefiles (with and without) and they are the same (except for t…

---

## [Compiler support](https://discourse.cmake.org/t/compiler-support/3473)

<div class="topic-metadata">

**Author:** [@afernandezody](https://discourse.cmake.org/u/afernandezody)\
**Replies:** 3\
**Last updated:** [June 9, 2021, 3:36pm UTC](https://discourse.cmake.org/t/compiler-support/3473 "2021-06-09T15:36:42Z")

</div>

Hello, I’m using v3.20.3 and getting the message: Compiler not officially supported: NVHPC I thought that these compilers were now supported ( CMake 3.20 Release Notes — CMake 3.20.3 Documentation. Do I simply ignore …

---

## [difference between a build cache and a build dependency](https://discourse.cmake.org/t/difference-between-a-build-cache-and-a-build-dependency/3540)

<div class="topic-metadata">

**Author:** [@hex](https://discourse.cmake.org/u/hex)\
**Replies:** 1\
**Last updated:** [June 9, 2021, 1:24pm UTC](https://discourse.cmake.org/t/difference-between-a-build-cache-and-a-build-dependency/3540 "2021-06-09T13:24:05Z")

</div>

a build dependency defines dependencies between objects add\_custom\_target(target\_name DEPENDS /path/to/objectfile) by using a file dependency CMake improves compilation performance by avoiding unnecessary recompilation…

---

## [Unknown CMake command "generate\_export\_header"](https://discourse.cmake.org/t/unknown-cmake-command-generate-export-header/3536)

<div class="topic-metadata">

**Author:** [@Alkexan](https://discourse.cmake.org/u/Alkexan)\
**Replies:** 2\
**Last updated:** [June 9, 2021, 7:02am UTC](https://discourse.cmake.org/t/unknown-cmake-command-generate-export-header/3536 "2021-06-09T07:02:05Z")

</div>

Hi, I’m trying to make .dll, and I wrote this CMakeFile.txt: # Shared Library CMakeList.txt cmake\_minimum\_required (VERSION 3.12) # Set language and the project name project (mylib CXX) # add all source files from dir…

---

## [Unknown argument --install](https://discourse.cmake.org/t/unknown-argument-install/3520)

<div class="topic-metadata">

**Author:** [@martijntje](https://discourse.cmake.org/u/martijntje)\
**Replies:** 3\
**Last updated:** [June 7, 2021, 5:54pm UTC](https://discourse.cmake.org/t/unknown-argument-install/3520 "2021-06-07T17:54:55Z")

</div>

I’m trying to use the --install option, that was added in 3.15, because I want to explicitly set component names to be installed. It works on 3.20.1, but on 3.20.3 I get the following error: Unknown argument --install I…

---

## [Remove "built using CMake" from Debian package description](https://discourse.cmake.org/t/remove-built-using-cmake-from-debian-package-description/3502)

<div class="topic-metadata">

**Author:** [@riban](https://discourse.cmake.org/u/riban)\
**Replies:** 2\
**Last updated:** [June 7, 2021, 2:51pm UTC](https://discourse.cmake.org/t/remove-built-using-cmake-from-debian-package-description/3502 "2021-06-07T14:51:10Z")

</div>

Hi I am using CMake to build small libraries and create debian packages. I have used the CPACK\_DEBIAN\_PACKAGE\_DESCRIPTION directive to give the package a description but the description added to the package is prefixed …

---

## [Building Compile-time Tools When Cross-compiling](https://discourse.cmake.org/t/building-compile-time-tools-when-cross-compiling/601)

<div class="topic-metadata">

**Author:** [@marco1475](https://discourse.cmake.org/u/marco1475)\
**Replies:** 10\
**Last updated:** [June 5, 2021, 11:27am UTC](https://discourse.cmake.org/t/building-compile-time-tools-when-cross-compiling/601 "2021-06-05T11:27:37Z")

</div>

Hi, As part of my compilation process I need to run a custom build tool that parses XML files and generates a C++ header and source file, which are in turn included and compiled by the main executable. My build tool is …

---

## [ld.lld --overwrite-section-script: should it be explicit or implicit?](https://discourse.cmake.org/t/ld-lld-overwrite-section-script-should-it-be-explicit-or-implicit/3494)

<div class="topic-metadata">

**Author:** [@MaskRay](https://discourse.cmake.org/u/MaskRay)\
**Replies:** 4\
**Last updated:** [June 4, 2021, 8:06pm UTC](https://discourse.cmake.org/t/ld-lld-overwrite-section-script-should-it-be-explicit-or-implicit/3494 "2021-06-04T20:06:01Z")

</div>

I am a linker (ld.lld) developer and have posted ⚙ D103303 \[ELF\] Add --overwrite-section-script for a linker script feature customizing output section descriptions1 without affecting the output section order\[2\]. This o…

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

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