# Usage

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

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

**Page:** 37

---

## [Libcurl linking on windows](https://discourse.cmake.org/t/libcurl-linking-on-windows/9259)

<div class="topic-metadata">

**Author:** [@Torsten](https://discourse.cmake.org/u/Torsten)\
**Replies:** 10\
**Last updated:** [October 31, 2023, 9:13am UTC](https://discourse.cmake.org/t/libcurl-linking-on-windows/9259 "2023-10-31T09:13:52Z")

</div>

Trying to use curl, link fails on windows. I have created a minimal project to debug the problem I have conanfile.txt \[requires\] libcurl/8.2.1 \[generators\] CMakeDeps CMakeToolchain CMakeLists.txt: cmake\_minimum\_requ…

---

## [zeros in version numbers; cmake\_policy(SET CMP0096 NEW) ?](https://discourse.cmake.org/t/zeros-in-version-numbers-cmake-policy-set-cmp0096-new/9296)

<div class="topic-metadata">

**Author:** [@LadyGreyTeaService](https://discourse.cmake.org/u/LadyGreyTeaService)\
**Replies:** 11\
**Last updated:** [October 31, 2023, 1:03am UTC](https://discourse.cmake.org/t/zeros-in-version-numbers-cmake-policy-set-cmp0096-new/9296 "2023-10-31T01:03:30Z")

</div>

I’m trying to have a zero in the minor part of version. Step1/CMakeLists.txt is cmake\_policy(SET CMP0096 NEW) cmake\_minimum\_required(VERSION 3.22.…

---

## [Adding CMake support to existing library](https://discourse.cmake.org/t/adding-cmake-support-to-existing-library/9306)

<div class="topic-metadata">

**Author:** [@fsimonis](https://discourse.cmake.org/u/fsimonis)\
**Replies:** 2\
**Last updated:** [October 30, 2023, 8:57pm UTC](https://discourse.cmake.org/t/adding-cmake-support-to-existing-library/9306 "2023-10-30T20:57:16Z")

</div>

Hi, I try to keep this question and its context as generic as possible, to help others who may be facing a similar challenge. Also, @craig.scott s excellent Professional CMake barely touches this part and I hope this qu…

---

## [Tutorial Step2 Exercise 2 - Adding an Option Solutions](https://discourse.cmake.org/t/tutorial-step2-exercise-2-adding-an-option-solutions/9312)

<div class="topic-metadata">

**Author:** [@LadyGreyTeaService](https://discourse.cmake.org/u/LadyGreyTeaService)\
**Replies:** 1\
**Last updated:** [October 30, 2023, 7:08pm UTC](https://discourse.cmake.org/t/tutorial-step2-exercise-2-adding-an-option-solutions/9312 "2023-10-30T19:08:28Z")

</div>

Tutorial Exercise 2 - Adding an Option Solutions https://cmake.org/cmake/help/latest/guide/tutorial/Adding%20a%20Library.html#id6 Should the solution for TODO 11 be #ifndef USE\_MYMATH # include \<cmath\> #endif instea…

---

## [Tutorial. More things that might confuse a stupid person](https://discourse.cmake.org/t/tutorial-more-things-that-might-confuse-a-stupid-person/9305)

<div class="topic-metadata">

**Author:** [@LadyGreyTeaService](https://discourse.cmake.org/u/LadyGreyTeaService)\
**Replies:** 3\
**Last updated:** [October 30, 2023, 5:20pm UTC](https://discourse.cmake.org/t/tutorial-more-things-that-might-confuse-a-stupid-person/9305 "2023-10-30T17:20:56Z")

</div>

Another mistake a stupid person might make (don’t ask me how I know) during the tutorial, would be to initially cd Step1\_build cmake ../Step1/CMakeLists.txt which creates the make file and other shiz in the Step1 folde…

---

## [How to tell "Visual Studio 16 2019" generator to generate log file?](https://discourse.cmake.org/t/how-to-tell-visual-studio-16-2019-generator-to-generate-log-file/9308)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 2\
**Last updated:** [October 30, 2023, 3:21pm UTC](https://discourse.cmake.org/t/how-to-tell-visual-studio-16-2019-generator-to-generate-log-file/9308 "2023-10-30T15:21:40Z")

</div>

Hi, when running msbuild from the command line I can specify a log file using ‘/flp:logfile’ as follows: msbuild my\_sln.sln /p:Configuration=Release /p:Platform="x64" /flp:logfile=my\_logfile.log /verbosity:normal To bu…

---

## [Is it possible to iterate over generated files in the build output directory?](https://discourse.cmake.org/t/is-it-possible-to-iterate-over-generated-files-in-the-build-output-directory/9303)

<div class="topic-metadata">

**Author:** [@andi\_schacherbauer](https://discourse.cmake.org/u/andi_schacherbauer)\
**Replies:** 3\
**Last updated:** [October 30, 2023, 2:12pm UTC](https://discourse.cmake.org/t/is-it-possible-to-iterate-over-generated-files-in-the-build-output-directory/9303 "2023-10-30T14:12:09Z")

</div>

Hi, we have a Qt project and the Qt tool ‘rcc’ is generating .cpp files during the build step. We need to specify additional compile flags (change symbol visibility) and I was wondering if we can somehow iterate over tho…

---

## [CPack rpm and failed dependencies when install](https://discourse.cmake.org/t/cpack-rpm-and-failed-dependencies-when-install/9285)

<div class="topic-metadata">

**Author:** [@kelvenxu](https://discourse.cmake.org/u/kelvenxu)\
**Replies:** 2\
**Last updated:** [October 30, 2023, 1:20pm UTC](https://discourse.cmake.org/t/cpack-rpm-and-failed-dependencies-when-install/9285 "2023-10-30T13:20:20Z")

</div>

In my project, I use below code to import cuda library find\_package(CUDAToolkit) target\_link\_libraries(${target} PRIVATE CUDA::cudart) target\_link\_libraries(${target} PRIVATE CUDA::cufft) target\_link\_libraries($…

---

## [Cross compiling from a Windows host targeting raspbian 32 bits arm](https://discourse.cmake.org/t/cross-compiling-from-a-windows-host-targeting-raspbian-32-bits-arm/9250)

<div class="topic-metadata">

**Author:** [@VivienDelmon](https://discourse.cmake.org/u/VivienDelmon)\
**Replies:** 6\
**Last updated:** [October 29, 2023, 12:30pm UTC](https://discourse.cmake.org/t/cross-compiling-from-a-windows-host-targeting-raspbian-32-bits-arm/9250 "2023-10-29T12:30:44Z")

</div>

Hi, I am having some trouble setting up a cross compiling build environment from a Windows host targeting raspbian 32 bits arm. If I directly use the cross compiler to build a hello world it works fine and run on my tar…

---

## [Tutorial Step1 Error](https://discourse.cmake.org/t/tutorial-step1-error/9292)

<div class="topic-metadata">

**Author:** [@LadyGreyTeaService](https://discourse.cmake.org/u/LadyGreyTeaService)\
**Replies:** 2\
**Last updated:** [October 27, 2023, 12:05pm UTC](https://discourse.cmake.org/t/tutorial-step1-error/9292 "2023-10-27T12:05:31Z")

</div>

https://cmake.org/cmake/help/latest/guide/tutorial/A%20Basic%20Starting%20Point.html Says mkdir Step1\_build cd Step1\_build cmake ../Step1 The last command should be cmake .. Please fix this. It gives a very bad f…

---

## [FetchContent\_Declare SYSTEM property for hierarchical dependencies](https://discourse.cmake.org/t/fetchcontent-declare-system-property-for-hierarchical-dependencies/9198)

<div class="topic-metadata">

**Author:** [@psyinf](https://discourse.cmake.org/u/psyinf)\
**Replies:** 4\
**Last updated:** [October 26, 2023, 7:19am UTC](https://discourse.cmake.org/t/fetchcontent-declare-system-property-for-hierarchical-dependencies/9198 "2023-10-26T07:19:32Z")

</div>

Hi, We’re currently using the SYSTEM property to ignore warnings for imported libraries (lets call them B,C,…) (via FetchContent) into a library A. This works very well, but when we are then consume library A in anothe…

---

## [Install( ... RUNTIME\_DEPENDENCIES ...) doesn't set @RPATH on MacOS](https://discourse.cmake.org/t/install-runtime-dependencies-doesnt-set-rpath-on-macos/9260)

<div class="topic-metadata">

**Author:** [@RichS](https://discourse.cmake.org/u/RichS)\
**Replies:** 2\
**Last updated:** [October 23, 2023, 7:49pm UTC](https://discourse.cmake.org/t/install-runtime-dependencies-doesnt-set-rpath-on-macos/9260 "2023-10-23T19:49:16Z")

</div>

Using CMake’s install command with the RUNTIME\_DEPENDENCIES option correctly bundles a required third party library into my install directory. But it doesn’t set the RPATH for that library. So, post install I have a l…

---

## [C++20 modules and packages?](https://discourse.cmake.org/t/c-20-modules-and-packages/9253)

<div class="topic-metadata">

**Author:** [@Glad](https://discourse.cmake.org/u/Glad)\
**Replies:** 2\
**Last updated:** [October 23, 2023, 7:00pm UTC](https://discourse.cmake.org/t/c-20-modules-and-packages/9253 "2023-10-23T19:00:35Z")

</div>

Hi, That question may look stupid for those more experienced than me with Cmake, but will c++20 modules make Cmake packages (using cpack) less relevant if only targeting c++ libs? My idea is that you will have everythi…

---

## [MPI recognition with Conda on Apple silicon](https://discourse.cmake.org/t/mpi-recognition-with-conda-on-apple-silicon/9252)

<div class="topic-metadata">

**Author:** [@Benedikt.biller](https://discourse.cmake.org/u/Benedikt.biller)\
**Replies:** 3\
**Last updated:** [October 23, 2023, 5:39pm UTC](https://discourse.cmake.org/t/mpi-recognition-with-conda-on-apple-silicon/9252 "2023-10-23T17:39:01Z")

</div>

Hi, I am building a make file with Cmake version 3.27 on a MacBook with Sonoma and an Apple Silicon M2 Chip. Also, I use a Conda environment with Cmake, make, clang, mpich and hdf5 installed. When running Cmake (Conda…

---

## [\[3.28.0-rc | Regression?\] vcpkg error: building zlib:x64-windows failed with: BUILD\_FAILED](https://discourse.cmake.org/t/3-28-0-rc-regression-vcpkg-error-building-zlib-x64-windows-failed-with-build-failed/9230)

<div class="topic-metadata">

**Author:** [@Naheulf](https://discourse.cmake.org/u/Naheulf)\
**Replies:** 3\
**Last updated:** [October 23, 2023, 4:11pm UTC](https://discourse.cmake.org/t/3-28-0-rc-regression-vcpkg-error-building-zlib-x64-windows-failed-with-build-failed/9230 "2023-10-23T16:11:53Z")

</div>

Got BUILD\_FAILED error message trying to install zlib with vcpkg and CMake 3.28.0-rc1 or CMake 3.28.0-rc2. For more details see \[zlib\] build failure with vcpkg · Issue #34597 · microsoft/vcpkg · GitHub (Resolved by usin…

---

## [Ignoring Anaconda Python prefix](https://discourse.cmake.org/t/ignoring-anaconda-python-prefix/8831)

<div class="topic-metadata">

**Author:** [@scivision](https://discourse.cmake.org/u/scivision)\
**Replies:** 1\
**Last updated:** [October 23, 2023, 2:57pm UTC](https://discourse.cmake.org/t/ignoring-anaconda-python-prefix/8831 "2023-10-23T14:57:03Z")

</div>

My user audience often has Anaconda Python installed with Shared libraries on Path that are not ABI compatible with the desired compiler. Example: python h5py package needs libhdf5.so to work in Python, but for my compi…

---

## [LNK1104: cannot open file .lib error in CMAKE](https://discourse.cmake.org/t/lnk1104-cannot-open-file-lib-error-in-cmake/9246)

<div class="topic-metadata">

**Author:** [@nagyyon](https://discourse.cmake.org/u/nagyyon)\
**Replies:** 3\
**Last updated:** [October 23, 2023, 2:25pm UTC](https://discourse.cmake.org/t/lnk1104-cannot-open-file-lib-error-in-cmake/9246 "2023-10-23T14:25:49Z")

</div>

I only have installed VS2022 (with desktop development with C++ checked, and Windows 11 SDK 10.0.22621.0), along with Intel Fortran Compiler (IFORT) from intel’s oneapi HPC Toolkit. In CMAKE 3.26.3 GUI, when I try to Co…

---

## [Troubles overriding MT/MD compilation flags](https://discourse.cmake.org/t/troubles-overriding-mt-md-compilation-flags/9248)

<div class="topic-metadata">

**Author:** [@Retro52](https://discourse.cmake.org/u/Retro52)\
**Replies:** 1\
**Last updated:** [October 23, 2023, 12:21pm UTC](https://discourse.cmake.org/t/troubles-overriding-mt-md-compilation-flags/9248 "2023-10-23T12:21:02Z")

</div>

Hi! I was working on transferring the project from using msbuild/make to cmake, and I encountered a problem overriding the -MD/-MDd compilation options The FAQ | Wiki suggests using either manual replace or cmake flags…

---

## [cmake --build --preset=default from non-SOURCE\_DIR](https://discourse.cmake.org/t/cmake-build-preset-default-from-non-source-dir/3300)

<div class="topic-metadata">

**Author:** [@Kris\_Malfettone](https://discourse.cmake.org/u/Kris_Malfettone)\
**Replies:** 8\
**Last updated:** [October 20, 2023, 9:29pm UTC](https://discourse.cmake.org/t/cmake-build-preset-default-from-non-source-dir/3300 "2023-10-20T21:29:13Z")

</div>

Hi there, first of all I wanted to say the new “presets” feature is amazing and definitely has the possibility to fundementally change how we interact with CMake in the future. However, for some reason the following us…

---

## [Using find\_file with an indirected variable name](https://discourse.cmake.org/t/using-find-file-with-an-indirected-variable-name/9212)

<div class="topic-metadata">

**Author:** [@EosPengwern](https://discourse.cmake.org/u/EosPengwern)\
**Replies:** 3\
**Last updated:** [October 19, 2023, 1:35pm UTC](https://discourse.cmake.org/t/using-find-file-with-an-indirected-variable-name/9212 "2023-10-19T13:35:47Z")

</div>

I’d expect this to work: set(releaseLibName "lib${target}\_${requiredVersion}\_Rel") find\_file(${releaseLibName} NAMES lib${target}\_${requiredVersion}.${EXTvar} PATHS ${MY\_PATHS} DOC "${targ…

---

## [Build is compiling against system include directory when it should be compiling against sub-project include directory](https://discourse.cmake.org/t/build-is-compiling-against-system-include-directory-when-it-should-be-compiling-against-sub-project-include-directory/9211)

<div class="topic-metadata">

**Author:** [@boxerab](https://discourse.cmake.org/u/boxerab)\
**Replies:** 3\
**Last updated:** [October 19, 2023, 1:28pm UTC](https://discourse.cmake.org/t/build-is-compiling-against-system-include-directory-when-it-should-be-compiling-against-sub-project-include-directory/9211 "2023-10-19T13:28:02Z")

</div>

This is a reported issue on MacOS 13.3 Here is the issue on github for more context My project grok uses another library, highway, using these commands: set(HWY\_ENABLE\_EXAMPLES OFF CACHE BOOL "Enable HWY examples") se…

---

## [Trying to create a custom target](https://discourse.cmake.org/t/trying-to-create-a-custom-target/9218)

<div class="topic-metadata">

**Author:** [@ChristophR](https://discourse.cmake.org/u/ChristophR)\
**Replies:** 2\
**Last updated:** [October 19, 2023, 9:47am UTC](https://discourse.cmake.org/t/trying-to-create-a-custom-target/9218 "2023-10-19T09:47:54Z")

</div>

I am trying to create a custom target which creates a downloadable image after linking. I have an executable target, let’s call it some\_ELF. I want to produce an image using an objcopy variant (diab compiler’s ddump, ho…

---

## [How to specify a dll as debug and other dll as release?](https://discourse.cmake.org/t/how-to-specify-a-dll-as-debug-and-other-dll-as-release/9215)

<div class="topic-metadata">

**Author:** [@zhang-qiang-github](https://discourse.cmake.org/u/zhang-qiang-github)\
**Replies:** 2\
**Last updated:** [October 19, 2023, 7:56am UTC](https://discourse.cmake.org/t/how-to-specify-a-dll-as-debug-and-other-dll-as-release/9215 "2023-10-19T07:56:31Z")

</div>

In vs, I have 10 dll projects. Generally, I run it in release. Sometime, I need to debug one dll. So, I will manually change the dll from release to debug by: property → c/c++ → general → debugging information → /Zi p…

---

## [Qt5 root path error](https://discourse.cmake.org/t/qt5-root-path-error/9208)

<div class="topic-metadata">

**Author:** [@emesse92](https://discourse.cmake.org/u/emesse92)\
**Replies:** 1\
**Last updated:** [October 19, 2023, 1:28am UTC](https://discourse.cmake.org/t/qt5-root-path-error/9208 "2023-10-19T01:28:58Z")

</div>

Hi there, I’m a total newbie here asking for your help to understand this, I’m trying to build a project on Windows called OpenRV \>\> GitHub - AcademySoftwareFoundation/OpenRV: Open source version of RV, the Sci-Tech aw…

---

## [Running ctest on a lsf cluster](https://discourse.cmake.org/t/running-ctest-on-a-lsf-cluster/9220)

<div class="topic-metadata">

**Author:** [@pkiran](https://discourse.cmake.org/u/pkiran)\
**Replies:** 0\
**Last updated:** [October 18, 2023, 8:40pm UTC](https://discourse.cmake.org/t/running-ctest-on-a-lsf-cluster/9220 "2023-10-18T20:40:09Z")

</div>

Hello all, What would be the recommended practice for running individual or group of tests on a cluster like lsf or grid engine. Ctest resource description seems useful for such scenarios. Would be interested in what com…

---

## [ld: not found. -lcusolver: No file or directory](https://discourse.cmake.org/t/ld-not-found-lcusolver-no-file-or-directory/9205)

<div class="topic-metadata">

**Author:** [@A\_007](https://discourse.cmake.org/u/A_007)\
**Replies:** 5\
**Last updated:** [October 17, 2023, 12:56pm UTC](https://discourse.cmake.org/t/ld-not-found-lcusolver-no-file-or-directory/9205 "2023-10-17T12:56:27Z")

</div>

Hello when i use cmake to complie my project,it have complie successfully,but when i got the link stage but i got the probelm like this ld: not found. -lcusolver: No file or directory ld: Not found -lcublas: No file …

---

## [Target visibility controls (who may depend on a target)](https://discourse.cmake.org/t/target-visibility-controls-who-may-depend-on-a-target/9194)

<div class="topic-metadata">

**Author:** [@aallrd](https://discourse.cmake.org/u/aallrd)\
**Replies:** 3\
**Last updated:** [October 16, 2023, 2:11pm UTC](https://discourse.cmake.org/t/target-visibility-controls-who-may-depend-on-a-target/9194 "2023-10-16T14:11:22Z")

</div>

Hello, I am trying to figure out if CMake has a feature to control the visibility of a target, as in what other target may depend on target. This is the target visibility concept of Bazel: 顯示設定 | Bazel I am working …

---

## [Error while installing bootstrap](https://discourse.cmake.org/t/error-while-installing-bootstrap/9176)

<div class="topic-metadata">

**Author:** [@Nicolas\_Nguyen](https://discourse.cmake.org/u/Nicolas_Nguyen)\
**Replies:** 3\
**Last updated:** [October 13, 2023, 11:40pm UTC](https://discourse.cmake.org/t/error-while-installing-bootstrap/9176 "2023-10-13T23:40:05Z")

</div>

Hello, Beginner here, trying ot install CARLA built from source. I have some issue installing Bootstrap, it ends up with an error : /c/Users/Colibus/Documents/CARLA\_SW\_REQ/cmake-3.27.7/Bootstrap.cmk/cmsys/Configure.h:…

---

## [missing hierarchy in pico-sdk-path](https://discourse.cmake.org/t/missing-hierarchy-in-pico-sdk-path/9196)

<div class="topic-metadata">

**Author:** [@andre](https://discourse.cmake.org/u/andre)\
**Replies:** 1\
**Last updated:** [October 13, 2023, 4:56pm UTC](https://discourse.cmake.org/t/missing-hierarchy-in-pico-sdk-path/9196 "2023-10-13T16:56:10Z")

</div>

Hello all, I am new to CMake but wanna use it and learn more about due to experimenting with a pico-board with an RP20204 chip. But kind of getting frustrated already with the toolchain… :-/ I followed the steps in “Ge…

---

## [Scanning Control in 3.28 for module dependencies](https://discourse.cmake.org/t/scanning-control-in-3-28-for-module-dependencies/9191)

<div class="topic-metadata">

**Author:** [@Codeboybebop](https://discourse.cmake.org/u/Codeboybebop)\
**Replies:** 1\
**Last updated:** [October 12, 2023, 10:48pm UTC](https://discourse.cmake.org/t/scanning-control-in-3-28-for-module-dependencies/9191 "2023-10-12T22:48:49Z")

</div>

I don’t understand the behavior of CMake scanning control. My CmakeLists.txt is modification of example from here cmake\_minimum\_required(VERSION 3.26) project(std\_module\_example CXX) set(CMAKE\_CXX\_FLAGS "-lstdc++ -fus…

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

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