# Usage

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

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

**Page:** 41

---

## ["Access is denied" error while running cmake command in windows 11 command line](https://discourse.cmake.org/t/access-is-denied-error-while-running-cmake-command-in-windows-11-command-line/8750)

<div class="topic-metadata">

**Author:** [@SrinivasRagolu-AlifS](https://discourse.cmake.org/u/SrinivasRagolu-AlifS)\
**Replies:** 7\
**Last updated:** [August 16, 2023, 4:44pm UTC](https://discourse.cmake.org/t/access-is-denied-error-while-running-cmake-command-in-windows-11-command-line/8750 "2023-08-16T16:44:29Z")

</div>

Hi, I have been using below versions for build machine learning code CMake → 3.27.1 Ninja —\> 1.11.1 Python → 3.9.0 Make → 3.81 while building below commands for GitHub - alifsemi/alif\_ml-embedded-evaluation-kit: Alif…

---

## [CMakeUserPresets.json: how to store Cmake options usually passed to the command line with -D ??](https://discourse.cmake.org/t/cmakeuserpresets-json-how-to-store-cmake-options-usually-passed-to-the-command-line-with-d/7603)

<div class="topic-metadata">

**Author:** [@netcorefan1](https://discourse.cmake.org/u/netcorefan1)\
**Replies:** 3\
**Last updated:** [August 16, 2023, 1:38pm UTC](https://discourse.cmake.org/t/cmakeuserpresets-json-how-to-store-cmake-options-usually-passed-to-the-command-line-with-d/7603 "2023-08-16T13:38:04Z")

</div>

Hello, after playing for hours in trying to do what is supposed to be the main purpose of the user presets, I have no other chances than opening a topic here. I would like to store the options variables in CMakeUserPre…

---

## [nvlink segv w. clang as the cuda compiler](https://discourse.cmake.org/t/nvlink-segv-w-clang-as-the-cuda-compiler/8742)

<div class="topic-metadata">

**Author:** [@Burlen\_Loring](https://discourse.cmake.org/u/Burlen_Loring)\
**Replies:** 1\
**Last updated:** [August 15, 2023, 4:40pm UTC](https://discourse.cmake.org/t/nvlink-segv-w-clang-as-the-cuda-compiler/8742 "2023-08-15T16:40:42Z")

</div>

Hi All, as the title says, I’m using clang as both C++ and CUDA compiler. However, I found that w. recent versions of clang, including mainline nightly build, my project build fails due to a segv when device linking. Cm…

---

## [MYSYS2 MINGW64 Cmake Error](https://discourse.cmake.org/t/mysys2-mingw64-cmake-error/8732)

<div class="topic-metadata">

**Author:** [@LucWuz](https://discourse.cmake.org/u/LucWuz)\
**Replies:** 1\
**Last updated:** [August 14, 2023, 1:02am UTC](https://discourse.cmake.org/t/mysys2-mingw64-cmake-error/8732 "2023-08-14T01:02:39Z")

</div>

I’ve been trying to modify the game “PSXFunkin” for days by Msys2 Using the tutorial from this link I followed each step of the tutorial until git was not found, but I managed to solve it now in the “Compiling mkpsxi…

---

## [GHS\_TOOLSET\_ROOT directory "" does not exist](https://discourse.cmake.org/t/ghs-toolset-root-directory-does-not-exist/8730)

<div class="topic-metadata">

**Author:** [@abdullah.azayem](https://discourse.cmake.org/u/abdullah.azayem)\
**Replies:** 0\
**Last updated:** [August 13, 2023, 10:17am UTC](https://discourse.cmake.org/t/ghs-toolset-root-directory-does-not-exist/8730 "2023-08-13T10:17:56Z")

</div>

In which place I can find that directory.

---

## [Diamond module dependencies](https://discourse.cmake.org/t/diamond-module-dependencies/8727)

<div class="topic-metadata">

**Author:** [@AndrzejB](https://discourse.cmake.org/u/AndrzejB)\
**Replies:** 2\
**Last updated:** [August 12, 2023, 10:32pm UTC](https://discourse.cmake.org/t/diamond-module-dependencies/8727 "2023-08-12T22:32:22Z")

</div>

I have application which uses two modules : editor and viewer, I don’t want install them but add as git submodules. Both of them uses syntax highlighting module. Application can simply uses it as three static libraries,…

---

## [Cannot find boost when using Toolchain file](https://discourse.cmake.org/t/cannot-find-boost-when-using-toolchain-file/8718)

<div class="topic-metadata">

**Author:** [@jshanab](https://discourse.cmake.org/u/jshanab)\
**Replies:** 1\
**Last updated:** [August 11, 2023, 2:11pm UTC](https://discourse.cmake.org/t/cannot-find-boost-when-using-toolchain-file/8718 "2023-08-11T14:11:50Z")

</div>

My CMake has worked with linux and windows and I am trying to extend it to work for our embedded linux devices that use an aarch64 processor. All the artifacts are in Artifactory and are pulled down into /opt/{product}/…

---

## [Cmake not running on AIX 7.1,7.2](https://discourse.cmake.org/t/cmake-not-running-on-aix-7-1-7-2/7989)

<div class="topic-metadata">

**Author:** [@tmx1835](https://discourse.cmake.org/u/tmx1835)\
**Replies:** 23\
**Last updated:** [August 10, 2023, 5:49pm UTC](https://discourse.cmake.org/t/cmake-not-running-on-aix-7-1-7-2/7989 "2023-08-10T17:49:25Z")

</div>

i have a very simple test cmake project which i am trying to build on aix 7.2. its as simple as it gets. cmake\_minimum\_required(VERSION 3.10) project(myapp LANGUAGES CXX) add\_executable(myapp myapp.cpp) when i run Cm…

---

## [Can't find CMakeCache.txt, but need to delete and regenerate it.](https://discourse.cmake.org/t/cant-find-cmakecache-txt-but-need-to-delete-and-regenerate-it/8708)

<div class="topic-metadata">

**Author:** [@Ythene](https://discourse.cmake.org/u/Ythene)\
**Replies:** 2\
**Last updated:** [August 9, 2023, 11:59pm UTC](https://discourse.cmake.org/t/cant-find-cmakecache-txt-but-need-to-delete-and-regenerate-it/8708 "2023-08-09T23:59:18Z")

</div>

Hello! I am attempting to CMake FreeGLUT on 64-bit Windows, and I’m running into some issues. I created a build/ directory and ran the following command: cmake.exe -G "MinGW Makefiles" -DCMAKE\_C\_COMPILER=C:\\\\msys64\\\\mi…

---

## [ExternalProject: Ninja doesn't show progress](https://discourse.cmake.org/t/externalproject-ninja-doesnt-show-progress/8706)

<div class="topic-metadata">

**Author:** [@scivision](https://discourse.cmake.org/u/scivision)\
**Replies:** 2\
**Last updated:** [August 9, 2023, 4:20pm UTC](https://discourse.cmake.org/t/externalproject-ninja-doesnt-show-progress/8706 "2023-08-09T16:20:25Z")

</div>

My CMake projects frequently build large subprojects with ExternalProject (EP). When using Ninja, during the overall project build, ExternalProject doesn’t print any text until each EP step completes. For example, if th…

---

## [Ccmake ver is different than cmake](https://discourse.cmake.org/t/ccmake-ver-is-different-than-cmake/3096)

<div class="topic-metadata">

**Author:** [@Kirk\_Pennock](https://discourse.cmake.org/u/Kirk_Pennock)\
**Replies:** 17\
**Last updated:** [August 8, 2023, 7:53pm UTC](https://discourse.cmake.org/t/ccmake-ver-is-different-than-cmake/3096 "2023-08-08T19:53:39Z")

</div>

I just upgraded from 3.10 on ubuntu 18.04 to 3.20. Is there a matching version of ccmake or a gui? Am I supposed to use the ccmake ver 3.10 with cmake 3.20? Thanks

---

## [find\_library cannot find .so when cross-compiling ARM under Windows](https://discourse.cmake.org/t/find-library-cannot-find-so-when-cross-compiling-arm-under-windows/8676)

<div class="topic-metadata">

**Author:** [@Mactarvish](https://discourse.cmake.org/u/Mactarvish)\
**Replies:** 5\
**Last updated:** [August 8, 2023, 9:20am UTC](https://discourse.cmake.org/t/find-library-cannot-find-so-when-cross-compiling-arm-under-windows/8676 "2023-08-08T09:20:12Z")

</div>

I’m cross-compiling an Android executable which need a dynamic library named libplate\_recognizer.so using Visual Studio on Win11, and I’m trying to use find\_library to find the library: ... find\_library(tttt …

---

## [Version "5.240.0"](https://discourse.cmake.org/t/version-5-240-0/8690)

<div class="topic-metadata">

**Author:** [@AndrzejB](https://discourse.cmake.org/u/AndrzejB)\
**Replies:** 1\
**Last updated:** [August 7, 2023, 5:47pm UTC](https://discourse.cmake.org/t/version-5-240-0/8690 "2023-08-07T17:47:41Z")

</div>

KDE Syntax Highlighter requires version “5.240.0” whereas in github and invent.kde.org repositories last tag is v5.102.0-rc1

---

## [Postprocessing of Compilation Database](https://discourse.cmake.org/t/postprocessing-of-compilation-database/8688)

<div class="topic-metadata">

**Author:** [@Steffen\_Nuessle](https://discourse.cmake.org/u/Steffen_Nuessle)\
**Replies:** 6\
**Last updated:** [August 7, 2023, 5:46pm UTC](https://discourse.cmake.org/t/postprocessing-of-compilation-database/8688 "2023-08-07T17:46:49Z")

</div>

Hello, projects dealing with compilers targeting embedded systems (Greenhills, TASKING, HighTec, etc.) have to use compile flags not known to e.g. clang tools. This often leads to such tools completely bailing out du…

---

## [How to get the number of build jobs ?](https://discourse.cmake.org/t/how-to-get-the-number-of-build-jobs/8687)

<div class="topic-metadata">

**Author:** [@nim65s](https://discourse.cmake.org/u/nim65s)\
**Replies:** 1\
**Last updated:** [August 7, 2023, 11:31am UTC](https://discourse.cmake.org/t/how-to-get-the-number-of-build-jobs/8687 "2023-08-07T11:31:58Z")

</div>

Hi, I can see that cmake --build . -j N and export CMAKE\_BUILD\_PARALLEL\_LEVEL=N will pass this number to the generator. Is there a way to get this number in a variable in a CMakeLists.txt or something ? My current use…

---

## [Can't find MPI C library for Windows](https://discourse.cmake.org/t/cant-find-mpi-c-library-for-windows/8679)

<div class="topic-metadata">

**Author:** [@ThienNZ](https://discourse.cmake.org/u/ThienNZ)\
**Replies:** 1\
**Last updated:** [August 7, 2023, 11:26am UTC](https://discourse.cmake.org/t/cant-find-mpi-c-library-for-windows/8679 "2023-08-07T11:26:22Z")

</div>

Hi, I’m very new to using CMake trying to do something similar to this user and their post. Hopefully this is the right place to ask for help. I’m trying to include Microsoft MPI (MSMPI) into this build which is the li…

---

## [adding component to existing namespace/package](https://discourse.cmake.org/t/adding-component-to-existing-namespace-package/8670)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 3\
**Last updated:** [August 7, 2023, 11:22am UTC](https://discourse.cmake.org/t/adding-component-to-existing-namespace-package/8670 "2023-08-07T11:22:48Z")

</div>

Hi, Let say I’ve already got a bunch of libraries that can be link into other project by: find\_package(PackageName COMPONENTS Comp1 Comp2...) How can I make another library project that can be added to PackageName as…

---

## [How is ExternalProject\_Add's BINARY\_DIR meant to be set with CMAKE\_CROSS\_CONFIGS + CMAKE\_DEFAULT\_CONFIGS == all](https://discourse.cmake.org/t/how-is-externalproject-adds-binary-dir-meant-to-be-set-with-cmake-cross-configs-cmake-default-configs-all/8648)

<div class="topic-metadata">

**Author:** [@alcroito](https://discourse.cmake.org/u/alcroito)\
**Replies:** 2\
**Last updated:** [August 4, 2023, 2:05pm UTC](https://discourse.cmake.org/t/how-is-externalproject-adds-binary-dir-meant-to-be-set-with-cmake-cross-configs-cmake-default-configs-all/8648 "2023-08-04T14:05:04Z")

</div>

Consider the following short project: cmake\_minimum\_required(VERSION 3.16) set(CMAKE\_CONFIGURATION\_TYPES "RelWithDebInfo;Debug") set(CMAKE\_DEFAULT\_BUILD\_TYPE "RelWithDebInfo") set(CMAKE\_DEFAULT\_CONFIGS "all") set(CMAKE\_…

---

## [Change directory of build](https://discourse.cmake.org/t/change-directory-of-build/8671)

<div class="topic-metadata">

**Author:** [@Alex2671](https://discourse.cmake.org/u/Alex2671)\
**Replies:** 5\
**Last updated:** [August 3, 2023, 1:32pm UTC](https://discourse.cmake.org/t/change-directory-of-build/8671 "2023-08-03T13:32:00Z")

</div>

Greetings! i have a project located on one place with src, build , install folders. After building project(that consume a lot of time), i want to copy full folder structure in another place without rebilding again. Howev…

---

## [How to Pass CMake variables into Wix fragments?](https://discourse.cmake.org/t/how-to-pass-cmake-variables-into-wix-fragments/8664)

<div class="topic-metadata">

**Author:** [@gergap](https://discourse.cmake.org/u/gergap)\
**Replies:** 0\
**Last updated:** [August 2, 2023, 3:37pm UTC](https://discourse.cmake.org/t/how-to-pass-cmake-variables-into-wix-fragments/8664 "2023-08-02T15:37:54Z")

</div>

I’m currently struggeling with a custom CPackWiXPatch file where I’m referencing a bmp file for a dialog banner. I can use a hardcoded path (for testing) which works, but I need to make this relative to CMAKE\_SOURCE\_DIR…

---

## [when i use cmake on windows for installing ps5 sdk, some problem happend...](https://discourse.cmake.org/t/when-i-use-cmake-on-windows-for-installing-ps5-sdk-some-problem-happend/8660)

<div class="topic-metadata">

**Author:** [@dbw03234](https://discourse.cmake.org/u/dbw03234)\
**Replies:** 1\
**Last updated:** [August 2, 2023, 10:44am UTC](https://discourse.cmake.org/t/when-i-use-cmake-on-windows-for-installing-ps5-sdk-some-problem-happend/8660 "2023-08-02T10:44:11Z")

</div>

problems are belows… Platform/Prospero to use this system, please post your config file on discourse.cmake.org so it can be added to cmake Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please post that f…

---

## [CMake Error 'Operation not permitted' in new WSL Ubuntu session](https://discourse.cmake.org/t/cmake-error-operation-not-permitted-in-new-wsl-ubuntu-session/3681)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 7\
**Last updated:** [August 2, 2023, 9:03am UTC](https://discourse.cmake.org/t/cmake-error-operation-not-permitted-in-new-wsl-ubuntu-session/3681 "2023-08-02T09:03:48Z")

</div>

We have just installed WSL Ubuntu 20.04 on Windows and installed CMake v.3.20.5. Our CMake project is known to work but we see: CMake Error at /usr/local/share/cmake-3.20/Modules/CheckIncludeFile.cmake:57 (configure\_fil…

---

## [add\_custom\_command with multpile commands when first fails](https://discourse.cmake.org/t/add-custom-command-with-multpile-commands-when-first-fails/8647)

<div class="topic-metadata">

**Author:** [@Barry\_Revzin](https://discourse.cmake.org/u/Barry_Revzin)\
**Replies:** 1\
**Last updated:** [August 1, 2023, 2:55am UTC](https://discourse.cmake.org/t/add-custom-command-with-multpile-commands-when-first-fails/8647 "2023-08-01T02:55:31Z")

</div>

Given: add\_custom\_command( COMMAND c1 COMMAND c2 ... ) Is it necessarily the case that if c1 fails, c2 is not run? The documentation just says that c1 and c2 are executed in order: Specify the command-li…

---

## [(CPack) Package subdirectories into two packages](https://discourse.cmake.org/t/cpack-package-subdirectories-into-two-packages/8646)

<div class="topic-metadata">

**Author:** [@Beanavil](https://discourse.cmake.org/u/Beanavil)\
**Replies:** 1\
**Last updated:** [July 31, 2023, 10:58pm UTC](https://discourse.cmake.org/t/cpack-package-subdirectories-into-two-packages/8646 "2023-07-31T22:58:15Z")

</div>

I am working with 3 repositories, adding DEB packaging for the three of them. One of them (let’s call it project X) is packaged into two packages using two components: runtime and dev. Now I have a repo that adds the th…

---

## [CUDAToolkit\_INCLUDE\_DIR and CUDAToolkit\_ROOT have no effect.](https://discourse.cmake.org/t/cudatoolkit-include-dir-and-cudatoolkit-root-have-no-effect/8621)

<div class="topic-metadata">

**Author:** [@Geremia](https://discourse.cmake.org/u/Geremia)\
**Replies:** 2\
**Last updated:** [July 31, 2023, 12:59pm UTC](https://discourse.cmake.org/t/cudatoolkit-include-dir-and-cudatoolkit-root-have-no-effect/8621 "2023-07-31T12:59:59Z")

</div>

CMakeLists.txt MWE: cmake\_minimum\_required(VERSION 3.17) project(ProjectName) find\_package(CUDAToolkit) $ cmake .. -- Unable to find cuda\_runtime.h in "/usr/share/cuda/include" for CUDAToolkit\_INCLUDE\_DIR. -- Unable t…

---

## [Why do target\_... commands not work with ALIAS?](https://discourse.cmake.org/t/why-do-target-commands-not-work-with-alias/8640)

<div class="topic-metadata">

**Author:** [@nylnx](https://discourse.cmake.org/u/nylnx)\
**Replies:** 2\
**Last updated:** [July 30, 2023, 11:25pm UTC](https://discourse.cmake.org/t/why-do-target-commands-not-work-with-alias/8640 "2023-07-30T23:25:18Z")

</div>

Hello, I have the following situation: I build a third-party library as source and it expects to be configured with a header configuration file. To correctly compile, the library needs to find the header and therefore t…

---

## [How to add a version infix/suffix for an include file like the "SOVERSION" of a so lib?](https://discourse.cmake.org/t/how-to-add-a-version-infix-suffix-for-an-include-file-like-the-soversion-of-a-so-lib/8642)

<div class="topic-metadata">

**Author:** [@evilroach](https://discourse.cmake.org/u/evilroach)\
**Replies:** 1\
**Last updated:** [July 30, 2023, 3:00pm UTC](https://discourse.cmake.org/t/how-to-add-a-version-infix-suffix-for-an-include-file-like-the-soversion-of-a-so-lib/8642 "2023-07-30T15:00:45Z")

</div>

Usually, include files are distributed with the \*.so files. I want to rename the include files when installing them, i.e. inserting a version midfix/suffix into it’s name, and then add a symbolic link to each of them wi…

---

## [X11/Motif: find\_package() imported targets vs variables](https://discourse.cmake.org/t/x11-motif-find-package-imported-targets-vs-variables/8611)

<div class="topic-metadata">

**Author:** [@tomoreilly](https://discourse.cmake.org/u/tomoreilly)\
**Replies:** 6\
**Last updated:** [July 29, 2023, 8:43pm UTC](https://discourse.cmake.org/t/x11-motif-find-package-imported-targets-vs-variables/8611 "2023-07-29T20:43:30Z")

</div>

I “inherited” a CMakeLists.txt that contains this: find\_package(X11 REQUIRED) find\_package(Motif REQUIRED) add\_executable(mbgrdviz mbgrdviz\_callbacks.c mbgrdviz\_creation.c mbgrdviz\_main.c) # Sp…

---

## [Multiple executables, thus multiple different builds of the same static lib?](https://discourse.cmake.org/t/multiple-executables-thus-multiple-different-builds-of-the-same-static-lib/8081)

<div class="topic-metadata">

**Author:** [@apullin](https://discourse.cmake.org/u/apullin)\
**Replies:** 10\
**Last updated:** [July 28, 2023, 7:11pm UTC](https://discourse.cmake.org/t/multiple-executables-thus-multiple-different-builds-of-the-same-static-lib/8081 "2023-07-28T19:11:30Z")

</div>

If I have a CMakeLists.txt that encloses a larger project with multiple executables inside it, and each of those executables has different compile macros, and both have target\_link\_libraries to a static lib, will it auto…

---

## [PCH + gcc: sccache fails, ccache succeeds](https://discourse.cmake.org/t/pch-gcc-sccache-fails-ccache-succeeds/8615)

<div class="topic-metadata">

**Author:** [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Replies:** 4\
**Last updated:** [July 28, 2023, 11:02am UTC](https://discourse.cmake.org/t/pch-gcc-sccache-fails-ccache-succeeds/8615 "2023-07-28T11:02:22Z")

</div>

I discovered today that if using gcc with precompiled headers, using sccache fails but ccache works. It appears that sccache doesn’t properly handle the PCH artifacts, resulting in errors of the form: cc1plus: error: /s…

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

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