# Usage

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

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

**Page:** 43

---

## [Embedding dylib in a macos bundle](https://discourse.cmake.org/t/embedding-dylib-in-a-macos-bundle/8465)

<div class="topic-metadata">

**Author:** [@fry](https://discourse.cmake.org/u/fry)\
**Replies:** 6\
**Last updated:** [July 10, 2023, 12:53pm UTC](https://discourse.cmake.org/t/embedding-dylib-in-a-macos-bundle/8465 "2023-07-10T12:53:34Z")

</div>

I am building a macos bundle that links using a dylib that is included in my project (not built). add\_executable(${target} MACOSX\_BUNDLE main.cpp) add\_library(google\_angle\_EGL SHARED IMPORTED) set\_target\_properties(goog…

---

## [Is string(JSON) with no ERROR\_VARIABLE supposed to exit with a fatal error if an error occurs?](https://discourse.cmake.org/t/is-string-json-with-no-error-variable-supposed-to-exit-with-a-fatal-error-if-an-error-occurs/8463)

<div class="topic-metadata">

**Author:** [@starball](https://discourse.cmake.org/u/starball)\
**Replies:** 2\
**Last updated:** [July 10, 2023, 12:04am UTC](https://discourse.cmake.org/t/is-string-json-with-no-error-variable-supposed-to-exit-with-a-fatal-error-if-an-error-occurs/8463 "2023-07-10T00:04:18Z")

</div>

The current behaviour seems to be to issue an error message, but to continue on with the configuration process. The docs state: If an error occurs but the ERROR\_VARIABLE option is not present, a fatal error message is …

---

## [empty opencv\_core.lib after running CMake for Embarcadero C++ Builder 10.3](https://discourse.cmake.org/t/empty-opencv-core-lib-after-running-cmake-for-embarcadero-c-builder-10-3/8472)

<div class="topic-metadata">

**Author:** [@XanderTest-OK](https://discourse.cmake.org/u/XanderTest-OK)\
**Replies:** 1\
**Last updated:** [July 9, 2023, 4:41pm UTC](https://discourse.cmake.org/t/empty-opencv-core-lib-after-running-cmake-for-embarcadero-c-builder-10-3/8472 "2023-07-09T16:41:41Z")

</div>

I have been trying to create the necessary borland makefiles using CMake for embarcadero C++ builder. Till now I only succeeded in adding OpenCV 2.4.13 but that version is way too old so I want to try again and add OpenC…

---

## [.cmake fail to find libbfd header file bfd.h](https://discourse.cmake.org/t/cmake-fail-to-find-libbfd-header-file-bfd-h/8470)

<div class="topic-metadata">

**Author:** [@koteswararao18](https://discourse.cmake.org/u/koteswararao18)\
**Replies:** 1\
**Last updated:** [July 9, 2023, 4:40pm UTC](https://discourse.cmake.org/t/cmake-fail-to-find-libbfd-header-file-bfd-h/8470 "2023-07-09T16:40:39Z")

</div>

Hi, Configuring bpftrace-0.17.1 (GitHub - iovisor/bpftrace: High-level tracing language for Linux eBPF) during build phase failing in finding libbfd header file (bfd.h). bpftrace cmake structure is given below. bpftra…

---

## [Android: CMake fails to find basic NDK headers when compiling with standalone toolchain - bug, or I'm missing something?](https://discourse.cmake.org/t/android-cmake-fails-to-find-basic-ndk-headers-when-compiling-with-standalone-toolchain-bug-or-im-missing-something/8421)

<div class="topic-metadata">

**Author:** [@MaxEd](https://discourse.cmake.org/u/MaxEd)\
**Replies:** 10\
**Last updated:** [July 7, 2023, 8:37pm UTC](https://discourse.cmake.org/t/android-cmake-fails-to-find-basic-ndk-headers-when-compiling-with-standalone-toolchain-bug-or-im-missing-something/8421 "2023-07-07T20:37:50Z")

</div>

I’m trying to compile a library for Android that depends on EGL. I have NDK installed in C:\\Microsoft\\AndroidNDK\\android-ndk-r23c and SDK installed in C:\\Microsoft\\AndroidSDK. However, find\_package(OpenGL) fails with: -…

---

## [Can the CMake File API provide the necessary information to build a project?](https://discourse.cmake.org/t/can-the-cmake-file-api-provide-the-necessary-information-to-build-a-project/8433)

<div class="topic-metadata">

**Author:** [@Jason\_Cao](https://discourse.cmake.org/u/Jason_Cao)\
**Replies:** 2\
**Last updated:** [July 7, 2023, 9:40am UTC](https://discourse.cmake.org/t/can-the-cmake-file-api-provide-the-necessary-information-to-build-a-project/8433 "2023-07-07T09:40:34Z")

</div>

I would like to use the CMake File API to parse the build targets of a project and retrieve information such as their source files, include paths, compilation options, and so on. My intention is to port this information …

---

## [how to pass CLI args to workflow steps](https://discourse.cmake.org/t/how-to-pass-cli-args-to-workflow-steps/8460)

<div class="topic-metadata">

**Author:** [@aalan](https://discourse.cmake.org/u/aalan)\
**Replies:** 1\
**Last updated:** [July 5, 2023, 10:30pm UTC](https://discourse.cmake.org/t/how-to-pass-cli-args-to-workflow-steps/8460 "2023-07-05T22:30:55Z")

</div>

Hello. Would be possible to pass CLI args of cmake commands to its equivalent stages in CMake presets and workflows. I want to pass flags like --verbose and --rerun-after-failure to these steps. thanks

---

## [Visual Studio Build Tools and (Intel) Fortran](https://discourse.cmake.org/t/visual-studio-build-tools-and-intel-fortran/8423)

<div class="topic-metadata">

**Author:** [@Abbing\_Arend](https://discourse.cmake.org/u/Abbing_Arend)\
**Replies:** 2\
**Last updated:** [July 5, 2023, 11:38am UTC](https://discourse.cmake.org/t/visual-studio-build-tools-and-intel-fortran/8423 "2023-07-05T11:38:02Z")

</div>

Hello, Is there a way in cmake to use the Visual Studio Build Tools in combination with (Intel) FORTRAN without installing Visual Studio itself? I observed that cmake will use devenv.com which is not part of the Build T…

---

## [Property inheritance thru target\_link](https://discourse.cmake.org/t/property-inheritance-thru-target-link/8426)

<div class="topic-metadata">

**Author:** [@kfsone](https://discourse.cmake.org/u/kfsone)\
**Replies:** 1\
**Last updated:** [July 1, 2023, 11:27pm UTC](https://discourse.cmake.org/t/property-inheritance-thru-target-link/8426 "2023-07-01T23:27:09Z")

</div>

I was attempting to validate my understanding of the inheritance of PROPERTYs through target link libraries. That is, I thought that if target1 was given a property and target2 linked that target, it would inherit that p…

---

## [How can I make the content returned by the CMake File API independent of the files generated after configuring with CMake?](https://discourse.cmake.org/t/how-can-i-make-the-content-returned-by-the-cmake-file-api-independent-of-the-files-generated-after-configuring-with-cmake/8439)

<div class="topic-metadata">

**Author:** [@Jason\_Cao](https://discourse.cmake.org/u/Jason_Cao)\
**Replies:** 1\
**Last updated:** [July 1, 2023, 9:44pm UTC](https://discourse.cmake.org/t/how-can-i-make-the-content-returned-by-the-cmake-file-api-independent-of-the-files-generated-after-configuring-with-cmake/8439 "2023-07-01T21:44:51Z")

</div>

For example, in an actual project, I used the CMake File API to retrieve the include path of a target as “C:/Users/Jason/OneDrive/Desktop/CMakeTest/opencv-4.7.0/build/3rdparty/libtiff”. The project folder is “opencv-4.7.…

---

## [Linking a shared library using only objects from an object library](https://discourse.cmake.org/t/linking-a-shared-library-using-only-objects-from-an-object-library/8430)

<div class="topic-metadata">

**Author:** [@ton](https://discourse.cmake.org/u/ton)\
**Replies:** 1\
**Last updated:** [July 1, 2023, 9:39pm UTC](https://discourse.cmake.org/t/linking-a-shared-library-using-only-objects-from-an-object-library/8430 "2023-07-01T21:39:50Z")

</div>

I am following the instructions from the manual to correctly propagate object files from an object library and usage dependencies according to: target\_link\_libraries — CMake 3.27.0-rc3 Documentation So I have some CMake…

---

## [CMake error: unable to read CMakeFiles.o](https://discourse.cmake.org/t/cmake-error-unable-to-read-cmakefiles-o/8375)

<div class="topic-metadata">

**Author:** [@XanderTest-OK](https://discourse.cmake.org/u/XanderTest-OK)\
**Replies:** 3\
**Last updated:** [July 1, 2023, 9:05pm UTC](https://discourse.cmake.org/t/cmake-error-unable-to-read-cmakefiles-o/8375 "2023-07-01T21:05:17Z")

</div>

I am attempting to use OpenCV in Embarcadero C++ Builder 10.3 for the 64-bit platform. I use the RAD Studio command prompt and execute the following command to generate the MakeFiles: cmake -DCMAKE\_C\_COMPILER=bcc64.exe…

---

## [Why do I get "not finding compatible version with requested version ''"?](https://discourse.cmake.org/t/why-do-i-get-not-finding-compatible-version-with-requested-version/7707)

<div class="topic-metadata">

**Author:** [@theateist](https://discourse.cmake.org/u/theateist)\
**Replies:** 7\
**Last updated:** [July 1, 2023, 8:50pm UTC](https://discourse.cmake.org/t/why-do-i-get-not-finding-compatible-version-with-requested-version/7707 "2023-07-01T20:50:48Z")

</div>

I’m trying to build tesseract repo on Windows 10 22H2. I was told to use colcon to build the repo. I’m new to colcon and cmake. I cloned the repo to C:\\Temp\\colcon\_ws\\src and ran colcon build from x64 Native Tools Comma…

---

## [Isn't possible to use an IMPORTED library with FetchContent\_Declare?](https://discourse.cmake.org/t/isnt-possible-to-use-an-imported-library-with-fetchcontent-declare/8438)

<div class="topic-metadata">

**Author:** [@bog-dan-ro](https://discourse.cmake.org/u/bog-dan-ro)\
**Replies:** 3\
**Last updated:** [July 1, 2023, 6:53am UTC](https://discourse.cmake.org/t/isnt-possible-to-use-an-imported-library-with-fetchcontent-declare/8438 "2023-07-01T06:53:40Z")

</div>

I created two examples for better understanding: GitHub - bog-dan-ro/cmake-imported-lib - is an IMPORTED static library GitHub - bog-dan-ro/cmake-imported-lib-test is an example which tries to use it. Am I doing som…

---

## [Selectively build and pack targets](https://discourse.cmake.org/t/selectively-build-and-pack-targets/657)

<div class="topic-metadata">

**Author:** [@jansende](https://discourse.cmake.org/u/jansende)\
**Replies:** 13\
**Last updated:** [June 29, 2023, 10:34pm UTC](https://discourse.cmake.org/t/selectively-build-and-pack-targets/657 "2023-06-29T22:34:46Z")

</div>

Hi, at our company we encountered the following problem. If we try to package our software using cpack, all targets in the CMakeLists.txt get build before the actual packaging. This however takes a very long time becaus…

---

## [declare imported targets as system to suppress warnings](https://discourse.cmake.org/t/declare-imported-targets-as-system-to-suppress-warnings/555)

<div class="topic-metadata">

**Author:** [@schrodinbug](https://discourse.cmake.org/u/schrodinbug)\
**Replies:** 5\
**Last updated:** [June 27, 2023, 3:19pm UTC](https://discourse.cmake.org/t/declare-imported-targets-as-system-to-suppress-warnings/555 "2023-06-27T15:19:25Z")

</div>

Normally to suppress warnings in a third party library, I would use something like: target\_include\_directories(my\_target SYSTEM PUBLIC ${EIGEN3\_INCLUDE\_DIR} ) however the SYSTEM option doesn’t work with tar…

---

## [Link a Target to a custom built library](https://discourse.cmake.org/t/link-a-target-to-a-custom-built-library/8403)

<div class="topic-metadata">

**Author:** [@developer](https://discourse.cmake.org/u/developer)\
**Replies:** 5\
**Last updated:** [June 27, 2023, 1:52am UTC](https://discourse.cmake.org/t/link-a-target-to-a-custom-built-library/8403 "2023-06-27T01:52:43Z")

</div>

I have a target executable, app. Which I am trying to link to a libFoo.a, which is not built by CMake, but can be built by invoking a script, build.sh. Is there a way I can link app to a custom built libFoo.a? I’ve trie…

---

## [PYTHON\_wrap.cxx can not open file](https://discourse.cmake.org/t/python-wrap-cxx-can-not-open-file/6039)

<div class="topic-metadata">

**Author:** [@zhang-qiang-github](https://discourse.cmake.org/u/zhang-qiang-github)\
**Replies:** 2\
**Last updated:** [June 26, 2023, 1:03pm UTC](https://discourse.cmake.org/t/python-wrap-cxx-can-not-open-file/6039 "2023-06-26T13:03:14Z")

</div>

I am using swig to wrap my c++ code to python. And my file structure is: build Project PackA PackA.h PackA.cpp PackA.i CMakeLists.txt (c) CMakeLists.txt (b) CMakeLists.txt (a) T…

---

## [Why does CMake display $BUILD\_PREFIX & $PREFIX instead of full library paths?](https://discourse.cmake.org/t/why-does-cmake-display-build-prefix-prefix-instead-of-full-library-paths/8386)

<div class="topic-metadata">

**Author:** [@martyngigg](https://discourse.cmake.org/u/martyngigg)\
**Replies:** 3\
**Last updated:** [June 26, 2023, 9:12am UTC](https://discourse.cmake.org/t/why-does-cmake-display-build-prefix-prefix-instead-of-full-library-paths/8386 "2023-06-26T09:12:39Z")

</div>

Hi, I’m using CMake to cross-compile a library with conda-build. Everything seems to build just fine on one machine but I notice that during the configure step where I would usually expect full paths to found compilers …

---

## [add\_custom\_target needs intermediate target](https://discourse.cmake.org/t/add-custom-target-needs-intermediate-target/8397)

<div class="topic-metadata">

**Author:** [@jwuttke](https://discourse.cmake.org/u/jwuttke)\
**Replies:** 1\
**Last updated:** [June 25, 2023, 8:14pm UTC](https://discourse.cmake.org/t/add-custom-target-needs-intermediate-target/8397 "2023-06-25T20:14:26Z")

</div>

This works: add\_custom\_target(foo COMMAND crunsh) add\_dependencies(foo bar) add\_custom\_target(top) add\_dependencies(top foo) This does not: add\_custom\_target(top COMMAND crunsh) add\_dependencies(top bar) With the lat…

---

## [Idiomatic way to handle packages and add\_subdirectory?](https://discourse.cmake.org/t/idiomatic-way-to-handle-packages-and-add-subdirectory/8400)

<div class="topic-metadata">

**Author:** [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)\
**Replies:** 1\
**Last updated:** [June 25, 2023, 8:08pm UTC](https://discourse.cmake.org/t/idiomatic-way-to-handle-packages-and-add-subdirectory/8400 "2023-06-25T20:08:36Z")

</div>

Currently I work on a project where users want both add\_subdirectory and find\_package. We try and support both approaches. However, it results in having code that looks like this. if (NOT TARGET Vulkan::Headers) fi…

---

## [CMake linter?](https://discourse.cmake.org/t/cmake-linter/8391)

<div class="topic-metadata">

**Author:** [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)\
**Replies:** 2\
**Last updated:** [June 25, 2023, 8:00pm UTC](https://discourse.cmake.org/t/cmake-linter/8391 "2023-06-25T20:00:54Z")

</div>

Does anyone have any recommendations for a CMake linter?

---

## [Component-install: how to create the default package file without component name ?](https://discourse.cmake.org/t/component-install-how-to-create-the-default-package-file-without-component-name/8380)

<div class="topic-metadata">

**Author:** [@neundorf](https://discourse.cmake.org/u/neundorf)\
**Replies:** 1\
**Last updated:** [June 25, 2023, 7:50pm UTC](https://discourse.cmake.org/t/component-install-how-to-create-the-default-package-file-without-component-name/8380 "2023-06-25T19:50:38Z")

</div>

Hi, I have a project, where headers etc. are installed into the “devel” component, and everything else in the default install component. The name of the default component is “Unspecified”, so the package files get the …

---

## [What is AndroidTestUtilities?](https://discourse.cmake.org/t/what-is-androidtestutilities/8365)

<div class="topic-metadata">

**Author:** [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)\
**Replies:** 1\
**Last updated:** [June 25, 2023, 7:37pm UTC](https://discourse.cmake.org/t/what-is-androidtestutilities/8365 "2023-06-25T19:37:16Z")

</div>

I’m currently working on our Android CMake build and stumbled on the following CMake module: https://cmake.org/cmake/help/latest/module/AndroidTestUtilities.html What does this module do? Is there an example I can look…

---

## [The CMAKE\_C\_COMPILER: pathto/qcc is not a full path to an existing compiler tool](https://discourse.cmake.org/t/the-cmake-c-compiler-pathto-qcc-is-not-a-full-path-to-an-existing-compiler-tool/8361)

<div class="topic-metadata">

**Author:** [@pramod](https://discourse.cmake.org/u/pramod)\
**Replies:** 1\
**Last updated:** [June 25, 2023, 12:23pm UTC](https://discourse.cmake.org/t/the-cmake-c-compiler-pathto-qcc-is-not-a-full-path-to-an-existing-compiler-tool/8361 "2023-06-25T12:23:42Z")

</div>

Hi, I am trying to compile source code in windows environment using qcc compiler and facing this below error. – The C compiler identification is QCC 5.4.0 CMake Error at CMakeLists.txt:22 (project): The CMAKE\_C\_COMPI…

---

## [CMakePreset : include behavior](https://discourse.cmake.org/t/cmakepreset-include-behavior/8379)

<div class="topic-metadata">

**Author:** [@phread](https://discourse.cmake.org/u/phread)\
**Replies:** 9\
**Last updated:** [June 23, 2023, 11:30pm UTC](https://discourse.cmake.org/t/cmakepreset-include-behavior/8379 "2023-06-23T23:30:59Z")

</div>

I have a project with a hierarchy of CMakePresets.json files: - root - CMakePresets.json - child1 - CMakePresets.json - child2 - CMakePresets.json The contents are roughly root/CMakePresets.json {…

---

## [CMakePresets.json : include](https://discourse.cmake.org/t/cmakepresets-json-include/8366)

<div class="topic-metadata">

**Author:** [@phread](https://discourse.cmake.org/u/phread)\
**Replies:** 1\
**Last updated:** [June 21, 2023, 5:50pm UTC](https://discourse.cmake.org/t/cmakepresets-json-include/8366 "2023-06-21T17:50:39Z")

</div>

I am writing CMakePresets.json for a project which has hundreds of executables. (It is a test suite for C++, but that should not be too important.) The problem is that I get the following error. CMake Error: Could not…

---

## [CMakePresets.json: Could not read presets: Invalid preset](https://discourse.cmake.org/t/cmakepresets-json-could-not-read-presets-invalid-preset/4883)

<div class="topic-metadata">

**Author:** [@Allison\_Vacanti](https://discourse.cmake.org/u/Allison_Vacanti)\
**Replies:** 2\
**Last updated:** [June 21, 2023, 2:56pm UTC](https://discourse.cmake.org/t/cmakepresets-json-could-not-read-presets-invalid-preset/4883 "2023-06-21T14:56:21Z")

</div>

I’m trying to setup a CMakePresets.json file, included below. When I try to use it, I get a very basic error message: “Invalid preset”, with no details or context. I’ve validated this against the published schema, but th…

---

## [Recommend version pinning strategy for CMake APT repository](https://discourse.cmake.org/t/recommend-version-pinning-strategy-for-cmake-apt-repository/8363)

<div class="topic-metadata">

**Author:** [@Ryanf55](https://discourse.cmake.org/u/Ryanf55)\
**Replies:** 7\
**Last updated:** [June 21, 2023, 12:00pm UTC](https://discourse.cmake.org/t/recommend-version-pinning-strategy-for-cmake-apt-repository/8363 "2023-06-21T12:00:03Z")

</div>

Hello, I am trying to find a better way to maintain our CI, but have heard the following conflicting advice. Constraints: My team is required to version pin our dependencies so builds are (mostly) reproducible, and th…

---

## [\`CMAKE\_\<LANG\>\_STANDARD\` and FetchContent/Cache variable interaction](https://discourse.cmake.org/t/cmake-lang-standard-and-fetchcontent-cache-variable-interaction/8348)

<div class="topic-metadata">

**Author:** [@Lecris](https://discourse.cmake.org/u/Lecris)\
**Replies:** 7\
**Last updated:** [June 20, 2023, 4:37pm UTC](https://discourse.cmake.org/t/cmake-lang-standard-and-fetchcontent-cache-variable-interaction/8348 "2023-06-20T16:37:13Z")

</div>

I have a question about how CMAKE\_\<LANG\>\_STANDARD and which takes precedence. Cache variable -DCMAKE\_\<LANG\>\_STANDARD vs set() (not cached): Local variable wins because it shadows cached variable set() in parent pro…

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

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