# Code

**URL:** https://discourse.cmake.org/c/code/11.md?page=23

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

**Page:** 24

---

## [execute\_process 'Access is denied' for npm update.](https://discourse.cmake.org/t/execute-process-access-is-denied-for-npm-update/10358)

<div class="topic-metadata">

**Author:** [@marksibly](https://discourse.cmake.org/u/marksibly)\
**Replies:** 5\
**Last updated:** [March 14, 2024, 1:10am UTC](https://discourse.cmake.org/t/execute-process-access-is-denied-for-npm-update/10358 "2024-03-14T01:10:58Z")

</div>

Hi, I’m using cmake 3.28.3 on Windows 10 and trying to use execute\_process to call ‘npm update’ after copying package.json to binary dir. With plain “COMMAND npm update” cmake couldn’t find npm, so I tried using the fi…

---

## [add test start time to Test.xml file](https://discourse.cmake.org/t/add-test-start-time-to-test-xml-file/10355)

<div class="topic-metadata">

**Author:** [@pkiran](https://discourse.cmake.org/u/pkiran)\
**Replies:** 1\
**Last updated:** [March 13, 2024, 10:09pm UTC](https://discourse.cmake.org/t/add-test-start-time-to-test-xml-file/10355 "2024-03-13T22:09:24Z")

</div>

Hello, I would like o request if it is possible to add start time stamps of individual tests to the “Test.xml” file. Would be useful to create a execution timeline of tests from this file, since we will have start time …

---

## [CPack/install oddity with "overridden" install directive](https://discourse.cmake.org/t/cpack-install-oddity-with-overridden-install-directive/10349)

<div class="topic-metadata">

**Author:** [@robiwano](https://discourse.cmake.org/u/robiwano)\
**Replies:** 1\
**Last updated:** [March 12, 2024, 7:45pm UTC](https://discourse.cmake.org/t/cpack-install-oddity-with-overridden-install-directive/10349 "2024-03-12T19:45:22Z")

</div>

Hi, I have a project where I generate a Debian package, and I have a default install directive for a logotype file: install(FILES assets/logo.png DESTINATION www/assets COMPONENT Assets ) Then, later on an…

---

## [benchmark error](https://discourse.cmake.org/t/benchmark-error/10316)

<div class="topic-metadata">

**Author:** [@maiya](https://discourse.cmake.org/u/maiya)\
**Replies:** 3\
**Last updated:** [March 11, 2024, 8:50am UTC](https://discourse.cmake.org/t/benchmark-error/10316 "2024-03-11T08:50:44Z")

</div>

Hi Community, While building with cmake, getting benchmark errors like as below -- Building for architecture ARCH=x64 -- OPENTELEMETRY\_ABI\_VERSION\_NO=1 -- OPENTELEMETRY\_VERSION=1.14.2 GTEST\_INCLUDE\_DIRS = GTEST\_BOTH\_…

---

## [Statically link against Curl lib](https://discourse.cmake.org/t/statically-link-against-curl-lib/10324)

<div class="topic-metadata">

**Author:** [@Saviz](https://discourse.cmake.org/u/Saviz)\
**Replies:** 1\
**Last updated:** [March 10, 2024, 10:02am UTC](https://discourse.cmake.org/t/statically-link-against-curl-lib/10324 "2024-03-10T10:02:28Z")

</div>

I have the following code for fetching and linking against the Curl library: include(FetchContent) FetchContent\_Declare(curl GIT\_REPOSITORY "https://github.com/curl/curl.git" GIT\_TAG "curl-8\_6\_0" GIT\_SHALLOW TRUE) …

---

## [find\_package(BLAS) does not find OpenBLAS](https://discourse.cmake.org/t/find-package-blas-does-not-find-openblas/8414)

<div class="topic-metadata">

**Author:** [@CountZero](https://discourse.cmake.org/u/CountZero)\
**Replies:** 8\
**Last updated:** [March 10, 2024, 9:49am UTC](https://discourse.cmake.org/t/find-package-blas-does-not-find-openblas/8414 "2024-03-10T09:49:04Z")

</div>

Hi, I am using the llama.cpp project to evaluate LLMs. But on Windows I am running into a problem with CMake: The find\_package(BLAS) invocation does not find OpenBLAS. Steps to reproduce Unpack the fOpenBLAS-0.3.23-…

---

## [CMake --build error: file not found](https://discourse.cmake.org/t/cmake-build-error-file-not-found/10331)

<div class="topic-metadata">

**Author:** [@asimplecoder](https://discourse.cmake.org/u/asimplecoder)\
**Replies:** 4\
**Last updated:** [March 10, 2024, 2:45am UTC](https://discourse.cmake.org/t/cmake-build-error-file-not-found/10331 "2024-03-10T02:45:16Z")

</div>

Hi everyone, I’m working on a Fortran project, using CMake as a build system generator. To support multiple platforms, I do make use of genexes to control conditional options/definitions: if (WIN32) if (intel-compi…

---

## [toolchain swapping combined with FetchContent feature](https://discourse.cmake.org/t/toolchain-swapping-combined-with-fetchcontent-feature/10318)

<div class="topic-metadata">

**Author:** [@amerinor01](https://discourse.cmake.org/u/amerinor01)\
**Replies:** 2\
**Last updated:** [March 8, 2024, 11:50am UTC](https://discourse.cmake.org/t/toolchain-swapping-combined-with-fetchcontent-feature/10318 "2024-03-08T11:50:36Z")

</div>

Hi all. I’m new in cmake so maybe my question sound kinda dummy. I’m dealing with a 3rd part dependencies. For those dependencies I use the fetchContent to deal with the them. Each depenency have a code similar to this …

---

## [CMAKE\_SYSTEM\_NAME versus predefined variables](https://discourse.cmake.org/t/cmake-system-name-versus-predefined-variables/10311)

<div class="topic-metadata">

**Author:** [@Saviz](https://discourse.cmake.org/u/Saviz)\
**Replies:** 1\
**Last updated:** [March 7, 2024, 7:38am UTC](https://discourse.cmake.org/t/cmake-system-name-versus-predefined-variables/10311 "2024-03-07T07:38:43Z")

</div>

When working with CMake, it’s common to execute specific commands depending on the platform and operating system detected. During my research across various internet sources, I’ve encountered two commonly used snippets: …

---

## [Exception handling is inconsistent after switching to FetchContent](https://discourse.cmake.org/t/exception-handling-is-inconsistent-after-switching-to-fetchcontent/10277)

<div class="topic-metadata">

**Author:** [@Aki](https://discourse.cmake.org/u/Aki)\
**Replies:** 2\
**Last updated:** [March 6, 2024, 8:35pm UTC](https://discourse.cmake.org/t/exception-handling-is-inconsistent-after-switching-to-fetchcontent/10277 "2024-03-06T20:35:53Z")

</div>

I am migrating a codebase that included external projects in its source tree to a FetchContent-based solution. There are four that I want to move out: zlib, libpng, ogg, and vorbis. I moved the zlib out and in another sp…

---

## [How is \`CMAKE\_NINJA\_OUTPUT\_PATH\_PREFIX\` supposed to work?](https://discourse.cmake.org/t/how-is-cmake-ninja-output-path-prefix-supposed-to-work/4405)

<div class="topic-metadata">

**Author:** [@alex](https://discourse.cmake.org/u/alex)\
**Replies:** 1\
**Last updated:** [March 5, 2024, 10:02am UTC](https://discourse.cmake.org/t/how-is-cmake-ninja-output-path-prefix-supposed-to-work/4405 "2024-03-05T10:02:01Z")

</div>

Attempting to integrate two CMake-generated Ninja projects that use CMAKE\_NINJA\_OUTPUT\_PATH\_PREFIX with subninja directives fails. See the following interaction: alex@alex-ubuntu:~/Development/subninja-demo$ tree . ├── …

---

## [Adding Curl library with Fetchcontent](https://discourse.cmake.org/t/adding-curl-library-with-fetchcontent/10269)

<div class="topic-metadata">

**Author:** [@Saviz](https://discourse.cmake.org/u/Saviz)\
**Replies:** 7\
**Last updated:** [March 5, 2024, 6:33am UTC](https://discourse.cmake.org/t/adding-curl-library-with-fetchcontent/10269 "2024-03-05T06:33:28Z")

</div>

I am attempting to include the third-party Curl library as a dependency in my C++ project using CMake. I searched for instructions on how to accomplish this using the FetchContent command, and I found the following: inc…

---

## [FetchContent\_Declare and find\_package confusion](https://discourse.cmake.org/t/fetchcontent-declare-and-find-package-confusion/10074)

<div class="topic-metadata">

**Author:** [@marksibly](https://discourse.cmake.org/u/marksibly)\
**Replies:** 3\
**Last updated:** [March 2, 2024, 8:02pm UTC](https://discourse.cmake.org/t/fetchcontent-declare-and-find-package-confusion/10074 "2024-03-02T20:02:06Z")

</div>

Hi, I am trying to use FetchContent\_Declare to ‘create’ a package I can later use with find\_package but haven’t had any luck so far. Here’s my little bit of test code: FetchContent\_Declare(json11-pkg GIT\_REPOSI…

---

## [How to copy dlls to binary directory](https://discourse.cmake.org/t/how-to-copy-dlls-to-binary-directory/10154)

<div class="topic-metadata">

**Author:** [@Saviz](https://discourse.cmake.org/u/Saviz)\
**Replies:** 3\
**Last updated:** [February 29, 2024, 8:10am UTC](https://discourse.cmake.org/t/how-to-copy-dlls-to-binary-directory/10154 "2024-02-29T08:10:47Z")

</div>

I am utilizing the wxWidgets library in my projects to develop GUI applications. While I am able to successfully link against the library and run my application within my IDE environment, issues arise when attempting to …

---

## [clang-tidy for CMake?](https://discourse.cmake.org/t/clang-tidy-for-cmake/10188)

<div class="topic-metadata">

**Author:** [@cen](https://discourse.cmake.org/u/cen)\
**Replies:** 11\
**Last updated:** [February 28, 2024, 12:38pm UTC](https://discourse.cmake.org/t/clang-tidy-for-cmake/10188 "2024-02-28T12:38:35Z")

</div>

Imagine: clang-tidy CMakeLists.txt -checks=modern-\* There are many blogs and videos out there telling us how to write modern CMake but having the mental capacity to stick to those guidelines is a different story. Is th…

---

## [Do I need CMake install() command ?](https://discourse.cmake.org/t/do-i-need-cmake-install-command/10218)

<div class="topic-metadata">

**Author:** [@WaltOnline](https://discourse.cmake.org/u/WaltOnline)\
**Replies:** 5\
**Last updated:** [February 28, 2024, 10:26am UTC](https://discourse.cmake.org/t/do-i-need-cmake-install-command/10218 "2024-02-28T10:26:17Z")

</div>

Hello! My goal is to collect my own libraries in one common place from various projects, for example one project exports libsA libraries another project libsB libraries and all that libraries will be collected under MyL…

---

## [Error Messages, Qt6, Qt6Widget](https://discourse.cmake.org/t/error-messages-qt6-qt6widget/10172)

<div class="topic-metadata">

**Author:** [@OldFangle](https://discourse.cmake.org/u/OldFangle)\
**Replies:** 6\
**Last updated:** [February 28, 2024, 1:57am UTC](https://discourse.cmake.org/t/error-messages-qt6-qt6widget/10172 "2024-02-28T01:57:18Z")

</div>

Hello. I am posting a screenshot showing persistent error message that I do not understand. I have read many articles and have used GPT-4 (which has been very helpful in most ways) but my problem is that there are many…

---

## [FindVulkan.cmake can't find DXC debug libraries while present, as it's not looking for them.](https://discourse.cmake.org/t/findvulkan-cmake-cant-find-dxc-debug-libraries-while-present-as-its-not-looking-for-them/10198)

<div class="topic-metadata">

**Author:** [@Geomazzix](https://discourse.cmake.org/u/Geomazzix)\
**Replies:** 1\
**Last updated:** [February 27, 2024, 10:32pm UTC](https://discourse.cmake.org/t/findvulkan-cmake-cant-find-dxc-debug-libraries-while-present-as-its-not-looking-for-them/10198 "2024-02-27T22:32:33Z")

</div>

Hi, Some preliminary info: I am currently developing a Vulkan pet project using Vulkan SDK 1.3.268 (I did check - this SDK does include the debug libs and the debug libs are present in my installed SDK), using cmake ver…

---

## [LINK\_DEPENDS on output of add\_custom\_command, no rule to make target](https://discourse.cmake.org/t/link-depends-on-output-of-add-custom-command-no-rule-to-make-target/10179)

<div class="topic-metadata">

**Author:** [@risint96](https://discourse.cmake.org/u/risint96)\
**Replies:** 6\
**Last updated:** [February 27, 2024, 2:18pm UTC](https://discourse.cmake.org/t/link-depends-on-output-of-add-custom-command-no-rule-to-make-target/10179 "2024-02-27T14:18:34Z")

</div>

Hi, I have a project that lives in a subdirectory example of another project, can’t figure out why it keeps on complaining that: No rule to make target ‘example/linkerscript.ld’, needed by ‘example/example’. Stop. H…

---

## [COMPONENTS must be defined when there exist multiple utilities in Find modules?](https://discourse.cmake.org/t/components-must-be-defined-when-there-exist-multiple-utilities-in-find-modules/10128)

<div class="topic-metadata">

**Author:** [@hwhsu1231](https://discourse.cmake.org/u/hwhsu1231)\
**Replies:** 5\
**Last updated:** [February 27, 2024, 2:05pm UTC](https://discourse.cmake.org/t/components-must-be-defined-when-there-exist-multiple-utilities-in-find-modules/10128 "2024-02-27T14:05:21Z")

</div>

Hello, CMake Team. Let’s take FindGettext.cmake as an example. We know that Gettext has many utilities: xgettext msgattrib msgcat msginit msgmerge ...etc If today I were to write my own FindGettext.cmake, should I nec…

---

## [New user - Can't get file(ARCHIVE\_EXTRACT ...) to work](https://discourse.cmake.org/t/new-user-cant-get-file-archive-extract-to-work/10135)

<div class="topic-metadata">

**Author:** [@tuscan](https://discourse.cmake.org/u/tuscan)\
**Replies:** 2\
**Last updated:** [February 27, 2024, 1:37pm UTC](https://discourse.cmake.org/t/new-user-cant-get-file-archive-extract-to-work/10135 "2024-02-27T13:37:41Z")

</div>

Hi I am a new user of CMake (literally day one) and everything has gone swimmingly so far except for one thing - I am getting an error when use file(ARCHIVE\_EXTRACT). I am guessing it is something pretty obvious, but if…

---

## [\`write\_basic\_package\_version\_file\` and version range](https://discourse.cmake.org/t/write-basic-package-version-file-and-version-range/10021)

<div class="topic-metadata">

**Author:** [@Lecris](https://discourse.cmake.org/u/Lecris)\
**Replies:** 4\
**Last updated:** [February 24, 2024, 4:27pm UTC](https://discourse.cmake.org/t/write-basic-package-version-file-and-version-range/10021 "2024-02-24T16:27:05Z")

</div>

From reading the templates used by write\_basic\_package\_version\_file it seems that the parent project has the ultimate say of how the find\_package works, e.g. if SameMajorVersion is used, passing a range like 2.0...4.0 wi…

---

## [\[RESOLVED\] C source code not finding paths to headers in Pico SDK or my library](https://discourse.cmake.org/t/resolved-c-source-code-not-finding-paths-to-headers-in-pico-sdk-or-my-library/10163)

<div class="topic-metadata">

**Author:** [@breaker](https://discourse.cmake.org/u/breaker)\
**Replies:** 2\
**Last updated:** [February 23, 2024, 5:50pm UTC](https://discourse.cmake.org/t/resolved-c-source-code-not-finding-paths-to-headers-in-pico-sdk-or-my-library/10163 "2024-02-23T17:50:24Z")

</div>

EDIT: I made the library an INTERFACE and all is well now. I went through Step 1 and Step 2 of the official tutorial to try to get my external Raspberry Pi Pico C/C++ SDK project working with a library I am creating tha…

---

## [Retrieving artefacts from a server](https://discourse.cmake.org/t/retrieving-artefacts-from-a-server/10155)

<div class="topic-metadata">

**Author:** [@Oodini](https://discourse.cmake.org/u/Oodini)\
**Replies:** 6\
**Last updated:** [February 22, 2024, 1:01pm UTC](https://discourse.cmake.org/t/retrieving-artefacts-from-a-server/10155 "2024-02-22T13:01:30Z")

</div>

Hello, I ran from a CMakeLists.txt an install()command, zipped the result in an archive, and put it on a Nexus server. Then, in an other project, I want to use that library. So I did : include(FetchContent) FetchConte…

---

## [Different packages for Debug and Release versions ?](https://discourse.cmake.org/t/different-packages-for-debug-and-release-versions/10151)

<div class="topic-metadata">

**Author:** [@Oodini](https://discourse.cmake.org/u/Oodini)\
**Replies:** 2\
**Last updated:** [February 22, 2024, 7:32am UTC](https://discourse.cmake.org/t/different-packages-for-debug-and-release-versions/10151 "2024-02-22T07:32:08Z")

</div>

Hello, Should I group the Debug and Release versions of a library in one single package, or make a package for each ? What is the recommanded practice ?

---

## [Export third part library built with ExternalProject\_Add](https://discourse.cmake.org/t/export-third-part-library-built-with-externalproject-add/10038)

<div class="topic-metadata">

**Author:** [@KmakD](https://discourse.cmake.org/u/KmakD)\
**Replies:** 4\
**Last updated:** [February 21, 2024, 2:35pm UTC](https://discourse.cmake.org/t/export-third-part-library-built-with-externalproject-add/10038 "2024-02-21T14:35:31Z")

</div>

I need to install a library that my project depends on. To make my package more independent I moved the installation of it to cmake. I did it successfully with ExternalProject\_Add with a setup similar to the one shown be…

---

## [Problems with find\_package](https://discourse.cmake.org/t/problems-with-find-package/10146)

<div class="topic-metadata">

**Author:** [@Oodini](https://discourse.cmake.org/u/Oodini)\
**Replies:** 2\
**Last updated:** [February 21, 2024, 10:49am UTC](https://discourse.cmake.org/t/problems-with-find-package/10146 "2024-02-21T10:49:16Z")

</div>

Hello, I have troubles with the find\_package() command. I am doing a tutorial which should be known on this forum (hi @retif !), and I am now at this step : I adapted the CMakeLists.txt to my project, but it is very …

---

## [Visibility of some files in Visual Studio](https://discourse.cmake.org/t/visibility-of-some-files-in-visual-studio/10076)

<div class="topic-metadata">

**Author:** [@Oodini](https://discourse.cmake.org/u/Oodini)\
**Replies:** 3\
**Last updated:** [February 21, 2024, 8:44am UTC](https://discourse.cmake.org/t/visibility-of-some-files-in-visual-studio/10076 "2024-02-21T08:44:55Z")

</div>

Hello, I am setting a library project for Visual Studio (questions at the end of post) : └── MyLib ├── CMakeLists.txt ├── include │ └── MyLib │ └── SubLib\_1 │ └── x.h ├── src …

---

## [I can't understand an error about INTERFACE\_SOURCES and prefix](https://discourse.cmake.org/t/i-cant-understand-an-error-about-interface-sources-and-prefix/10105)

<div class="topic-metadata">

**Author:** [@Oodini](https://discourse.cmake.org/u/Oodini)\
**Replies:** 9\
**Last updated:** [February 21, 2024, 7:54am UTC](https://discourse.cmake.org/t/i-cant-understand-an-error-about-interface-sources-and-prefix/10105 "2024-02-21T07:54:40Z")

</div>

Hello, I am doing the this tutorial to deploy a library : https://decovar.dev/blog/2021/03/08/cmake-cpp-library/ I had to adapt it a little bit, but I have now a trouble when I do the Configs step. In this “chapter” t…

---

## [If FindDoxygen.cmake is to adhere to the naming conventions prescribed by cmake-developer, then...?](https://discourse.cmake.org/t/if-finddoxygen-cmake-is-to-adhere-to-the-naming-conventions-prescribed-by-cmake-developer-then/10084)

<div class="topic-metadata">

**Author:** [@hwhsu1231](https://discourse.cmake.org/u/hwhsu1231)\
**Replies:** 9\
**Last updated:** [February 19, 2024, 4:05am UTC](https://discourse.cmake.org/t/if-finddoxygen-cmake-is-to-adhere-to-the-naming-conventions-prescribed-by-cmake-developer-then/10084 "2024-02-19T04:05:25Z")

</div>

Hello, CMake Team. From the current built-in FindDoxygen.cmake, we can see that some of the related variables/import target names are as follows: Click to expand# # Version Variables # DOXYGEN\_VERSION # # Executable va…

[Previous page](https://discourse.cmake.org/c/code/11.md?page=22)

[Next page](https://discourse.cmake.org/c/code/11.md?page=24)
