# Usage

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

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

**Page:** 65

---

## [Setting CMAKE\_C(XX)\_FLAGS\_DEBUG to "" in CMakePresets.json makes it compile for x32](https://discourse.cmake.org/t/setting-cmake-c-xx-flags-debug-to-in-cmakepresets-json-makes-it-compile-for-x32/5274)

<div class="topic-metadata">

**Author:** [@VetleNeumann](https://discourse.cmake.org/u/VetleNeumann)\
**Replies:** 5\
**Last updated:** [March 25, 2022, 6:38am UTC](https://discourse.cmake.org/t/setting-cmake-c-xx-flags-debug-to-in-cmakepresets-json-makes-it-compile-for-x32/5274 "2022-03-25T06:38:30Z")

</div>

As the title says, setting CMAKE\_C(XX)\_FLAGS\_DEBUG to the empty string “” in a CMakePresets.json, even if architecture is specified to ‘external’ and x64, will make compile for x32. Is this intended behaviour? Something…

---

## [Issue with CMAKE\_CUDA\_COMPILER\_EXTERNAL\_TOOLCHAIN](https://discourse.cmake.org/t/issue-with-cmake-cuda-compiler-external-toolchain/5286)

<div class="topic-metadata">

**Author:** [@mafanasiev](https://discourse.cmake.org/u/mafanasiev)\
**Replies:** 0\
**Last updated:** [March 24, 2022, 6:50pm UTC](https://discourse.cmake.org/t/issue-with-cmake-cuda-compiler-external-toolchain/5286 "2022-03-24T18:50:04Z")

</div>

Hello, I believe there may be an issue setting an external compiler toolchain for CUDA. For me this is popping up when I am using Clang to compile CUDA. For instance, running cmake with a trivial CMakeLists.txt and a to…

---

## [CTest - generate xml file results](https://discourse.cmake.org/t/ctest-generate-xml-file-results/5133)

<div class="topic-metadata">

**Author:** [@yonatanbk](https://discourse.cmake.org/u/yonatanbk)\
**Replies:** 3\
**Last updated:** [March 24, 2022, 1:29pm UTC](https://discourse.cmake.org/t/ctest-generate-xml-file-results/5133 "2022-03-24T13:29:53Z")

</div>

Hi, I have a test preset named ‘tests-windows’ and I run ctest --preset tests-windows in order to run my tests. Now I want to generate .xml file with the tests result. I saw people are running ctest -T test in order to…

---

## [Find all installed compilers](https://discourse.cmake.org/t/find-all-installed-compilers/5258)

<div class="topic-metadata">

**Author:** [@NeoCortex97](https://discourse.cmake.org/u/NeoCortex97)\
**Replies:** 2\
**Last updated:** [March 24, 2022, 9:16am UTC](https://discourse.cmake.org/t/find-all-installed-compilers/5258 "2022-03-24T09:16:59Z")

</div>

I hope that this fits here! I would like to find a list of all compilers that are installed on the system. I tried to use the trace functionality to manually read through everything cmake does to find stuff. I also fou…

---

## [Is is possible to cache the \_deps folder?](https://discourse.cmake.org/t/is-is-possible-to-cache-the-deps-folder/5276)

<div class="topic-metadata">

**Author:** [@joefocusrite](https://discourse.cmake.org/u/joefocusrite)\
**Replies:** 1\
**Last updated:** [March 24, 2022, 1:06am UTC](https://discourse.cmake.org/t/is-is-possible-to-cache-the-deps-folder/5276 "2022-03-24T01:06:45Z")

</div>

Hi there, I’m setting up CI for a project. It takes a couple of minutes to generate the project and a lot of that time is spent downloading content using FetchContent. Since this content is unlikely to change regularly,…

---

## [Where to find MSVC/MSBuild logs when run through CMake CLI?](https://discourse.cmake.org/t/where-to-find-msvc-msbuild-logs-when-run-through-cmake-cli/5265)

<div class="topic-metadata">

**Author:** [@KeijiBranshi](https://discourse.cmake.org/u/KeijiBranshi)\
**Replies:** 0\
**Last updated:** [March 22, 2022, 6:25pm UTC](https://discourse.cmake.org/t/where-to-find-msvc-msbuild-logs-when-run-through-cmake-cli/5265 "2022-03-22T18:25:21Z")

</div>

Context: Trying to migrate a project from solely MSVC/MSBuild to use CMake for cross-plat support. My Visual Studio project generates a \*.sln.log file (among many other logs) after each build. I think this usually just …

---

## [How to set up Intel Fortran compiler 2017/ Visual Studio 2017 on Windows correctly?](https://discourse.cmake.org/t/how-to-set-up-intel-fortran-compiler-2017-visual-studio-2017-on-windows-correctly/5261)

<div class="topic-metadata">

**Author:** [@AllenZhao](https://discourse.cmake.org/u/AllenZhao)\
**Replies:** 5\
**Last updated:** [March 22, 2022, 3:02pm UTC](https://discourse.cmake.org/t/how-to-set-up-intel-fortran-compiler-2017-visual-studio-2017-on-windows-correctly/5261 "2022-03-22T15:02:01Z")

</div>

I am trying to build mumps packages on Windows using Intel Fortran 2017 / Visual Studio 2017, but I can not let cmake to recognize Intel’s ifort and Microsoft’s cl. The cmake version is the latest stable build v3.22.3. C…

---

## [Start slow tests early when using ctest -j jobs](https://discourse.cmake.org/t/start-slow-tests-early-when-using-ctest-j-jobs/5259)

<div class="topic-metadata">

**Author:** [@JanWielemaker](https://discourse.cmake.org/u/JanWielemaker)\
**Replies:** 1\
**Last updated:** [March 21, 2022, 8:08pm UTC](https://discourse.cmake.org/t/start-slow-tests-early-when-using-ctest-j-jobs/5259 "2022-03-21T20:08:38Z")

</div>

When running ctest -j 16, the wall time executing the tests varies a lot because some tests are much slower than others. If the slow tests are started first the suite completes quick. I couldn’t find anything to hint…

---

## [FindPython on manylinux(2014)](https://discourse.cmake.org/t/findpython-on-manylinux-2014/5245)

<div class="topic-metadata">

**Author:** [@jpfeuffer](https://discourse.cmake.org/u/jpfeuffer)\
**Replies:** 2\
**Last updated:** [March 18, 2022, 4:27pm UTC](https://discourse.cmake.org/t/findpython-on-manylinux-2014/5245 "2022-03-18T16:27:55Z")

</div>

Hi, Did anyone successfully use the FindPython module on manylinux? I tried -DPython\_ROOT\_DIR and -DPython\_EXECUTABLE to set to /opt/python/cp39-cp39/bin/python or the respective folder. If I print the found python Ve…

---

## [Do you know how to install CMake 3.5 or higher in Cent OS ?](https://discourse.cmake.org/t/do-you-know-how-to-install-cmake-3-5-or-higher-in-cent-os/5244)

<div class="topic-metadata">

**Author:** [@goahead97](https://discourse.cmake.org/u/goahead97)\
**Replies:** 2\
**Last updated:** [March 18, 2022, 10:01am UTC](https://discourse.cmake.org/t/do-you-know-how-to-install-cmake-3-5-or-higher-in-cent-os/5244 "2022-03-18T10:01:42Z")

</div>

I found this: https://cmake.org/pipermail/cmake/2016-March/063085.html But I do not find any download link for CMake 3.5 or higher on https://cmake.org/download/. The last downloadable version of CMake that I see is 3.…

---

## [Generating Visual Studio 2019 project without Visual Studio installed](https://discourse.cmake.org/t/generating-visual-studio-2019-project-without-visual-studio-installed/5230)

<div class="topic-metadata">

**Author:** [@c287dd0d995e2c0016e7](https://discourse.cmake.org/u/c287dd0d995e2c0016e7)\
**Replies:** 1\
**Last updated:** [March 17, 2022, 11:46pm UTC](https://discourse.cmake.org/t/generating-visual-studio-2019-project-without-visual-studio-installed/5230 "2022-03-17T23:46:51Z")

</div>

Hey, I got a Windows machine on which I am building some VS 2019 projects using a prepared “portable” folder of MSBuild and related tools, on that system an installation of any Visual Studio is not present. I am wonder…

---

## [add\_compile\_options not having an effect](https://discourse.cmake.org/t/add-compile-options-not-having-an-effect/5234)

<div class="topic-metadata">

**Author:** [@ggghamd](https://discourse.cmake.org/u/ggghamd)\
**Replies:** 1\
**Last updated:** [March 17, 2022, 5:49am UTC](https://discourse.cmake.org/t/add-compile-options-not-having-an-effect/5234 "2022-03-17T05:49:54Z")

</div>

My linux bin build and runs ok. I needed to have compiler options specified and I can see it is set in the build.cmake file after cmake … . But now if I compile it, it has no effect on make stage. What could be wrong? …

---

## [Frameworks installed by install(RUNTIME\_DEPENDENCY\_SET) also copy headers](https://discourse.cmake.org/t/frameworks-installed-by-install-runtime-dependency-set-also-copy-headers/5222)

<div class="topic-metadata">

**Author:** [@alcroito](https://discourse.cmake.org/u/alcroito)\
**Replies:** 6\
**Last updated:** [March 16, 2022, 8:14am UTC](https://discourse.cmake.org/t/frameworks-installed-by-install-runtime-dependency-set-also-copy-headers/5222 "2022-03-16T08:14:21Z")

</div>

Hi, Installing the dependencies of an application that depends on Qt frameworks with install(TARGETS target RUNTIME\_DEPENDENCIES) ends up installing not only the Qt framework library, but also the headers. The generat…

---

## [Is there a way to require the directory name in Included Directories for include paths?](https://discourse.cmake.org/t/is-there-a-way-to-require-the-directory-name-in-included-directories-for-include-paths/5223)

<div class="topic-metadata">

**Author:** [@marstaik](https://discourse.cmake.org/u/marstaik)\
**Replies:** 1\
**Last updated:** [March 16, 2022, 6:49am UTC](https://discourse.cmake.org/t/is-there-a-way-to-require-the-directory-name-in-included-directories-for-include-paths/5223 "2022-03-16T06:49:13Z")

</div>

So, this question is more from a code organizational point of view, specifically when trying to isolate libraries and their header files (and gain help from editor IDE’s) as well. Assume the project has a structure such…

---

## [Change CMAKE\_CROSSCOMPILING\_EMULATOR at ctest runtime](https://discourse.cmake.org/t/change-cmake-crosscompiling-emulator-at-ctest-runtime/5218)

<div class="topic-metadata">

**Author:** [@KUGA2](https://discourse.cmake.org/u/KUGA2)\
**Replies:** 1\
**Last updated:** [March 16, 2022, 6:40am UTC](https://discourse.cmake.org/t/change-cmake-crosscompiling-emulator-at-ctest-runtime/5218 "2022-03-16T06:40:35Z")

</div>

Can I change CMAKE\_CROSSCOMPILING\_EMULATOR later, when I run ctest? I Tried $ ctest -D CMAKE\_CROSSCOMPILING\_EMULATOR:STRING="echo hello cross; " -V but it did not show up anywhere in the output

---

## [macos BUILD\_RPATH not used the first time CMake is run](https://discourse.cmake.org/t/macos-build-rpath-not-used-the-first-time-cmake-is-run/5225)

<div class="topic-metadata">

**Author:** [@Burlen\_Loring](https://discourse.cmake.org/u/Burlen_Loring)\
**Replies:** 1\
**Last updated:** [March 16, 2022, 5:28am UTC](https://discourse.cmake.org/t/macos-build-rpath-not-used-the-first-time-cmake-is-run/5225 "2022-03-16T05:28:05Z")

</div>

Context: I’m embedding a Python interpreter in a C++ application. The embedding relies on some code generated with SWIG. The library generated by SWIG needs to be linked into the C++ executable. I’ve set OUTPUT\_DIR opt…

---

## [Cmake test error when installing Caffe, cl.exe is not able to compile a simple test program.](https://discourse.cmake.org/t/cmake-test-error-when-installing-caffe-cl-exe-is-not-able-to-compile-a-simple-test-program/5206)

<div class="topic-metadata">

**Author:** [@N\_fo](https://discourse.cmake.org/u/N_fo)\
**Replies:** 3\
**Last updated:** [March 14, 2022, 10:06pm UTC](https://discourse.cmake.org/t/cmake-test-error-when-installing-caffe-cl-exe-is-not-able-to-compile-a-simple-test-program/5206 "2022-03-14T22:06:58Z")

</div>

Hi all, I am installing Caffe for windows 11. In one of the steps ( running C:\\Projects\\caffe\> scripts\\build\_win.cmd according to the installation guide on Caffe github page), I get the following errors: \`- - Detect…

---

## [cmake for pytorch c++](https://discourse.cmake.org/t/cmake-for-pytorch-c/5210)

<div class="topic-metadata">

**Author:** [@Jakub\_Mitura](https://discourse.cmake.org/u/Jakub_Mitura)\
**Replies:** 5\
**Last updated:** [March 14, 2022, 10:01pm UTC](https://discourse.cmake.org/t/cmake-for-pytorch-c/5210 "2022-03-14T22:01:36Z")

</div>

I try to run project that is example of cmake usage for pytorch cuda extension link below \[1\]. The specified command is cmake -DCMAKE\_BUILD\_TYPE=RelWithDebInfo -DCMAKE\_PREFIX\_PATH=\`python -c 'import torch;print(torch.ut…

---

## [ctest: best approach to portably run two or three applications concurrently](https://discourse.cmake.org/t/ctest-best-approach-to-portably-run-two-or-three-applications-concurrently/5199)

<div class="topic-metadata">

**Author:** [@wolfman21](https://discourse.cmake.org/u/wolfman21)\
**Replies:** 4\
**Last updated:** [March 14, 2022, 12:50pm UTC](https://discourse.cmake.org/t/ctest-best-approach-to-portably-run-two-or-three-applications-concurrently/5199 "2022-03-14T12:50:17Z")

</div>

Hello, I’d like to run two or three applications concurrently via ctest to test out our code that facilitates the interactions between the applications. My current approach is using execute\_process and multiple COMMANDs…

---

## [findMatlab.cmake mex not found in Windows 10](https://discourse.cmake.org/t/findmatlab-cmake-mex-not-found-in-windows-10/5201)

<div class="topic-metadata">

**Author:** [@plitkey](https://discourse.cmake.org/u/plitkey)\
**Replies:** 3\
**Last updated:** [March 14, 2022, 9:02am UTC](https://discourse.cmake.org/t/findmatlab-cmake-mex-not-found-in-windows-10/5201 "2022-03-14T09:02:44Z")

</div>

I have CMake version 3.23.0-rc1 installed with installer and I have problems with findMatlab. I have copied latest version of findMatlab.cmake from github, but still the same error remains: CMake Error at C:/Program Fil…

---

## [Is Windows App SDK/WinRT/WinUI3 supported?](https://discourse.cmake.org/t/is-windows-app-sdk-winrt-winui3-supported/5184)

<div class="topic-metadata">

**Author:** [@Lothar\_Scholz](https://discourse.cmake.org/u/Lothar_Scholz)\
**Replies:** 1\
**Last updated:** [March 10, 2022, 11:11am UTC](https://discourse.cmake.org/t/is-windows-app-sdk-winrt-winui3-supported/5184 "2022-03-10T11:11:31Z")

</div>

I tried to write a little C++ app with the 1.0 Windows App SDK last week. Its still in a very early state but you can get it to work if you are not scared by a developer experience worse than 1992 when i first develope…

---

## [QNX\_HOST environment variable not set](https://discourse.cmake.org/t/qnx-host-environment-variable-not-set/5189)

<div class="topic-metadata">

**Author:** [@nenuyear](https://discourse.cmake.org/u/nenuyear)\
**Replies:** 4\
**Last updated:** [March 10, 2022, 3:53am UTC](https://discourse.cmake.org/t/qnx-host-environment-variable-not-set/5189 "2022-03-10T03:53:32Z")

</div>

I am compiling mlpack using QNX.Keep reporting the following errors: CMake Error at CMakeLists.txt:28 (message):QNX\_HOST environment variable not set!!! I have added the following to CMakeLists.txt: set (QNX\_HOST “/da…

---

## [issue: docker pull error: failed to register layer: Error processing tar file(exit status 1): write /usr/lib/x86\_64-linux-gnu/ldscripts/elf32\_x86\_64.xsw: read-only file system](https://discourse.cmake.org/t/issue-docker-pull-error-failed-to-register-layer-error-processing-tar-file-exit-status-1-write-usr-lib-x86-64-linux-gnu-ldscripts-elf32-x86-64-xsw-read-only-file-system/5168)

<div class="topic-metadata">

**Author:** [@Cartman0](https://discourse.cmake.org/u/Cartman0)\
**Replies:** 10\
**Last updated:** [March 10, 2022, 3:50am UTC](https://discourse.cmake.org/t/issue-docker-pull-error-failed-to-register-layer-error-processing-tar-file-exit-status-1-write-usr-lib-x86-64-linux-gnu-ldscripts-elf32-x86-64-xsw-read-only-file-system/5168 "2022-03-10T03:50:43Z")

</div>

when docker pull kitware/cmake:ci-debian10-x86\_64-2022-02-25, follow error has occurred: $ docker pull kitware/cmake:ci-debian10-x86\_64-2022-02-25 failed to register layer: Error processing tar file(exit status 1): wri…

---

## [Set variable used by Project command according to current architecture.](https://discourse.cmake.org/t/set-variable-used-by-project-command-according-to-current-architecture/5196)

<div class="topic-metadata">

**Author:** [@zohar81](https://discourse.cmake.org/u/zohar81)\
**Replies:** 1\
**Last updated:** [March 9, 2022, 4:38pm UTC](https://discourse.cmake.org/t/set-variable-used-by-project-command-according-to-current-architecture/5196 "2022-03-09T16:38:53Z")

</div>

My project definition expect different set of languages according to architecture (macOS or Windows). if(CMAKE\_SYSTEM\_NAME STREQUAL "Darwin") project(myProj CXX OBJC OBJCXX) elseif(CMAKE\_SYSTEM\_NAME STREQUAL "Window…

---

## [Cmake project set LANGUAGES from variable](https://discourse.cmake.org/t/cmake-project-set-languages-from-variable/5193)

<div class="topic-metadata">

**Author:** [@zohar81](https://discourse.cmake.org/u/zohar81)\
**Replies:** 2\
**Last updated:** [March 9, 2022, 10:48am UTC](https://discourse.cmake.org/t/cmake-project-set-languages-from-variable/5193 "2022-03-09T10:48:56Z")

</div>

currently I’ve got the following project definition : set(supported\_languages "CXX OBJC OBJCXX") project( myProj VERSION ${ver} LANGUAGES ${supported\_languages}) where supported\_languages is defined as string of…

---

## [CMake Error: Could not find CMAKE\_ROOT](https://discourse.cmake.org/t/cmake-error-could-not-find-cmake-root/5142)

<div class="topic-metadata">

**Author:** [@ggrrll](https://discourse.cmake.org/u/ggrrll)\
**Replies:** 1\
**Last updated:** [March 9, 2022, 10:21am UTC](https://discourse.cmake.org/t/cmake-error-could-not-find-cmake-root/5142 "2022-03-09T10:21:29Z")

</div>

Hi, I am getting that error again and again, when I check cmake --version… I have tried: install as sudo … and from root user… export CMAKE\_ROOT=CMAKE\_ROOT=/usr/local/share/cmake-3.23 still does not work :warning: …

---

## [Missing dependencies for cpp files created with configure\_file](https://discourse.cmake.org/t/missing-dependencies-for-cpp-files-created-with-configure-file/5160)

<div class="topic-metadata">

**Author:** [@ARSanderson](https://discourse.cmake.org/u/ARSanderson)\
**Replies:** 6\
**Last updated:** [March 8, 2022, 8:19pm UTC](https://discourse.cmake.org/t/missing-dependencies-for-cpp-files-created-with-configure-file/5160 "2022-03-08T20:19:22Z")

</div>

I have a series of boilerplate cpp files that are created using configure\_file. The files created are in my build directory, get built and included into my library. However, I noticed that in the depend.make file that th…

---

## [\`cmake --build\` with specifying Debug or Release configuration](https://discourse.cmake.org/t/cmake-build-with-specifying-debug-or-release-configuration/5183)

<div class="topic-metadata">

**Author:** [@Hyunjik\_Bae](https://discourse.cmake.org/u/Hyunjik_Bae)\
**Replies:** 1\
**Last updated:** [March 7, 2022, 4:32pm UTC](https://discourse.cmake.org/t/cmake-build-with-specifying-debug-or-release-configuration/5183 "2022-03-07T16:32:19Z")

</div>

CMake gives a features of building the generated project by using --build command argument . For example, this builds the build target X. cmake --build . --target X I tried building X with configuration Debug or Releas…

---

## [How find older version of library?](https://discourse.cmake.org/t/how-find-older-version-of-library/5170)

<div class="topic-metadata">

**Author:** [@AndrzejB](https://discourse.cmake.org/u/AndrzejB)\
**Replies:** 2\
**Last updated:** [March 5, 2022, 11:30pm UTC](https://discourse.cmake.org/t/how-find-older-version-of-library/5170 "2022-03-05T23:30:14Z")

</div>

I have Mint 20.3 and install wxWidgets 3.0.4 by sudo apt install libwxgtk3.0-gtk3-dev Now I install wxWidgeta 3.1.x from sources. I have CMakeLists.txt : cmake\_minimum\_required(VERSION 3.7) project(minimal\_std) set(C…

---

## [Compiler identification problem (VS2022)](https://discourse.cmake.org/t/compiler-identification-problem-vs2022/5149)

<div class="topic-metadata">

**Author:** [@hyperz](https://discourse.cmake.org/u/hyperz)\
**Replies:** 6\
**Last updated:** [March 5, 2022, 2:15am UTC](https://discourse.cmake.org/t/compiler-identification-problem-vs2022/5149 "2022-03-05T02:15:43Z")

</div>

I have installed VS2022 and Windows SDK. There is VS2017 previously installed. I am running cmake-gui (3.22.2) on some project and try to configure it. I can’t get past the compiler identification. When I examined the …

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

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