# Usage

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

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

**Page:** 31

---

## [how to use cmake with msys2/mingw64 gcc](https://discourse.cmake.org/t/how-to-use-cmake-with-msys2-mingw64-gcc/10103)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 4\
**Last updated:** [February 18, 2024, 3:27am UTC](https://discourse.cmake.org/t/how-to-use-cmake-with-msys2-mingw64-gcc/10103 "2024-02-18T03:27:16Z")

</div>

Hi, I have a thresh msys2 install with mingw64 packages for cmake and gcc. The compiler is working in standalone (gcc hello.cpp -o hello) but it does not work anymore with cmake. Here is my command line from a build d…

---

## [How to Properly setup cmake library](https://discourse.cmake.org/t/how-to-properly-setup-cmake-library/10127)

<div class="topic-metadata">

**Author:** [@IronFractal](https://discourse.cmake.org/u/IronFractal)\
**Replies:** 1\
**Last updated:** [February 17, 2024, 11:23pm UTC](https://discourse.cmake.org/t/how-to-properly-setup-cmake-library/10127 "2024-02-17T23:23:53Z")

</div>

project on github I am new to cmake and I am having trouble trying to figure out how to setup a library project. The issue is that I am not able to include the libraries header files in projects that use the library. Fo…

---

## [Using PUBLIC FILE\_SET HEADERS with dependent targets](https://discourse.cmake.org/t/using-public-file-set-headers-with-dependent-targets/10031)

<div class="topic-metadata">

**Author:** [@SherlockInSpace](https://discourse.cmake.org/u/SherlockInSpace)\
**Replies:** 6\
**Last updated:** [February 17, 2024, 11:22pm UTC](https://discourse.cmake.org/t/using-public-file-set-headers-with-dependent-targets/10031 "2024-02-17T23:22:55Z")

</div>

Hey folks, I’m in a bit of bind trying to understand target\_sources(\<name\> PUBLIC FILE\_SET HEADERS ... and how a target dependent on a library that uses this works. Here’s my situation, setup, and issue. I’ve got a thi…

---

## [DNeg's XStudio on windows with CMake](https://discourse.cmake.org/t/dnegs-xstudio-on-windows-with-cmake/10077)

<div class="topic-metadata">

**Author:** [@Giuseppe\_Providenti](https://discourse.cmake.org/u/Giuseppe_Providenti)\
**Replies:** 1\
**Last updated:** [February 17, 2024, 6:31am UTC](https://discourse.cmake.org/t/dnegs-xstudio-on-windows-with-cmake/10077 "2024-02-17T06:31:48Z")

</div>

Hello everyone, i am trying to install DNeg’s XStudio on windows with CMake, but i am finding many difficulties. Every time I do the CMake setup it tells me that a new package is missing. the first one was “nlohmann\_j…

---

## [Intel Profiler integration with Visual Studio under CMake Ninja build](https://discourse.cmake.org/t/intel-profiler-integration-with-visual-studio-under-cmake-ninja-build/10062)

<div class="topic-metadata">

**Author:** [@TryerGit](https://discourse.cmake.org/u/TryerGit)\
**Replies:** 1\
**Last updated:** [February 17, 2024, 6:23am UTC](https://discourse.cmake.org/t/intel-profiler-integration-with-visual-studio-under-cmake-ninja-build/10062 "2024-02-17T06:23:02Z")

</div>

While natively creating a Visual Studio Solution .sln file and opening a project via this, Intel profilers nicely integrate with the project/IDE. That is, if I have built a release version, clicking on the icon for Intel…

---

## [What determines which target information makes it into an install tree Exports.cmake file?](https://discourse.cmake.org/t/what-determines-which-target-information-makes-it-into-an-install-tree-exports-cmake-file/10057)

<div class="topic-metadata">

**Author:** [@dabrahams](https://discourse.cmake.org/u/dabrahams)\
**Replies:** 1\
**Last updated:** [February 17, 2024, 6:19am UTC](https://discourse.cmake.org/t/what-determines-which-target-information-makes-it-into-an-install-tree-exports-cmake-file/10057 "2024-02-17T06:19:33Z")

</div>

\[Sorry to duplicate-post this; it seems like slightly more of a CMake question than an LLVM question, but the original LLVM posting is here. Feel free to answer there if it seems more appropriate.\] I am trying to create…

---

## [Ideal way to force find\_package to use a given folder](https://discourse.cmake.org/t/ideal-way-to-force-find-package-to-use-a-given-folder/10046)

<div class="topic-metadata">

**Author:** [@fzakaria](https://discourse.cmake.org/u/fzakaria)\
**Replies:** 3\
**Last updated:** [February 17, 2024, 6:04am UTC](https://discourse.cmake.org/t/ideal-way-to-force-find-package-to-use-a-given-folder/10046 "2024-02-17T06:04:11Z")

</div>

We are using find\_package in CONFIG mode and our developer instructions require setting PACKAGE\_DIR as the location when running the cmake. The directory is a git-submodule at a very specific commit we need (FWIW packa…

---

## [Creating logs](https://discourse.cmake.org/t/creating-logs/10035)

<div class="topic-metadata">

**Author:** [@Bert](https://discourse.cmake.org/u/Bert)\
**Replies:** 2\
**Last updated:** [February 17, 2024, 5:47am UTC](https://discourse.cmake.org/t/creating-logs/10035 "2024-02-17T05:47:14Z")

</div>

I know this question has been asked before, but I still can’t quite figure it out. Regarding the toolchain, I am using CMake 3.27, ninja for the generator, and arm-none-eabi for the GCC compiler toolchain, where my host …

---

## [Creating subdirectories within \`\_deps\` when using FetchContent](https://discourse.cmake.org/t/creating-subdirectories-within-deps-when-using-fetchcontent/10108)

<div class="topic-metadata">

**Author:** [@Vink](https://discourse.cmake.org/u/Vink)\
**Replies:** 5\
**Last updated:** [February 16, 2024, 8:32pm UTC](https://discourse.cmake.org/t/creating-subdirectories-within-deps-when-using-fetchcontent/10108 "2024-02-16T20:32:19Z")

</div>

Hello, I am developing a small embedded system project, and have chosen CMake to be our build generator. I have a bunch of components being developed independently, and brought into the main project using the FetchConte…

---

## [difference between cmake --build . -- install and cmake --build . followed by cmake --install . ?](https://discourse.cmake.org/t/difference-between-cmake-build-install-and-cmake-build-followed-by-cmake-install/10114)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 1\
**Last updated:** [February 16, 2024, 5:25pm UTC](https://discourse.cmake.org/t/difference-between-cmake-build-install-and-cmake-build-followed-by-cmake-install/10114 "2024-02-16T17:25:07Z")

</div>

Hi, I think everything is in the title. To had a bit of context, so far I was using makefiles generators (linux, nmake, or mingw) then called make install to build and install (or nmake, or mingw32-make). In order to h…

---

## [CMake Error: Failed to ensurepip](https://discourse.cmake.org/t/cmake-error-failed-to-ensurepip/10019)

<div class="topic-metadata">

**Author:** [@filmtailor-mainframe](https://discourse.cmake.org/u/filmtailor-mainframe)\
**Replies:** 6\
**Last updated:** [February 15, 2024, 11:36pm UTC](https://discourse.cmake.org/t/cmake-error-failed-to-ensurepip/10019 "2024-02-15T23:36:55Z")

</div>

Hi there, I’m trying to build DNEG’s xStudio app, but at the configuration step, am getting the following err:r \`Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045. 蝟餌絞?曆??唳?摰?瑼??? CMake Error a…

---

## [How to do cross platform build for Linux target on Windows build system without even WSL.](https://discourse.cmake.org/t/how-to-do-cross-platform-build-for-linux-target-on-windows-build-system-without-even-wsl/10096)

<div class="topic-metadata">

**Author:** [@siddmohsin](https://discourse.cmake.org/u/siddmohsin)\
**Replies:** 1\
**Last updated:** [February 15, 2024, 6:57pm UTC](https://discourse.cmake.org/t/how-to-do-cross-platform-build-for-linux-target-on-windows-build-system-without-even-wsl/10096 "2024-02-15T18:57:59Z")

</div>

I am doing some POC where in I need to build for linux target on Windows build system \*\*without \*\* even WSL. So what I want to do is below. Build for Linux target on windows build system Take the build executable and …

---

## [Best practice to configure libraries](https://discourse.cmake.org/t/best-practice-to-configure-libraries/10083)

<div class="topic-metadata">

**Author:** [@LarryOates](https://discourse.cmake.org/u/LarryOates)\
**Replies:** 4\
**Last updated:** [February 15, 2024, 12:33pm UTC](https://discourse.cmake.org/t/best-practice-to-configure-libraries/10083 "2024-02-15T12:33:55Z")

</div>

I have a project that includes a library which I have written which can be reused in multiple projects. This library uses header files to configure it’s self depending on what the application requires. I am unsure what t…

---

## [CMake Tools & Visual code](https://discourse.cmake.org/t/cmake-tools-visual-code/10073)

<div class="topic-metadata">

**Author:** [@frankdeming](https://discourse.cmake.org/u/frankdeming)\
**Replies:** 2\
**Last updated:** [February 15, 2024, 8:11am UTC](https://discourse.cmake.org/t/cmake-tools-visual-code/10073 "2024-02-15T08:11:06Z")

</div>

Hello all, I am trying to use CMake Tools in Visual Studio Code and step through the quick start. I get an error about a connect between vscode and the cmserver \[rollbar\] Unhandled exception: Unhandled Promise rejectio…

---

## [Looking for general advice on using toolchain files](https://discourse.cmake.org/t/looking-for-general-advice-on-using-toolchain-files/4596)

<div class="topic-metadata">

**Author:** [@Zachary\_Turner](https://discourse.cmake.org/u/Zachary_Turner)\
**Replies:** 2\
**Last updated:** [February 14, 2024, 10:38pm UTC](https://discourse.cmake.org/t/looking-for-general-advice-on-using-toolchain-files/4596 "2024-02-14T22:38:51Z")

</div>

I’m trying to port some of my code over to using Toolchain files, but I’m running into some difficulties. The documentation is pretty sparse here, and it basically just tells you what toolchain files are, but there’s a …

---

## [A way to force "Check for working ${LANG} compiler" test?](https://discourse.cmake.org/t/a-way-to-force-check-for-working-lang-compiler-test/10026)

<div class="topic-metadata">

**Author:** [@al42and](https://discourse.cmake.org/u/al42and)\
**Replies:** 10\
**Last updated:** [February 13, 2024, 10:34am UTC](https://discourse.cmake.org/t/a-way-to-force-check-for-working-lang-compiler-test/10026 "2024-02-13T10:34:54Z")

</div>

Hi! I would like to ask if there is a “proper” way to force the compiler sanity check even if it passes the ABI check? For our package, a lot of users are trying to do -DCMAKE\_CXX\_COMPILER=gcc -DCMAKE\_C\_COMPILER=gcc, w…

---

## [FetchContent\_MakeAvailable in export configuration](https://discourse.cmake.org/t/fetchcontent-makeavailable-in-export-configuration/10054)

<div class="topic-metadata">

**Author:** [@olivierbichler-cea](https://discourse.cmake.org/u/olivierbichler-cea)\
**Replies:** 5\
**Last updated:** [February 12, 2024, 11:19am UTC](https://discourse.cmake.org/t/fetchcontent-makeavailable-in-export-configuration/10054 "2024-02-12T11:19:22Z")

</div>

Hello, Say I want to create an export configuration for a library with a dependency provided by FetchContent\_MakeAvailable, like the following: Include(FetchContent) FetchContent\_Declare( fmt GIT\_REPOSITORY ht…

---

## [CMake Error: "...No CMAKE\_CXX\_COMPILER could be found..."](https://discourse.cmake.org/t/cmake-error-no-cmake-cxx-compiler-could-be-found/10016)

<div class="topic-metadata">

**Author:** [@Garrett](https://discourse.cmake.org/u/Garrett)\
**Replies:** 2\
**Last updated:** [February 11, 2024, 4:37pm UTC](https://discourse.cmake.org/t/cmake-error-no-cmake-cxx-compiler-could-be-found/10016 "2024-02-11T16:37:51Z")

</div>

Greetings! TLDR: error while trying to generate Xcode project from: FFTease3.0-MaxMSP/BUILDME.md at master · ericlyon/FFTease3.0-MaxMSP · GitHub First post, complete noob. Not a coder; just a determined musician try…

---

## [Undefined symbol when linking dylib written in rust](https://discourse.cmake.org/t/undefined-symbol-when-linking-dylib-written-in-rust/10051)

<div class="topic-metadata">

**Author:** [@danielmbomfim](https://discourse.cmake.org/u/danielmbomfim)\
**Replies:** 1\
**Last updated:** [February 11, 2024, 1:33pm UTC](https://discourse.cmake.org/t/undefined-symbol-when-linking-dylib-written-in-rust/10051 "2024-02-11T13:33:06Z")

</div>

Hi, i’m working on a side project trying to use rust to write a lib to be used on a turbo modules package from react native. I have written a very simple function in rust that multiply two numbers and return the result: …

---

## [Is it possible to install binaries in one location and cmake packages in another one for third-party libraries?](https://discourse.cmake.org/t/is-it-possible-to-install-binaries-in-one-location-and-cmake-packages-in-another-one-for-third-party-libraries/10014)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 3\
**Last updated:** [February 8, 2024, 1:06pm UTC](https://discourse.cmake.org/t/is-it-possible-to-install-binaries-in-one-location-and-cmake-packages-in-another-one-for-third-party-libraries/10014 "2024-02-08T13:06:06Z")

</div>

Hi, For my own codes, I design my CMakeLists to install the binaries in their own place while the cmake packages are put in a single folder which plays the role of a registry. But is it possible to do the same thing fo…

---

## [Openpose model](https://discourse.cmake.org/t/openpose-model/10028)

<div class="topic-metadata">

**Author:** [@Hind\_C](https://discourse.cmake.org/u/Hind_C)\
**Replies:** 1\
**Last updated:** [February 7, 2024, 8:53pm UTC](https://discourse.cmake.org/t/openpose-model/10028 "2024-02-07T20:53:13Z")

</div>

Error: OpenPose library could not be found. Did you enable BUILD\_PYTHON in CMake and have this Python script in the right folder? No module named ‘pyopenpose’ I can’t solve the problem i tried all the solution i know c…

---

## [system is unknown to cmake](https://discourse.cmake.org/t/system-is-unknown-to-cmake/9945)

<div class="topic-metadata">

**Author:** [@Chih](https://discourse.cmake.org/u/Chih)\
**Replies:** 2\
**Last updated:** [February 7, 2024, 3:06pm UTC](https://discourse.cmake.org/t/system-is-unknown-to-cmake/9945 "2024-02-07T15:06:13Z")

</div>

Platform/MINGW64\_NT-10.0-19045 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake.

---

## [easiest way to build and install different build types for a single third-party library](https://discourse.cmake.org/t/easiest-way-to-build-and-install-different-build-types-for-a-single-third-party-library/9975)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 3\
**Last updated:** [February 6, 2024, 5:08pm UTC](https://discourse.cmake.org/t/easiest-way-to-build-and-install-different-build-types-for-a-single-third-party-library/9975 "2024-02-06T17:08:36Z")

</div>

Hi, Using third-party open-source libraries that propose a modern cmake support (ie they can be find with find\_package), how can I build and install several build types of the library. Usually I manually had a \<somelib\>…

---

## [Efficient Dockerfile with CMake?](https://discourse.cmake.org/t/efficient-dockerfile-with-cmake/9910)

<div class="topic-metadata">

**Author:** [@anthonya](https://discourse.cmake.org/u/anthonya)\
**Replies:** 8\
**Last updated:** [February 6, 2024, 10:00am UTC](https://discourse.cmake.org/t/efficient-dockerfile-with-cmake/9910 "2024-02-06T10:00:29Z")

</div>

Hey all, I’m looking for an efficient Dockerfile for CMake. For context, here’s Docker’s guide on making a Java based image: Build your Java image | Docker Docs The main idea is to gather your dependencies before your …

---

## [ctest does not show tests when executing in script mode](https://discourse.cmake.org/t/ctest-does-not-show-tests-when-executing-in-script-mode/9860)

<div class="topic-metadata">

**Author:** [@pkiran](https://discourse.cmake.org/u/pkiran)\
**Replies:** 5\
**Last updated:** [February 5, 2024, 8:56pm UTC](https://discourse.cmake.org/t/ctest-does-not-show-tests-when-executing-in-script-mode/9860 "2024-02-05T20:56:03Z")

</div>

Hi, When using ctest like this: ctest -S \<script\> -N Always shows 0 tests selected. Any suggestion are appreciated. Please let me know if i am doing something wrong. Ctest version being used in 3.28.0 Thanks Best r…

---

## [set\_source\_file\_properties and generator expressions to support partial linking executables](https://discourse.cmake.org/t/set-source-file-properties-and-generator-expressions-to-support-partial-linking-executables/9932)

<div class="topic-metadata">

**Author:** [@fdk17](https://discourse.cmake.org/u/fdk17)\
**Replies:** 5\
**Last updated:** [February 5, 2024, 3:23pm UTC](https://discourse.cmake.org/t/set-source-file-properties-and-generator-expressions-to-support-partial-linking-executables/9932 "2024-02-05T15:23:41Z")

</div>

In my CMake project I’m trying to build an executable that is partially linked and then goes through a secondary link step later in the build process. This is fairly typical strategy when dealing with ARINC-653 embedded…

---

## [Pulling in ExternalProject\_Add from other subproject in add\_subdirectory](https://discourse.cmake.org/t/pulling-in-externalproject-add-from-other-subproject-in-add-subdirectory/9951)

<div class="topic-metadata">

**Author:** [@Desperado17](https://discourse.cmake.org/u/Desperado17)\
**Replies:** 13\
**Last updated:** [February 5, 2024, 1:06pm UTC](https://discourse.cmake.org/t/pulling-in-externalproject-add-from-other-subproject-in-add-subdirectory/9951 "2024-02-05T13:06:46Z")

</div>

Greetings, I have a cmake project that combines some external dependencies with subdirectories. The first dependency is pulled in via FetchContent\_Dependency / FetchContent\_MakeAvailable. This dependency in its own CMa…

---

## [Issue with Toolchain (cross compiler) Configuration in CMakeLists.txt](https://discourse.cmake.org/t/issue-with-toolchain-cross-compiler-configuration-in-cmakelists-txt/9988)

<div class="topic-metadata">

**Author:** [@Tugrul](https://discourse.cmake.org/u/Tugrul)\
**Replies:** 2\
**Last updated:** [February 4, 2024, 7:45pm UTC](https://discourse.cmake.org/t/issue-with-toolchain-cross-compiler-configuration-in-cmakelists-txt/9988 "2024-02-04T19:45:33Z")

</div>

Hello I am encountering an issue with my CMake configuration, and I’m seeking your expertise to help me understand and resolve it. I have a CMakeLists.txt file where I’ve set the toolchain(cross compiler host: windows …

---

## [Using CPackDeb.cmake's symbol splitting outside of CPack](https://discourse.cmake.org/t/using-cpackdeb-cmakes-symbol-splitting-outside-of-cpack/9954)

<div class="topic-metadata">

**Author:** [@anthonya](https://discourse.cmake.org/u/anthonya)\
**Replies:** 1\
**Last updated:** [February 4, 2024, 7:39pm UTC](https://discourse.cmake.org/t/using-cpackdeb-cmakes-symbol-splitting-outside-of-cpack/9954 "2024-02-04T19:39:37Z")

</div>

Hey all, I noticed the following functionality in CPack: Is there some way to use this functionality in a simple cmake install? I currently know of cmake --install build --strip, but I don’t know of a way to also pul…

---

## [Whats the idiomatic way to run clang-tidy on header files with CMake?](https://discourse.cmake.org/t/whats-the-idiomatic-way-to-run-clang-tidy-on-header-files-with-cmake/9530)

<div class="topic-metadata">

**Author:** [@tom](https://discourse.cmake.org/u/tom)\
**Replies:** 7\
**Last updated:** [February 4, 2024, 5:24pm UTC](https://discourse.cmake.org/t/whats-the-idiomatic-way-to-run-clang-tidy-on-header-files-with-cmake/9530 "2024-02-04T17:24:49Z")

</div>

I would like to run clang-tidy on header files. I would also like to apply the fixits that are automatically generated. This is not trivial, because my header files are included many times throughout my codebase, so my…

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

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