# Usage

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

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

**Page:** 42

---

## [CMake Error, on MacOS, Could not find ZLIB (missing: ZLIB\_LIBRARY)](https://discourse.cmake.org/t/cmake-error-on-macos-could-not-find-zlib-missing-zlib-library/8613)

<div class="topic-metadata">

**Author:** [@Lee\_Elliott](https://discourse.cmake.org/u/Lee_Elliott)\
**Replies:** 1\
**Last updated:** [July 27, 2023, 2:57am UTC](https://discourse.cmake.org/t/cmake-error-on-macos-could-not-find-zlib-missing-zlib-library/8613 "2023-07-27T02:57:32Z")

</div>

when configuring with cmake in order to compile azerothcore, I am receiving an CMake error where ZLIB can’t be located. This is what I’m getting: Lees-MBP-2:build leeelliott$ export OPENSSL\_ROOT\_DIR=$(brew --prefix ope…

---

## [What does \`--test-load\` do?](https://discourse.cmake.org/t/what-does-test-load-do/8610)

<div class="topic-metadata">

**Author:** [@Barry\_Revzin](https://discourse.cmake.org/u/Barry_Revzin)\
**Replies:** 2\
**Last updated:** [July 27, 2023, 2:47am UTC](https://discourse.cmake.org/t/what-does-test-load-do/8610 "2023-07-27T02:47:25Z")

</div>

The documentation for --test-load in ctest currently reads: --test-load \<level\> While running tests in parallel (e.g. with -j), try not to start tests when they may cause the CPU load to pass above a given threshold. …

---

## [How to properly install a symbolic link for backwards compatibility?](https://discourse.cmake.org/t/how-to-properly-install-a-symbolic-link-for-backwards-compatibility/8592)

<div class="topic-metadata">

**Author:** [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)\
**Replies:** 1\
**Last updated:** [July 26, 2023, 6:12pm UTC](https://discourse.cmake.org/t/how-to-properly-install-a-symbolic-link-for-backwards-compatibility/8592 "2023-07-26T18:12:33Z")

</div>

We are having a bit of an issue where we are trying to change the name of an executable. But trying to preserve backwards compatibility by providing a symbolic link. To not break downstream users. I’m unsure how to writ…

---

## [Run configure step only for specific target](https://discourse.cmake.org/t/run-configure-step-only-for-specific-target/8607)

<div class="topic-metadata">

**Author:** [@GTP](https://discourse.cmake.org/u/GTP)\
**Replies:** 2\
**Last updated:** [July 26, 2023, 4:53pm UTC](https://discourse.cmake.org/t/run-configure-step-only-for-specific-target/8607 "2023-07-26T16:53:35Z")

</div>

Greetings, Is it possible to run the configuration step only for a specific target instead of for the whole CMake project? I’m trying to compile a project’s component to WASM using Emscripten. This means that I have to…

---

## [How to avoid error "definition is marked dllimport"](https://discourse.cmake.org/t/how-to-avoid-error-definition-is-marked-dllimport/2726)

<div class="topic-metadata">

**Author:** [@githubuser0xFFFF](https://discourse.cmake.org/u/githubuser0xFFFF)\
**Replies:** 13\
**Last updated:** [July 26, 2023, 4:39pm UTC](https://discourse.cmake.org/t/how-to-avoid-error-definition-is-marked-dllimport/2726 "2023-07-26T16:39:51Z")

</div>

Environment: Windows 10 with CMake 3.19.4 + MinGW 7.3.0 When building libraries with CMake + MinGW that contain tests or examples (.exe files) that consume the compiled library, then the compilation of these executables…

---

## [CMAKE\_INSTALL\_PREFIX available inside \`install(CODE\`](https://discourse.cmake.org/t/cmake-install-prefix-available-inside-install-code/8594)

<div class="topic-metadata">

**Author:** [@gabyx](https://discourse.cmake.org/u/gabyx)\
**Replies:** 1\
**Last updated:** [July 26, 2023, 4:36pm UTC](https://discourse.cmake.org/t/cmake-install-prefix-available-inside-install-code/8594 "2023-07-26T16:36:13Z")

</div>

Is there a way to access the final (potentially overrriden) CMAKE\_INSTALL\_PREFIX inside a code/script in install(CODE ...) or install(SCRIPT script.cmake ...). Because we have custom code which hardbakes the install-pr…

---

## [How to recursively search include directories for automoc headers?](https://discourse.cmake.org/t/how-to-recursively-search-include-directories-for-automoc-headers/8600)

<div class="topic-metadata">

**Author:** [@zambony](https://discourse.cmake.org/u/zambony)\
**Replies:** 0\
**Last updated:** [July 26, 2023, 4:35am UTC](https://discourse.cmake.org/t/how-to-recursively-search-include-directories-for-automoc-headers/8600 "2023-07-26T04:35:49Z")

</div>

I have been asked to convert a Qt project from QMake to CMake, and I’m having a problem with AutoMOC. This project is structured like so: src/ ├─ include/ │ ├─ subfolder/ │ │ ├─ a.h ├─ CMakeLists.txt ├─ a.cpp Heade…

---

## [CMake Tutorial Step5: install()](https://discourse.cmake.org/t/cmake-tutorial-step5-install/8554)

<div class="topic-metadata">

**Author:** [@Alex\_Gaidachev](https://discourse.cmake.org/u/Alex_Gaidachev)\
**Replies:** 8\
**Last updated:** [July 26, 2023, 12:24am UTC](https://discourse.cmake.org/t/cmake-tutorial-step5-install/8554 "2023-07-26T00:24:37Z")

</div>

Hi All, signed up and creating this post to see what you, the community thinks of this issue and what my next steps are in resolving it, (I used PowerShell command Prompt): PS C:\\Work\\Cmake\\project5\\build\> cmake …\\buil…

---

## [How to include non-interface library to interface library?](https://discourse.cmake.org/t/how-to-include-non-interface-library-to-interface-library/8591)

<div class="topic-metadata">

**Author:** [@doctorkissinger](https://discourse.cmake.org/u/doctorkissinger)\
**Replies:** 2\
**Last updated:** [July 25, 2023, 11:21am UTC](https://discourse.cmake.org/t/how-to-include-non-interface-library-to-interface-library/8591 "2023-07-25T11:21:31Z")

</div>

I just have a project P, libary A and header-only library B. P uses A and B and I also need to make B using A. When I use target\_link\_libraries it says that A also need to be INTERFACE :smile: :cow: :sunflower:

---

## [Swapping project to xlc 17.1.1 with mixed C / C++ code](https://discourse.cmake.org/t/swapping-project-to-xlc-17-1-1-with-mixed-c-c-code/8589)

<div class="topic-metadata">

**Author:** [@tmx1835](https://discourse.cmake.org/u/tmx1835)\
**Replies:** 5\
**Last updated:** [July 24, 2023, 12:51pm UTC](https://discourse.cmake.org/t/swapping-project-to-xlc-17-1-1-with-mixed-c-c-code/8589 "2023-07-24T12:51:21Z")

</div>

We’ve been using cmake for a couple of months on AIX 7.2 with XLC 16, we need to swap to the clang based xlc 17.1.1 however have hit a bit of an issue as our app is a mix of c and c++ when we compile our c source with th…

---

## [How to correctly include header files for compilation of cxx SWIG wrapped files ?](https://discourse.cmake.org/t/how-to-correctly-include-header-files-for-compilation-of-cxx-swig-wrapped-files/8533)

<div class="topic-metadata">

**Author:** [@JSn](https://discourse.cmake.org/u/JSn)\
**Replies:** 7\
**Last updated:** [July 24, 2023, 10:51am UTC](https://discourse.cmake.org/t/how-to-correctly-include-header-files-for-compilation-of-cxx-swig-wrapped-files/8533 "2023-07-24T10:51:34Z")

</div>

Hi, I’m almost newbie in CMake and SWIG. Currently I’m using CMake 3.23.3 and SWIG 4.0.2. I’m trying to compile the .cxx file wrapped from a C++ project in order to create a Python package. Can you confirm me that the in…

---

## [How to use relative paths when generating code coverage info](https://discourse.cmake.org/t/how-to-use-relative-paths-when-generating-code-coverage-info/8572)

<div class="topic-metadata">

**Author:** [@amlamarra](https://discourse.cmake.org/u/amlamarra)\
**Replies:** 1\
**Last updated:** [July 24, 2023, 9:49am UTC](https://discourse.cmake.org/t/how-to-use-relative-paths-when-generating-code-coverage-info/8572 "2023-07-24T09:49:11Z")

</div>

When I manually compile code to generate coverage info with g++ --coverage ..., it will generate gcno files using relative paths. If I wanted them to be absolute paths, I would add -fprofile-abs-path. However, when using…

---

## [Apply configure options to git checkout when adding external projects](https://discourse.cmake.org/t/apply-configure-options-to-git-checkout-when-adding-external-projects/8562)

<div class="topic-metadata">

**Author:** [@jhlegarreta](https://discourse.cmake.org/u/jhlegarreta)\
**Replies:** 2\
**Last updated:** [July 21, 2023, 1:04pm UTC](https://discourse.cmake.org/t/apply-configure-options-to-git-checkout-when-adding-external-projects/8562 "2023-07-21T13:04:05Z")

</div>

Hi, in ITK we have some third-party modules that we checkout using CMake’s ExternalProject\_Add() function’s git capabilities: https://cmake.org/cmake/help/latest/module/ExternalProject.html Specifically, we donwload D…

---

## [Conflicting targets](https://discourse.cmake.org/t/conflicting-targets/8564)

<div class="topic-metadata">

**Author:** [@jardon](https://discourse.cmake.org/u/jardon)\
**Replies:** 1\
**Last updated:** [July 20, 2023, 5:15pm UTC](https://discourse.cmake.org/t/conflicting-targets/8564 "2023-07-20T17:15:21Z")

</div>

Hello! I am attempting to build QT 6.4.3 from git and am hitting an issue as described here. Seems qtlocation with this release tag is broken. I tried to use -DALLOW\_DUPLICATE\_CUSTOM\_TARGETS=TRUE but with no avail. I…

---

## [Windows default headers not found during CMAKE compilation](https://discourse.cmake.org/t/windows-default-headers-not-found-during-cmake-compilation/8545)

<div class="topic-metadata">

**Author:** [@Akash\_01](https://discourse.cmake.org/u/Akash_01)\
**Replies:** 3\
**Last updated:** [July 20, 2023, 5:10pm UTC](https://discourse.cmake.org/t/windows-default-headers-not-found-during-cmake-compilation/8545 "2023-07-20T17:10:02Z")

</div>

When compiling the CMAKE project in visual studio I was facing issue in windows default headers which are available under windows kits. Could anyone support on how to resolve this issue. I tried manually adding this mis…

---

## [Cmake cannot find glib-object.h](https://discourse.cmake.org/t/cmake-cannot-find-glib-object-h/8419)

<div class="topic-metadata">

**Author:** [@jardon](https://discourse.cmake.org/u/jardon)\
**Replies:** 2\
**Last updated:** [July 20, 2023, 1:53pm UTC](https://discourse.cmake.org/t/cmake-cannot-find-glib-object-h/8419 "2023-07-20T13:53:20Z")

</div>

Hello! I am trying to package an upstream project and am running into issues building it in certain environments. I am not well versed in cmake, and am trying to package it without directly modifying the upstream. I ha…

---

## [No such file or directory](https://discourse.cmake.org/t/no-such-file-or-directory/8547)

<div class="topic-metadata">

**Author:** [@XRCUSER](https://discourse.cmake.org/u/XRCUSER)\
**Replies:** 1\
**Last updated:** [July 19, 2023, 11:39pm UTC](https://discourse.cmake.org/t/no-such-file-or-directory/8547 "2023-07-19T23:39:20Z")

</div>

Hello folks, I have a problem. I want to use openCV with C++ on VSCode but I get the following error fatal error: opencv2/opencv.hpp: No such file or directory. What is the reason of this? CMakeLists.txt: cmake\_minimu…

---

## [How to enable color output with Ninja](https://discourse.cmake.org/t/how-to-enable-color-output-with-ninja/8544)

<div class="topic-metadata">

**Author:** [@murtiko](https://discourse.cmake.org/u/murtiko)\
**Replies:** 3\
**Last updated:** [July 19, 2023, 11:33pm UTC](https://discourse.cmake.org/t/how-to-enable-color-output-with-ninja/8544 "2023-07-19T23:33:25Z")

</div>

Hi, How can I enable color output when using the Ninja generator? I have set CMAKE\_COLOR\_DIAGNOSTICS to ON and also tried adding the -fdiagnostics-color=always compiler option, but still, no color is displayed. The co…

---

## [cmake --build: --parallel when used with msbuild does not enable parallelism within a project](https://discourse.cmake.org/t/cmake-build-parallel-when-used-with-msbuild-does-not-enable-parallelism-within-a-project/8506)

<div class="topic-metadata">

**Author:** [@siddmohsin](https://discourse.cmake.org/u/siddmohsin)\
**Replies:** 4\
**Last updated:** [July 19, 2023, 1:21am UTC](https://discourse.cmake.org/t/cmake-build-parallel-when-used-with-msbuild-does-not-enable-parallelism-within-a-project/8506 "2023-07-19T01:21:07Z")

</div>

I went through the below already-opened tickets here issues/20564 Tried everything mentioned there and nothing worked. I am using Visual Studio Generator . I tried below commands and nothing worked. cmake --build --p…

---

## [How to add to a library a subdirectory with CMake which has external dependencies?](https://discourse.cmake.org/t/how-to-add-to-a-library-a-subdirectory-with-cmake-which-has-external-dependencies/8174)

<div class="topic-metadata">

**Author:** [@rkrd](https://discourse.cmake.org/u/rkrd)\
**Replies:** 1\
**Last updated:** [July 18, 2023, 11:27pm UTC](https://discourse.cmake.org/t/how-to-add-to-a-library-a-subdirectory-with-cmake-which-has-external-dependencies/8174 "2023-07-18T23:27:55Z")

</div>

I’m developing a library called sonovolt, which I want to have different modules that depend on different platforms (boards, like the raspberry pi pico). Here’s the source code. My folder structure looks like this: / so…

---

## [Cmake variables error when installing faiss-gpu](https://discourse.cmake.org/t/cmake-variables-error-when-installing-faiss-gpu/8495)

<div class="topic-metadata">

**Author:** [@jcruz13](https://discourse.cmake.org/u/jcruz13)\
**Replies:** 2\
**Last updated:** [July 18, 2023, 7:41pm UTC](https://discourse.cmake.org/t/cmake-variables-error-when-installing-faiss-gpu/8495 "2023-07-18T19:41:53Z")

</div>

I’m order to install faiss-gpu, I first needed to install cmake and did it by cloning the cmake repo from GitHub - Kitware/CMake: Mirror of CMake upstream repository and running ./bootstrap && make && make install Then…

---

## [How to add Kotlin files to CMake Build system](https://discourse.cmake.org/t/how-to-add-kotlin-files-to-cmake-build-system/7901)

<div class="topic-metadata">

**Author:** [@siddmohsin](https://discourse.cmake.org/u/siddmohsin)\
**Replies:** 7\
**Last updated:** [July 18, 2023, 6:30pm UTC](https://discourse.cmake.org/t/how-to-add-kotlin-files-to-cmake-build-system/7901 "2023-07-18T18:30:18Z")

</div>

Currently, in our project we are suing java files for Android development. But we want to move to Kotlin files. Kotlin is similar to java only. And thus we though add\_jar would be able to work fine with kotlin (.kt) file…

---

## [CMAKE\_PREFIX\_PATH does not work as expected](https://discourse.cmake.org/t/cmake-prefix-path-does-not-work-as-expected/1677)

<div class="topic-metadata">

**Author:** [@fifothekid](https://discourse.cmake.org/u/fifothekid)\
**Replies:** 10\
**Last updated:** [July 18, 2023, 12:23pm UTC](https://discourse.cmake.org/t/cmake-prefix-path-does-not-work-as-expected/1677 "2023-07-18T12:23:41Z")

</div>

I’m compiling the same Qt/QML application on Windows, Linux, MacOS, WebAssembly, iOS, and Android. So far, I found that detection of Qt’s components only works on Windows, regardless whether I’m using it to compile a Win…

---

## [clang-tidy / g++ "C++ Standard" command line parameter incompatibilites](https://discourse.cmake.org/t/clang-tidy-g-c-standard-command-line-parameter-incompatibilites/8526)

<div class="topic-metadata">

**Author:** [@infohoschie](https://discourse.cmake.org/u/infohoschie)\
**Replies:** 1\
**Last updated:** [July 18, 2023, 12:12am UTC](https://discourse.cmake.org/t/clang-tidy-g-c-standard-command-line-parameter-incompatibilites/8526 "2023-07-18T00:12:14Z")

</div>

I’m using clang-tidy for static analysis by defining CMAKE\_CXX\_CLANG\_TIDY to the system installed clang-tidy executable. I want to set the C++ Standard to C++23. When using g++ (Version 13.1) cmake sets the command lin…

---

## [How do I add a lib library path to a subpart of LLVM?](https://discourse.cmake.org/t/how-do-i-add-a-lib-library-path-to-a-subpart-of-llvm/8524)

<div class="topic-metadata">

**Author:** [@lifangyi01](https://discourse.cmake.org/u/lifangyi01)\
**Replies:** 1\
**Last updated:** [July 18, 2023, 12:10am UTC](https://discourse.cmake.org/t/how-do-i-add-a-lib-library-path-to-a-subpart-of-llvm/8524 "2023-07-18T00:10:05Z")

</div>

Question I tried compiling llvm15 on Ubuntu with AArch64 architecture. However, I encountered the following problems: 1. /usr/bin/ld: cannot find -lgcc\_s, some of the errors are as follows: \[build\] \[73/4456 0% :: 1.02…

---

## [Downloadable components with latest NSIS release not working](https://discourse.cmake.org/t/downloadable-components-with-latest-nsis-release-not-working/8509)

<div class="topic-metadata">

**Author:** [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Replies:** 1\
**Last updated:** [July 18, 2023, 12:03am UTC](https://discourse.cmake.org/t/downloadable-components-with-latest-nsis-release-not-working/8509 "2023-07-18T00:03:00Z")

</div>

Anyone currently using the latest NSIS release and have downloadable components working? I’m finding that the ZipDLL plugin seems to be failing during an actual install (I can get it to at least build the installer), but…

---

## [Fatal error: file not found](https://discourse.cmake.org/t/fatal-error-file-not-found/8499)

<div class="topic-metadata">

**Author:** [@Xuzrxa](https://discourse.cmake.org/u/Xuzrxa)\
**Replies:** 1\
**Last updated:** [July 17, 2023, 11:41am UTC](https://discourse.cmake.org/t/fatal-error-file-not-found/8499 "2023-07-17T11:41:48Z")

</div>

what could be wrong with linking here? basically why is fileB.cpp not able to include fileA.hpp despite linking dir-B with dir-A? \> dirA \> include \> fileA.hpp \> src \> fileA.cpp add\_library(dir-A STATIC src…

---

## [How to downgrade cmake / manage versions](https://discourse.cmake.org/t/how-to-downgrade-cmake-manage-versions/8520)

<div class="topic-metadata">

**Author:** [@bdunbar](https://discourse.cmake.org/u/bdunbar)\
**Replies:** 2\
**Last updated:** [July 15, 2023, 1:26am UTC](https://discourse.cmake.org/t/how-to-downgrade-cmake-manage-versions/8520 "2023-07-15T01:26:47Z")

</div>

Newb questions \[1\] How do I remove cmake version x and downgrade to version y? How to manage cmake versions on different linux distributions? I installed the latest version of cmake - 3.27.0-rc4 \[2\]. I’d li…

---

## [How can I make an IMPORTED library show up in VS](https://discourse.cmake.org/t/how-can-i-make-an-imported-library-show-up-in-vs/8452)

<div class="topic-metadata">

**Author:** [@aidexie](https://discourse.cmake.org/u/aidexie)\
**Replies:** 2\
**Last updated:** [July 11, 2023, 5:45pm UTC](https://discourse.cmake.org/t/how-can-i-make-an-imported-library-show-up-in-vs/8452 "2023-07-11T17:45:19Z")

</div>

I have a CMake project that mostly uses 3 types of library Some libraries are compiled from source Some libraries are header only (INTERFACE) There is one library that is IMPORTED. Which means that I provide a .lib, a …

---

## [How to link debug version of Qt?](https://discourse.cmake.org/t/how-to-link-debug-version-of-qt/8492)

<div class="topic-metadata">

**Author:** [@28af2](https://discourse.cmake.org/u/28af2)\
**Replies:** 2\
**Last updated:** [July 11, 2023, 10:50am UTC](https://discourse.cmake.org/t/how-to-link-debug-version-of-qt/8492 "2023-07-11T10:50:49Z")

</div>

I have read in the Qt docs that: The Qt library contains hundreds of internal checks that will print warning messages when a programming error is detected. We therefore recommend that you use a debug version of Qt when…

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

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