# Usage

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

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

**Page:** 20

---

## [add\_custom\_command APPEND does not work in different directories](https://discourse.cmake.org/t/add-custom-command-append-does-not-work-in-different-directories/12906)

<div class="topic-metadata">

**Author:** [@rafzi](https://discourse.cmake.org/u/rafzi)\
**Replies:** 1\
**Last updated:** [November 6, 2024, 9:41pm UTC](https://discourse.cmake.org/t/add-custom-command-append-does-not-work-in-different-directories/12906 "2024-11-06T21:41:44Z")

</div>

Is add\_custom\_command with APPEND supposed to work across different directories? I first suspected it was an issue because I had the main custom command in a sibling directory, but even when defining the main custom comm…

---

## [How to deal with long path names on Windows (e.g. FTK1011 FileTracker error)](https://discourse.cmake.org/t/how-to-deal-with-long-path-names-on-windows-e-g-ftk1011-filetracker-error/12896)

<div class="topic-metadata">

**Author:** [@snoriman](https://discourse.cmake.org/u/snoriman)\
**Replies:** 0\
**Last updated:** [November 5, 2024, 8:52am UTC](https://discourse.cmake.org/t/how-to-deal-with-long-path-names-on-windows-e-g-ftk1011-filetracker-error/12896 "2024-11-05T08:52:55Z")

</div>

From time to time I run into issues with CMake + MSVC that are caused by long path names. For example, yesterday I ran into the error FileTracker: error FTK1011: could not create the new file tracking log file: \<long pat…

---

## [Could NOT find Python3 (missing: Python3\_EXECUTABLE Interpreter)](https://discourse.cmake.org/t/could-not-find-python3-missing-python3-executable-interpreter/12890)

<div class="topic-metadata">

**Author:** [@WasteNot](https://discourse.cmake.org/u/WasteNot)\
**Replies:** 1\
**Last updated:** [November 3, 2024, 9:42am UTC](https://discourse.cmake.org/t/could-not-find-python3-missing-python3-executable-interpreter/12890 "2024-11-03T09:42:51Z")

</div>

Sorry guys, I m totally not an IT guy, just tinkering around for a school project. I am trying to build the OPC UA Library from Open62541 with a compiler shipped with MinGW: Their GitHub Page: In my opinion, they …

---

## [PROTOBUF\_GENERATE\_CPP does not generating src and header files](https://discourse.cmake.org/t/protobuf-generate-cpp-does-not-generating-src-and-header-files/9893)

<div class="topic-metadata">

**Author:** [@black\_anime](https://discourse.cmake.org/u/black_anime)\
**Replies:** 3\
**Last updated:** [November 3, 2024, 5:24am UTC](https://discourse.cmake.org/t/protobuf-generate-cpp-does-not-generating-src-and-header-files/9893 "2024-11-03T05:24:22Z")

</div>

Directory: |test --|build --|msg --|proto ----|test.poto --|CMakeLists.txt --|test.bat this is my CMakeLists.txt cmake\_minimum\_required(VERSION 3.0.0) project(test) message(STATUS "source path: ${PROJECT\_SOURCE\_DIR}"…

---

## [Failed to install CMake 3.31 on Windows 10, 64-bit](https://discourse.cmake.org/t/failed-to-install-cmake-3-31-on-windows-10-64-bit/12875)

<div class="topic-metadata">

**Author:** [@8Observer8](https://discourse.cmake.org/u/8Observer8)\
**Replies:** 11\
**Last updated:** [November 2, 2024, 9:34am UTC](https://discourse.cmake.org/t/failed-to-install-cmake-3-31-on-windows-10-64-bit/12875 "2024-11-02T09:34:00Z")

</div>

Hello, I have CMake 3.27 that I have installed using Qt’s installer. Now I want to installe the latest CMake 3.31. But I have the following error. Maybe someone had the same error and solved it:

---

## [Best practices for notifications in config files](https://discourse.cmake.org/t/best-practices-for-notifications-in-config-files/12880)

<div class="topic-metadata">

**Author:** [@hebasto](https://discourse.cmake.org/u/hebasto)\
**Replies:** 2\
**Last updated:** [November 1, 2024, 10:20pm UTC](https://discourse.cmake.org/t/best-practices-for-notifications-in-config-files/12880 "2024-11-01T22:20:48Z")

</div>

Hi, The FindPackageHandleStandardArgs module is quite handy for use in Find modules. In addition to other functionality, it provides a clear notification when a package is found. What are the best practices for notifyi…

---

## [FindMPI.cmake with Cray PE wrappers+Intel compiler](https://discourse.cmake.org/t/findmpi-cmake-with-cray-pe-wrappers-intel-compiler/7004)

<div class="topic-metadata">

**Author:** [@AlexanderRichertNOAA](https://discourse.cmake.org/u/AlexanderRichertNOAA)\
**Replies:** 3\
**Last updated:** [November 1, 2024, 8:27pm UTC](https://discourse.cmake.org/t/findmpi-cmake-with-cray-pe-wrappers-intel-compiler/7004 "2024-11-01T20:27:40Z")

</div>

I’m having some difficulty getting FindMPI.cmake to recognize Cray MPICH when using the Cray PE wrappers for the Intel compilers (Cray wrappers with Cray compilers is not a problem). It seems that the file assumes that C…

---

## [Doubt regarding propagation of dependencies for static libraries](https://discourse.cmake.org/t/doubt-regarding-propagation-of-dependencies-for-static-libraries/12872)

<div class="topic-metadata">

**Author:** [@anutosh491](https://discourse.cmake.org/u/anutosh491)\
**Replies:** 0\
**Last updated:** [October 31, 2024, 1:05pm UTC](https://discourse.cmake.org/t/doubt-regarding-propagation-of-dependencies-for-static-libraries/12872 "2024-10-31T13:05:43Z")

</div>

My question is simple (NOTE: Not sure it matters a lot but I am compiling against emscripten hence using emcmake and emmake) So basically I have 3 PROJECTS (A B C) I have libC.a For B I am doing add\_library(B STATIC …

---

## [Generator expression "COMPILE\_LANG\_AND\_ID" togheter with CONFIG, how to?](https://discourse.cmake.org/t/generator-expression-compile-lang-and-id-togheter-with-config-how-to/12866)

<div class="topic-metadata">

**Author:** [@MickeJ](https://discourse.cmake.org/u/MickeJ)\
**Replies:** 3\
**Last updated:** [October 30, 2024, 9:16pm UTC](https://discourse.cmake.org/t/generator-expression-compile-lang-and-id-togheter-with-config-how-to/12866 "2024-10-30T21:16:42Z")

</div>

Hi, I am trying to automate different compiler flags based on compiler and config using generator expressions. But it does not work in the way i thought. target\_compile\_options(${PROJECT\_NAME} PRIVATE $\<$\<CO…

---

## [how do you build a project of cmake with epoll-shim.](https://discourse.cmake.org/t/how-do-you-build-a-project-of-cmake-with-epoll-shim/12849)

<div class="topic-metadata">

**Author:** [@TalionRanger117](https://discourse.cmake.org/u/TalionRanger117)\
**Replies:** 11\
**Last updated:** [October 30, 2024, 2:30pm UTC](https://discourse.cmake.org/t/how-do-you-build-a-project-of-cmake-with-epoll-shim/12849 "2024-10-30T14:30:28Z")

</div>

Hi, im trying to install epoll-shim. im now using cmake instead of meson since it refuses to use meson. so far i have the folder an i done this. git clone GitHub - jiixyj/epoll-shim: small epoll implementation using k…

---

## [ctest-related question: how to test functionality with totp authentication ?](https://discourse.cmake.org/t/ctest-related-question-how-to-test-functionality-with-totp-authentication/12862)

<div class="topic-metadata">

**Author:** [@neundorf](https://discourse.cmake.org/u/neundorf)\
**Replies:** 0\
**Last updated:** [October 29, 2024, 8:55pm UTC](https://discourse.cmake.org/t/ctest-related-question-how-to-test-functionality-with-totp-authentication/12862 "2024-10-29T20:55:52Z")

</div>

Hi, I’d like to test functionality with totp-based authentication. My issue is that the totp-token is valid for 30 seconds, and once I have used it for successfully logging in, I need a new token for the next login, bu…

---

## [Using PMP and eigen in the same project](https://discourse.cmake.org/t/using-pmp-and-eigen-in-the-same-project/12856)

<div class="topic-metadata">

**Author:** [@Shepard](https://discourse.cmake.org/u/Shepard)\
**Replies:** 0\
**Last updated:** [October 28, 2024, 6:56pm UTC](https://discourse.cmake.org/t/using-pmp-and-eigen-in-the-same-project/12856 "2024-10-28T18:56:49Z")

</div>

I’m working on a C++ project where I’m already using the Eigen library. I now want to add library that will allow me to build a surface mesh. I thought about CGAL but it seems to be too heavy and complex for what I need…

---

## [Help with IDE integration, I need clarification on how inheritance is supposed to work](https://discourse.cmake.org/t/help-with-ide-integration-i-need-clarification-on-how-inheritance-is-supposed-to-work/9953)

<div class="topic-metadata">

**Author:** [@limeade](https://discourse.cmake.org/u/limeade)\
**Replies:** 3\
**Last updated:** [October 27, 2024, 11:44am UTC](https://discourse.cmake.org/t/help-with-ide-integration-i-need-clarification-on-how-inheritance-is-supposed-to-work/9953 "2024-10-27T11:44:08Z")

</div>

Hello, I’m a software developer currently working on an IDE integration of cmake. I’ve run into a few issues outside of programming the integration to do with the integration guide. My expertise is in c++ which has bee…

---

## [Mapping lists in generator expressions](https://discourse.cmake.org/t/mapping-lists-in-generator-expressions/12833)

<div class="topic-metadata">

**Author:** [@jhol](https://discourse.cmake.org/u/jhol)\
**Replies:** 2\
**Last updated:** [October 25, 2024, 6:50pm UTC](https://discourse.cmake.org/t/mapping-lists-in-generator-expressions/12833 "2024-10-25T18:50:58Z")

</div>

I would like to write a generator expression which takes a list of targets, and retrieves a target property for each one producing a list of values. Is there a way to do this? I can’t see an obvious way. I thought of o…

---

## [Error with paths containing spaces in generated Ninja for C++/Swift interop](https://discourse.cmake.org/t/error-with-paths-containing-spaces-in-generated-ninja-for-c-swift-interop/12830)

<div class="topic-metadata">

**Author:** [@wAuner](https://discourse.cmake.org/u/wAuner)\
**Replies:** 2\
**Last updated:** [October 25, 2024, 6:26am UTC](https://discourse.cmake.org/t/error-with-paths-containing-spaces-in-generated-ninja-for-c-swift-interop/12830 "2024-10-25T06:26:58Z")

</div>

It looks like there is a bug in the CMake/Ninja generated swiftc invocation if a path contains spaces. The error message looks like \[build\] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/…

---

## [We use gTest record property in our test to link the test to a requirement](https://discourse.cmake.org/t/we-use-gtest-record-property-in-our-test-to-link-the-test-to-a-requirement/2616)

<div class="topic-metadata">

**Author:** [@Tom\_Schultz](https://discourse.cmake.org/u/Tom_Schultz)\
**Replies:** 3\
**Last updated:** [October 25, 2024, 4:53am UTC](https://discourse.cmake.org/t/we-use-gtest-record-property-in-our-test-to-link-the-test-to-a-requirement/2616 "2024-10-25T04:53:14Z")

</div>

Now we are testing to see if we can use ctest to run our test and generate the report. But as far as i can see the record\_property par of the gtest output has disappeared. Can anyone confirm, or am i missing something?

---

## [How to force run MOC without building project](https://discourse.cmake.org/t/how-to-force-run-moc-without-building-project/12835)

<div class="topic-metadata">

**Author:** [@Poldraunic](https://discourse.cmake.org/u/Poldraunic)\
**Replies:** 0\
**Last updated:** [October 24, 2024, 6:42pm UTC](https://discourse.cmake.org/t/how-to-force-run-moc-without-building-project/12835 "2024-10-24T18:42:02Z")

</div>

I have a project which uses Qt quite extensively. For the targets that use MOC/RCC/UIC I have corresponding variables set. We also manually include moc files to reduce reduce compilation times. I want have a clang-tidy …

---

## [cmake buildPresets runs without environment](https://discourse.cmake.org/t/cmake-buildpresets-runs-without-environment/12831)

<div class="topic-metadata">

**Author:** [@cmak](https://discourse.cmake.org/u/cmak)\
**Replies:** 1\
**Last updated:** [October 24, 2024, 2:24pm UTC](https://discourse.cmake.org/t/cmake-buildpresets-runs-without-environment/12831 "2024-10-24T14:24:02Z")

</div>

I have an issue where I see my cmake buildPresets runs without the environment defined in the configurePresets. I tried defining the environment in the buildPresets as well but seems cmake still does not run with correct…

---

## [Enabling Warnings for Precompiled Headers](https://discourse.cmake.org/t/enabling-warnings-for-precompiled-headers/12820)

<div class="topic-metadata">

**Author:** [@\_M\_M](https://discourse.cmake.org/u/_M_M)\
**Replies:** 1\
**Last updated:** [October 23, 2024, 11:11am UTC](https://discourse.cmake.org/t/enabling-warnings-for-precompiled-headers/12820 "2024-10-23T11:11:10Z")

</div>

Hi, cmake\_pch.hxx files generated by CMake when using precompiled headers have #pragma system\_header for MSVC and #pragma GCC system\_header for GCC at the very top prior to including the actual precompiled header. This …

---

## [Distributing cmake workflow steps over several different physical machines](https://discourse.cmake.org/t/distributing-cmake-workflow-steps-over-several-different-physical-machines/12818)

<div class="topic-metadata">

**Author:** [@Gornhoth](https://discourse.cmake.org/u/Gornhoth)\
**Replies:** 7\
**Last updated:** [October 23, 2024, 8:52am UTC](https://discourse.cmake.org/t/distributing-cmake-workflow-steps-over-several-different-physical-machines/12818 "2024-10-23T08:52:58Z")

</div>

Hello, I am using CMake to power my build, test, and deployment needs both locally and on my CI gitlab runner. However, as is normal in CI builds, the different stages and targets of a build pipeline are often written in…

---

## [cpack a source archive including a specific file in root](https://discourse.cmake.org/t/cpack-a-source-archive-including-a-specific-file-in-root/12752)

<div class="topic-metadata">

**Author:** [@Gornhoth](https://discourse.cmake.org/u/Gornhoth)\
**Replies:** 2\
**Last updated:** [October 22, 2024, 11:53am UTC](https://discourse.cmake.org/t/cpack-a-source-archive-including-a-specific-file-in-root/12752 "2024-10-22T11:53:28Z")

</div>

Hey, I am trying to explicitly introduce a cpack step to package a zip-archive with all my sources. I also want to include the root CMakeLists.txt file because the entire archive is supposed to be consumed via FetchConte…

---

## [Using different compiler flags when using different compilers, VS generator](https://discourse.cmake.org/t/using-different-compiler-flags-when-using-different-compilers-vs-generator/12810)

<div class="topic-metadata">

**Author:** [@thomashenry79](https://discourse.cmake.org/u/thomashenry79)\
**Replies:** 0\
**Last updated:** [October 21, 2024, 5:23pm UTC](https://discourse.cmake.org/t/using-different-compiler-flags-when-using-different-compilers-vs-generator/12810 "2024-10-21T17:23:39Z")

</div>

Working in an MSVC/Visual Studio shop but we need to start building using multiple compilers (Clang, Intel, etc). Using the VS generator works ok, eg: cmake -B build-dir-intel -G “Visual Studio 17” -T “Intel C++ Compil…

---

## [CMake Not Finding HSL and METIS Libraries when Building CasADi + IPOPT + HSL in Dockerfile](https://discourse.cmake.org/t/cmake-not-finding-hsl-and-metis-libraries-when-building-casadi-ipopt-hsl-in-dockerfile/12806)

<div class="topic-metadata">

**Author:** [@ebu](https://discourse.cmake.org/u/ebu)\
**Replies:** 0\
**Last updated:** [October 21, 2024, 9:24am UTC](https://discourse.cmake.org/t/cmake-not-finding-hsl-and-metis-libraries-when-building-casadi-ipopt-hsl-in-dockerfile/12806 "2024-10-21T09:24:07Z")

</div>

Hi everyone, I’m trying to build CasADi with IPOPT and HSL inside a Docker environment. I’ve been following the instructions from this guide, but I keep running into an issue with CMake not being able to locate the HSL …

---

## [How to install a static library that depends on another static library](https://discourse.cmake.org/t/how-to-install-a-static-library-that-depends-on-another-static-library/12797)

<div class="topic-metadata">

**Author:** [@Lecris](https://discourse.cmake.org/u/Lecris)\
**Replies:** 0\
**Last updated:** [October 18, 2024, 11:45am UTC](https://discourse.cmake.org/t/how-to-install-a-static-library-that-depends-on-another-static-library/12797 "2024-10-18T11:45:59Z")

</div>

As far as I understand when installing a static library (install(TARGETS)) and there are dependencies on other static libraries, these have to also be installed and included in the \<Package\>Config.cmake file. The questio…

---

## [Reconfigure with the same command-line?](https://discourse.cmake.org/t/reconfigure-with-the-same-command-line/12733)

<div class="topic-metadata">

**Author:** [@dabrahams](https://discourse.cmake.org/u/dabrahams)\
**Replies:** 9\
**Last updated:** [October 16, 2024, 10:58pm UTC](https://discourse.cmake.org/t/reconfigure-with-the-same-command-line/12733 "2024-10-16T22:58:40Z")

</div>

It’s common that I want CMake to reconfigure but with the same command I used to configure a given existing build directory, and I don’t remember the exact command. Is there a way to get this effect?

---

## [MinGW toolchain file](https://discourse.cmake.org/t/mingw-toolchain-file/12785)

<div class="topic-metadata">

**Author:** [@KSergeyP](https://discourse.cmake.org/u/KSergeyP)\
**Replies:** 0\
**Last updated:** [October 16, 2024, 7:55am UTC](https://discourse.cmake.org/t/mingw-toolchain-file/12785 "2024-10-16T07:55:52Z")

</div>

if you don’t add \\mingw64\\bin to PATH, the configuration returns an error: “compiler is not able to compile a simple test program.” You can add the CMAKE environment variable: set(ENV{PATH} “${TOOLCHAIN\_DIR};$ENV{PATH}”…

---

## [\`CMAKE\_EXE\_LINKER\_FLAGS\` semantic and alternatives](https://discourse.cmake.org/t/cmake-exe-linker-flags-semantic-and-alternatives/12660)

<div class="topic-metadata">

**Author:** [@etiennemlb](https://discourse.cmake.org/u/etiennemlb)\
**Replies:** 1\
**Last updated:** [October 15, 2024, 4:04pm UTC](https://discourse.cmake.org/t/cmake-exe-linker-flags-semantic-and-alternatives/12660 "2024-10-15T16:04:01Z")

</div>

The doc says: CMAKE\_EXE\_LINKER\_FLAGS Linker flags to be used to create executables. These flags will be used by the linker when creating an executable. When I use -DCMAKE\_EXE\_LINKER\_FLAGS="-L/opt/somelib/lib -Wl,--as-ne…

---

## [FOLDER target property not working in Visual Studio 2022](https://discourse.cmake.org/t/folder-target-property-not-working-in-visual-studio-2022/12759)

<div class="topic-metadata">

**Author:** [@Wallby](https://discourse.cmake.org/u/Wallby)\
**Replies:** 1\
**Last updated:** [October 11, 2024, 12:12pm UTC](https://discourse.cmake.org/t/folder-target-property-not-working-in-visual-studio-2022/12759 "2024-10-11T12:12:27Z")

</div>

I tried both the FOLDER property as well as the CMAKE\_FOLDER variable, neither worked. I have set USE\_FOLDERS to ON. set(USE\_FOLDERS ON) set(CMAKE\_FOLDER "Temporary") add\_library(Example STATIC Example.c) set\_target\_pro…

---

## [Determining the compiler default C++ standard](https://discourse.cmake.org/t/determining-the-compiler-default-c-standard/10389)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 23\
**Last updated:** [October 10, 2024, 12:03pm UTC](https://discourse.cmake.org/t/determining-the-compiler-default-c-standard/10389 "2024-10-10T12:03:31Z")

</div>

Hi, This question is related to setting c++ standard from target\_compile\_option goes for higher standard - #8 by adaldev. Investigating on the question of the actual C++ dialect used when requesting on with target\_comp…

---

## [Using CMake without a generator](https://discourse.cmake.org/t/using-cmake-without-a-generator/12728)

<div class="topic-metadata">

**Author:** [@RSin](https://discourse.cmake.org/u/RSin)\
**Replies:** 2\
**Last updated:** [October 10, 2024, 6:47am UTC](https://discourse.cmake.org/t/using-cmake-without-a-generator/12728 "2024-10-10T06:47:00Z")

</div>

Is there a way to use CMake without a generator, basically only to benefit from its multi platform features like downloading packages and so on? We are using CMake to build projects, but also (as an option) to only down…

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

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