# Usage

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

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

**Page:** 39

---

## [install(IMPORTED\_RUNTIME\_ARTIFACTS...) does not work on Darwin (OSX)](https://discourse.cmake.org/t/install-imported-runtime-artifacts-does-not-work-on-darwin-osx/9018)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 5\
**Last updated:** [September 24, 2023, 12:21pm UTC](https://discourse.cmake.org/t/install-imported-runtime-artifacts-does-not-work-on-darwin-osx/9018 "2023-09-24T12:21:20Z")

</div>

with this CMake snipped: install(TARGETS ${PROJECT\_NAME} notifier consumer supplier RUNTIME COMPONENT ${PROJECT\_NAME}) install(IMPORTED\_RUNTIME\_ARTIFACTS notifier RUNTIME\_DEPENDENCY\_SET \_dependency\_set) # FIXME: not …

---

## [CMAKE\_CXX\_COMPILER\_LAUNCHER=ccache usage question](https://discourse.cmake.org/t/cmake-cxx-compiler-launcher-ccache-usage-question/9036)

<div class="topic-metadata">

**Author:** [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)\
**Replies:** 2\
**Last updated:** [September 24, 2023, 2:52am UTC](https://discourse.cmake.org/t/cmake-cxx-compiler-launcher-ccache-usage-question/9036 "2023-09-24T02:52:57Z")

</div>

What happens if I set CMAKE\_CXX\_COMPILER\_LAUNCHER=ccache and ccache doesn’t exist? Will CMake error out? Or will CMake just ignore CMAKE\_CXX\_COMPILER\_LAUNCHER?

---

## [Install 3rd party macOS installer package](https://discourse.cmake.org/t/install-3rd-party-macos-installer-package/9026)

<div class="topic-metadata">

**Author:** [@Mahesh](https://discourse.cmake.org/u/Mahesh)\
**Replies:** 3\
**Last updated:** [September 24, 2023, 2:50am UTC](https://discourse.cmake.org/t/install-3rd-party-macos-installer-package/9026 "2023-09-24T02:50:37Z")

</div>

I am using CPack module in CMake to generate the product installer on macOS. I am trying to install a 3rd party macOS installer package as a prerequisite to our product installer. I tried - add\_executable( XYZ I…

---

## [Reconciling default Visual Studio 2022 .vcxproj file vs CMake generated .vcxproj file in Release mode | x64](https://discourse.cmake.org/t/reconciling-default-visual-studio-2022-vcxproj-file-vs-cmake-generated-vcxproj-file-in-release-mode-x64/9020)

<div class="topic-metadata">

**Author:** [@TryerGit](https://discourse.cmake.org/u/TryerGit)\
**Replies:** 1\
**Last updated:** [September 24, 2023, 12:33am UTC](https://discourse.cmake.org/t/reconciling-default-visual-studio-2022-vcxproj-file-vs-cmake-generated-vcxproj-file-in-release-mode-x64/9020 "2023-09-24T00:33:43Z")

</div>

Hello, I am trying to reconcile the .vcxproj file generated by native Visual Studio for Release build x64 architecture with the equivalent file generated by CMake when the generator is set to Visual Studio. The native …

---

## [How to evaluate $\<CONFIG\>\_POSTFIX?](https://discourse.cmake.org/t/how-to-evaluate-config-postfix/8984)

<div class="topic-metadata">

**Author:** [@opoplawski](https://discourse.cmake.org/u/opoplawski)\
**Replies:** 5\
**Last updated:** [September 23, 2023, 11:40am UTC](https://discourse.cmake.org/t/how-to-evaluate-config-postfix/8984 "2023-09-23T11:40:51Z")

</div>

I’m trying to do: install ( FILES ${CMAKE\_CURRENT\_BINARY\_DIR}/BTF.pc DESTINATION ${SUITESPARSE\_LIBDIR}/pkgconfig RENAME BTF${$\<CONFIG\>\_POSTFIX} ) Which doesn’t work (‘\<’ in variable name). And $\_PO…

---

## [Is there an easy way to get a reproducer when cmake can't build a simple test program?](https://discourse.cmake.org/t/is-there-an-easy-way-to-get-a-reproducer-when-cmake-cant-build-a-simple-test-program/9055)

<div class="topic-metadata">

**Author:** [@chriselrod](https://discourse.cmake.org/u/chriselrod)\
**Replies:** 2\
**Last updated:** [September 23, 2023, 12:56am UTC](https://discourse.cmake.org/t/is-there-an-easy-way-to-get-a-reproducer-when-cmake-cant-build-a-simple-test-program/9055 "2023-09-23T00:56:16Z")

</div>

Sample from the cmake output: Change Dir: '/home/chriselrod/Documents/progwork/cxx/Math/buildclang/test/CMakeFiles/CMakeScratch/TryCompile-siaNVZ' Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /bin/gmak…

---

## [Design cmake projects with autocode generators](https://discourse.cmake.org/t/design-cmake-projects-with-autocode-generators/9011)

<div class="topic-metadata">

**Author:** [@Martin\_Santa\_Maria](https://discourse.cmake.org/u/Martin_Santa_Maria)\
**Replies:** 4\
**Last updated:** [September 22, 2023, 8:16pm UTC](https://discourse.cmake.org/t/design-cmake-projects-with-autocode-generators/9011 "2023-09-22T20:16:47Z")

</div>

Hello Communiry, I’m trying to use cmake for our build system. We use autocode generators to generate code from models. These models are parsed to get dependencies between them and so, regenerate the impacted code if o…

---

## [CMake (CMD) doesn't detect VS 2022](https://discourse.cmake.org/t/cmake-cmd-doesnt-detect-vs-2022/9045)

<div class="topic-metadata">

**Author:** [@Al-AmeenAdewunmi](https://discourse.cmake.org/u/Al-AmeenAdewunmi)\
**Replies:** 6\
**Last updated:** [September 22, 2023, 12:41pm UTC](https://discourse.cmake.org/t/cmake-cmd-doesnt-detect-vs-2022/9045 "2023-09-22T12:41:41Z")

</div>

Exactly what it says in the title. Initially, I kept getting this error: -- The C compiler identification is unknown -- The CXX compiler identification is unknown CMake Error at CMakeLists.txt:3 (project): No CMAKE\_C…

---

## [Questions about importing library file xxx.dll.a when generating dynamic library in window environment](https://discourse.cmake.org/t/questions-about-importing-library-file-xxx-dll-a-when-generating-dynamic-library-in-window-environment/9015)

<div class="topic-metadata">

**Author:** [@xhc-code](https://discourse.cmake.org/u/xhc-code)\
**Replies:** 5\
**Last updated:** [September 22, 2023, 5:00am UTC](https://discourse.cmake.org/t/questions-about-importing-library-file-xxx-dll-a-when-generating-dynamic-library-in-window-environment/9015 "2023-09-22T05:00:39Z")

</div>

In the window environment, when gcc generates the share dynamic dll library, it is always accompanied by the file xxx.dll.a. I searched and learned that this file is an import library, but I cannot find the function and …

---

## [How can dynamic DLL libraries be found at runtime?](https://discourse.cmake.org/t/how-can-dynamic-dll-libraries-be-found-at-runtime/9005)

<div class="topic-metadata">

**Author:** [@xhc-code](https://discourse.cmake.org/u/xhc-code)\
**Replies:** 8\
**Last updated:** [September 22, 2023, 4:59am UTC](https://discourse.cmake.org/t/how-can-dynamic-dll-libraries-be-found-at-runtime/9005 "2023-09-22T04:59:50Z")

</div>

I have a DLL library that is external and has links configured\_ Directory can be compiled and linked normally, but during runtime, it will warn that xxx.dll is not found, and through ldd xxx.exe, it will also prompt that…

---

## [Tutorial Step 10 POSITION\_INDEPENDENT\_CODE step](https://discourse.cmake.org/t/tutorial-step-10-position-independent-code-step/9041)

<div class="topic-metadata">

**Author:** [@tjdphd](https://discourse.cmake.org/u/tjdphd)\
**Replies:** 1\
**Last updated:** [September 21, 2023, 10:21pm UTC](https://discourse.cmake.org/t/tutorial-step-10-position-independent-code-step/9041 "2023-09-21T22:21:10Z")

</div>

Greetings, working through step 10 of tutorial and now at the last paragraph which starts “At this point, if you build everything …” and goes onto say there will be a link error if you try to build without doing what fo…

---

## [Project structure for unit testing and coverage](https://discourse.cmake.org/t/project-structure-for-unit-testing-and-coverage/9038)

<div class="topic-metadata">

**Author:** [@Bert](https://discourse.cmake.org/u/Bert)\
**Replies:** 3\
**Last updated:** [September 21, 2023, 10:20pm UTC](https://discourse.cmake.org/t/project-structure-for-unit-testing-and-coverage/9038 "2023-09-21T22:20:01Z")

</div>

I’ve been reading a book by one of the CMake guys called “Professional Cmake.” It’s an amazing book and has been a daily tool for me lately. However, one of the gray areas for me is not only how to structure a large pro…

---

## [imported library compile flags not loaded](https://discourse.cmake.org/t/imported-library-compile-flags-not-loaded/9023)

<div class="topic-metadata">

**Author:** [@jwm](https://discourse.cmake.org/u/jwm)\
**Replies:** 3\
**Last updated:** [September 21, 2023, 12:04pm UTC](https://discourse.cmake.org/t/imported-library-compile-flags-not-loaded/9023 "2023-09-21T12:04:01Z")

</div>

BLUF (Bottom Line Up Front) Pascal quote applies If a package provides a CMake FooConfig.cmake file and also provides pkg-config support (foo.pc), should I reasonably expect that the information in both locations are co…

---

## [file ARCHIVE\_CREATE uses relative paths](https://discourse.cmake.org/t/file-archive-create-uses-relative-paths/9013)

<div class="topic-metadata">

**Author:** [@K20shores](https://discourse.cmake.org/u/K20shores)\
**Replies:** 1\
**Last updated:** [September 20, 2023, 2:31pm UTC](https://discourse.cmake.org/t/file-archive-create-uses-relative-paths/9013 "2023-09-20T14:31:29Z")

</div>

I’m trying to create some zip files with cmake. I’m either using the archive creation incorrectly or there’s a bug because the internal paths of my zip files are always relative paths. With this directory structure: ::…

---

## [Ninja Multi-Config No Work To Do On --Build --Config Change](https://discourse.cmake.org/t/ninja-multi-config-no-work-to-do-on-build-config-change/8994)

<div class="topic-metadata">

**Author:** [@Blazefire](https://discourse.cmake.org/u/Blazefire)\
**Replies:** 2\
**Last updated:** [September 20, 2023, 2:47am UTC](https://discourse.cmake.org/t/ninja-multi-config-no-work-to-do-on-build-config-change/8994 "2023-09-20T02:47:27Z")

</div>

Sorry I am brand new to cmake and ninja was trying to figure out how to switch my project from release and debug. I build using a multi-config ninja generator like this cmake -S ./ -B ./build -G "Ninja Multi-Config" cm…

---

## [cmake not working after update do Big Sur](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546)

<div class="topic-metadata">

**Author:** [@Harniver](https://discourse.cmake.org/u/Harniver)\
**Replies:** 21\
**Last updated:** [September 20, 2023, 1:56am UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546 "2023-09-20T01:56:55Z")

</div>

After updating to Big Sur, I am unable to compile anything with cmake. I re-installed the command line tools (xcode-select --install) and updated cmake (brew upgrade cmake). When running cmake -S ./ -B ./bin -G "Unix Mak…

---

## [CMAKE \<LINK\_LIBRARIES\> separated by spaces not commas in linker command](https://discourse.cmake.org/t/cmake-link-libraries-separated-by-spaces-not-commas-in-linker-command/9003)

<div class="topic-metadata">

**Author:** [@cwilliamson](https://discourse.cmake.org/u/cwilliamson)\
**Replies:** 7\
**Last updated:** [September 19, 2023, 5:53pm UTC](https://discourse.cmake.org/t/cmake-link-libraries-separated-by-spaces-not-commas-in-linker-command/9003 "2023-09-19T17:53:49Z")

</div>

I’m trying to get CMake to use a custom compiler to build some code. I’ve setup a cmake toolchain file that works great for everything besides linking in static libraries. The linker requires all libraries to be passed u…

---

## [detecting if libc++ is present](https://discourse.cmake.org/t/detecting-if-libc-is-present/9006)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 2\
**Last updated:** [September 19, 2023, 3:15pm UTC](https://discourse.cmake.org/t/detecting-if-libc-is-present/9006 "2023-09-19T15:15:59Z")

</div>

I wanted to automatically set stdlib to libc++ when compiler is clang but I stumbled upon a machine where clang++ was present but target\_link\_options(${TARGET\_NAME} PUBLIC $\<$\<LINK\_LANGUAGE:CXX\>:-stdlib=libc++\>) emitt…

---

## [Testing with MPI+OpenMP+\`ctest -j\`](https://discourse.cmake.org/t/testing-with-mpi-openmp-ctest-j/8982)

<div class="topic-metadata">

**Author:** [@Lecris](https://discourse.cmake.org/u/Lecris)\
**Replies:** 2\
**Last updated:** [September 15, 2023, 1:36pm UTC](https://discourse.cmake.org/t/testing-with-mpi-openmp-ctest-j/8982 "2023-09-15T13:36:50Z")

</div>

I have recently encountered a project that hard-codes the values passed through MPIEXEC\_NUMPROC\_FLAG and the OMP\_NUM\_THREADS so that they add-up to $(nproc). But on the packaging side, -j 2 is automatically added, thus o…

---

## [Out of source CMake preset file](https://discourse.cmake.org/t/out-of-source-cmake-preset-file/8879)

<div class="topic-metadata">

**Author:** [@fwh](https://discourse.cmake.org/u/fwh)\
**Replies:** 3\
**Last updated:** [September 15, 2023, 6:23am UTC](https://discourse.cmake.org/t/out-of-source-cmake-preset-file/8879 "2023-09-15T06:23:40Z")

</div>

Hi, I am looking for some advice regarding the use of preset files: CMakePresets.json I am building a 3rd party library for different platforms using a different set of variables for each platform and I want to use CMa…

---

## [include directories not passed to compiler despite INCLUDE\_DIRECTORIES](https://discourse.cmake.org/t/include-directories-not-passed-to-compiler-despite-include-directories/8971)

<div class="topic-metadata">

**Author:** [@f-zl](https://discourse.cmake.org/u/f-zl)\
**Replies:** 4\
**Last updated:** [September 15, 2023, 2:48am UTC](https://discourse.cmake.org/t/include-directories-not-passed-to-compiler-despite-include-directories/8971 "2023-09-15T02:48:51Z")

</div>

I have a cross compile project. I wish to use include\_directories(SYSTEM ${ISYSTEM\_PATH}) to add the system include path for all targets (including targets in add\_subdirectory), but fails. The INCLUDE\_DIRECTORIES is set…

---

## [Why are my custom compiler flags modified](https://discourse.cmake.org/t/why-are-my-custom-compiler-flags-modified/8966)

<div class="topic-metadata">

**Author:** [@f-zl](https://discourse.cmake.org/u/f-zl)\
**Replies:** 2\
**Last updated:** [September 14, 2023, 1:28pm UTC](https://discourse.cmake.org/t/why-are-my-custom-compiler-flags-modified/8966 "2023-09-14T13:28:54Z")

</div>

I need to add a variable (a list) to the compiler flags. But that variable is modified when the compiler is invoked. cmake\_minimum\_required(VERSION 3.16) project(test LANGUAGES C) set(ISYSTEM\_FLAGS -isystem path1 -isyst…

---

## [CPack Verbose: warning: embedded item does not exist](https://discourse.cmake.org/t/cpack-verbose-warning-embedded-item-does-not-exist/8962)

<div class="topic-metadata">

**Author:** [@max0](https://discourse.cmake.org/u/max0)\
**Replies:** 3\
**Last updated:** [September 14, 2023, 12:33am UTC](https://discourse.cmake.org/t/cpack-verbose-warning-embedded-item-does-not-exist/8962 "2023-09-14T00:33:22Z")

</div>

Hi, I’m creating a macOS app bundle using CPack with the BUNDLE generator. The resulting .app bundle and DMG installer work fine. However, during fixup\_bundle, I see a lot of repeated warnings and the process itself take…

---

## [Dependency not being respected - executable not being relinked when necessary](https://discourse.cmake.org/t/dependency-not-being-respected-executable-not-being-relinked-when-necessary/8906)

<div class="topic-metadata">

**Author:** [@Barry\_Revzin](https://discourse.cmake.org/u/Barry_Revzin)\
**Replies:** 12\
**Last updated:** [September 13, 2023, 9:56pm UTC](https://discourse.cmake.org/t/dependency-not-being-respected-executable-not-being-relinked-when-necessary/8906 "2023-09-13T21:56:53Z")

</div>

Consider the following reduced and seemingly silly example. We require four files: . ├── CMakeLists.txt ├── ex1.cxx ├── ex2.cxx └── gen\_linker.py CMakeLists.txt: cmake\_minimum\_required(VERSION 3.24) project(linking) …

---

## [Issues with ExternalProject, MultiConfig, CommandLine](https://discourse.cmake.org/t/issues-with-externalproject-multiconfig-commandline/8948)

<div class="topic-metadata">

**Author:** [@aaye](https://discourse.cmake.org/u/aaye)\
**Replies:** 2\
**Last updated:** [September 13, 2023, 7:47am UTC](https://discourse.cmake.org/t/issues-with-externalproject-multiconfig-commandline/8948 "2023-09-13T07:47:09Z")

</div>

Finally got a superbuild project up and running for a rather large case. Some notes from what I am seeing on a project that supports Windows / Linux / Mac, Clang (Windows, Unix) and MSVC (Windows). When changing confi…

---

## [CTest Performance in finding cases in build tree](https://discourse.cmake.org/t/ctest-performance-in-finding-cases-in-build-tree/8920)

<div class="topic-metadata">

**Author:** [@\_Winston](https://discourse.cmake.org/u/_Winston)\
**Replies:** 1\
**Last updated:** [September 13, 2023, 2:54am UTC](https://discourse.cmake.org/t/ctest-performance-in-finding-cases-in-build-tree/8920 "2023-09-13T02:54:10Z")

</div>

Hi cmake support team, We are heavily leverage cmake/ctest as our build and test management system, while we are facing a ctest performance problem in our case. In our case, we had defined almost 100 thoughts ctest cas…

---

## [How to get cmake to monitor a specific file](https://discourse.cmake.org/t/how-to-get-cmake-to-monitor-a-specific-file/8903)

<div class="topic-metadata">

**Author:** [@aidexie](https://discourse.cmake.org/u/aidexie)\
**Replies:** 1\
**Last updated:** [September 13, 2023, 2:25am UTC](https://discourse.cmake.org/t/how-to-get-cmake-to-monitor-a-specific-file/8903 "2023-09-13T02:25:33Z")

</div>

I am using android studio to compile a large project with many modules. When I modify CMakeList.txt, xxx.cmake files, it triggers android studio to go and regenerate the cmake project. I want to add some file types to mo…

---

## [ExternalProject\_Add error MSB1009: Project file does not exist](https://discourse.cmake.org/t/externalproject-add-error-msb1009-project-file-does-not-exist/8893)

<div class="topic-metadata">

**Author:** [@jaquilio](https://discourse.cmake.org/u/jaquilio)\
**Replies:** 9\
**Last updated:** [September 13, 2023, 1:18am UTC](https://discourse.cmake.org/t/externalproject-add-error-msb1009-project-file-does-not-exist/8893 "2023-09-13T01:18:30Z")

</div>

I am trying to build an external library using ExternalProject\_Add. I am getting the Project file does not exist error while building with MS Visual Studio. MSBuild version 17.7.2+d6990bcfa for .NET Framework C…

---

## [packagePresets options in CMakePreset not taken in account](https://discourse.cmake.org/t/packagepresets-options-in-cmakepreset-not-taken-in-account/8908)

<div class="topic-metadata">

**Author:** [@kingloxxy](https://discourse.cmake.org/u/kingloxxy)\
**Replies:** 5\
**Last updated:** [September 10, 2023, 9:31am UTC](https://discourse.cmake.org/t/packagepresets-options-in-cmakepreset-not-taken-in-account/8908 "2023-09-10T09:31:32Z")

</div>

Hi, I am using a CMakePresets.json in order to generate an artefact of my project. I defined various options on the buildPresets step to custom my output artefact. Nevertheless, some of the options set are not being t…

---

## [RE: CTest Performance in finding cases in build tree](https://discourse.cmake.org/t/re-ctest-performance-in-finding-cases-in-build-tree/8921)

<div class="topic-metadata">

**Author:** [@\_Chuan](https://discourse.cmake.org/u/_Chuan)\
**Replies:** 0\
**Last updated:** [September 10, 2023, 8:42am UTC](https://discourse.cmake.org/t/re-ctest-performance-in-finding-cases-in-build-tree/8921 "2023-09-10T08:42:30Z")

</div>

Correct a typo.

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

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