# Usage

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

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

**Page:** 70

---

## [Change in behavior wrt LANGUAGE source property?](https://discourse.cmake.org/t/change-in-behavior-wrt-language-source-property/4600)

<div class="topic-metadata">

**Author:** [@ingolf](https://discourse.cmake.org/u/ingolf)\
**Replies:** 4\
**Last updated:** [December 6, 2021, 12:00pm UTC](https://discourse.cmake.org/t/change-in-behavior-wrt-language-source-property/4600 "2021-12-06T12:00:28Z")

</div>

Hi, in our project, we have a few .S assembly files which up to now were treated like regular C files (i.e. they were compiled with the same compiler + flags/options as C files). This was achieved by set\_source\_files\_pr…

---

## [Using Cmake with existing stuff](https://discourse.cmake.org/t/using-cmake-with-existing-stuff/4594)

<div class="topic-metadata">

**Author:** [@Igor\_Korot](https://discourse.cmake.org/u/Igor_Korot)\
**Replies:** 5\
**Last updated:** [December 6, 2021, 9:50am UTC](https://discourse.cmake.org/t/using-cmake-with-existing-stuff/4594 "2021-12-06T09:50:21Z")

</div>

Hi, Is there an option in CMake to use an existing makefile/solution? Or maybe, just check if the depende There is no reason whatsoever to re-create whats already been done and tested… Thank you.

---

## [Building Release on macOS with separate debug symbols file](https://discourse.cmake.org/t/building-release-on-macos-with-separate-debug-symbols-file/4571)

<div class="topic-metadata">

**Author:** [@thomthom](https://discourse.cmake.org/u/thomthom)\
**Replies:** 5\
**Last updated:** [December 5, 2021, 10:10pm UTC](https://discourse.cmake.org/t/building-release-on-macos-with-separate-debug-symbols-file/4571 "2021-12-05T22:10:08Z")

</div>

I’m trying to figure out how to build Release config that also include debug symbols in a separate file on macOS. How is that controlled via CMake?

---

## [Is CMAKE\_EXE\_LINKER\_FLAGS\_\<CONFIG\>\_INIT supposed to work for user-defined configuration types?](https://discourse.cmake.org/t/is-cmake-exe-linker-flags-config-init-supposed-to-work-for-user-defined-configuration-types/4592)

<div class="topic-metadata">

**Author:** [@Zachary\_Turner](https://discourse.cmake.org/u/Zachary_Turner)\
**Replies:** 3\
**Last updated:** [December 5, 2021, 7:50pm UTC](https://discourse.cmake.org/t/is-cmake-exe-linker-flags-config-init-supposed-to-work-for-user-defined-configuration-types/4592 "2021-12-05T19:50:22Z")

</div>

I define a few of my own build configurations via CMAKE\_CONFIGURATION\_TYPES. One of these is called NoOpt. I set this before the first call to project(), and I use a toolchain file. In the toolchain file I then do: s…

---

## [find\_package and build configuration](https://discourse.cmake.org/t/find-package-and-build-configuration/4530)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 2\
**Last updated:** [December 2, 2021, 10:19am UTC](https://discourse.cmake.org/t/find-package-and-build-configuration/4530 "2021-12-02T10:19:07Z")

</div>

Hi, Out of curiosity, how does find\_package selects the right configuration? if I have a target in “Debug” it imports the dependencies in “Debug”, dito in “Release”. What’s the behaviour with custom configurations? W…

---

## [FetchContent\_MakeAvailable fails if Git repository is deleted](https://discourse.cmake.org/t/fetchcontent-makeavailable-fails-if-git-repository-is-deleted/4538)

<div class="topic-metadata">

**Author:** [@developer](https://discourse.cmake.org/u/developer)\
**Replies:** 3\
**Last updated:** [December 1, 2021, 10:52pm UTC](https://discourse.cmake.org/t/fetchcontent-makeavailable-fails-if-git-repository-is-deleted/4538 "2021-12-01T22:52:40Z")

</div>

I am using FetchContent like below FetchContent\_Declare( foo GIT\_REPOSITORY n ssh://foo-url GIT\_TAG 1.0.1 GIT\_SHALLOW TRUE SOURCE\_DIR $ENV{HOME}/foo ) FetchConten…

---

## [Share FetchContent between projects](https://discourse.cmake.org/t/share-fetchcontent-between-projects/4537)

<div class="topic-metadata">

**Author:** [@developer](https://discourse.cmake.org/u/developer)\
**Replies:** 3\
**Last updated:** [December 1, 2021, 10:51pm UTC](https://discourse.cmake.org/t/share-fetchcontent-between-projects/4537 "2021-12-01T22:51:33Z")

</div>

Our project has a few large Git LFS repositories (some of which are ~10 GB). We have a few main repositories (repos) that we build different sets of applications of using CMake as the build system. These main repos all …

---

## [Download timeouts when building singularity container](https://discourse.cmake.org/t/download-timeouts-when-building-singularity-container/4576)

<div class="topic-metadata">

**Author:** [@reinago](https://discourse.cmake.org/u/reinago)\
**Replies:** 0\
**Last updated:** [December 1, 2021, 11:00am UTC](https://discourse.cmake.org/t/download-timeouts-when-building-singularity-container/4576 "2021-12-01T11:00:14Z")

</div>

Hi, I am experimenting with building a singularity container for ls1, OSPRay, and MegaMol: ls1-mardyn/ls1-megamol.def at master · reinago/ls1-mardyn · GitHub So far it works up to the OSPRay superbuild, but on my setup…

---

## [Controlling archive creation with CPack](https://discourse.cmake.org/t/controlling-archive-creation-with-cpack/4570)

<div class="topic-metadata">

**Author:** [@jjELT](https://discourse.cmake.org/u/jjELT)\
**Replies:** 0\
**Last updated:** [November 29, 2021, 11:56am UTC](https://discourse.cmake.org/t/controlling-archive-creation-with-cpack/4570 "2021-11-29T11:56:03Z")

</div>

Introduction I read the CPack tutorials, but did not find a solution for my specific problem. I have a project with an optional target I add with the EXCLUDE\_FROM\_ALL option # This is an optional target. add\_executable…

---

## [COMPILE\_DEFINITIONS directory property not propagated to targets?](https://discourse.cmake.org/t/compile-definitions-directory-property-not-propagated-to-targets/4555)

<div class="topic-metadata">

**Author:** [@ingolf](https://discourse.cmake.org/u/ingolf)\
**Replies:** 2\
**Last updated:** [November 29, 2021, 8:18am UTC](https://discourse.cmake.org/t/compile-definitions-directory-property-not-propagated-to-targets/4555 "2021-11-29T08:18:22Z")

</div>

Hi, apparently, the COMPILE\_DEFINITIONS directory property is not (always) propagated to the targets defined in that directory. Is that on purpose? Do I miss something? In my situation, there is an add\_definitions(-Dso…

---

## [FindPython older versions](https://discourse.cmake.org/t/findpython-older-versions/4567)

<div class="topic-metadata">

**Author:** [@Catherine\_Holloway](https://discourse.cmake.org/u/Catherine_Holloway)\
**Replies:** 1\
**Last updated:** [November 28, 2021, 9:54pm UTC](https://discourse.cmake.org/t/findpython-older-versions/4567 "2021-11-28T21:54:59Z")

</div>

Consider the container created by the dockerfile: FROM ubuntu:latest RUN apt update && apt install -y wget gpg python3.8-dev python3.9-dev gcc g++ make RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.a…

---

## [Static Python on Windows / Find\_Python](https://discourse.cmake.org/t/static-python-on-windows-find-python/4427)

<div class="topic-metadata">

**Author:** [@kfsone](https://discourse.cmake.org/u/kfsone)\
**Replies:** 6\
**Last updated:** [November 26, 2021, 8:52pm UTC](https://discourse.cmake.org/t/static-python-on-windows-find-python/4427 "2021-11-26T20:52:02Z")

</div>

While modernizing some CMake projects, I tried switching to the Find\_Python modules, and all seemed well until I tried running the Windows exe on a test machine, and then it can’t find PythonX.dll. This makes sense: Des…

---

## [Could NOT find ZLIB](https://discourse.cmake.org/t/could-not-find-zlib/4550)

<div class="topic-metadata">

**Author:** [@Lasslos05](https://discourse.cmake.org/u/Lasslos05)\
**Replies:** 3\
**Last updated:** [November 26, 2021, 6:17pm UTC](https://discourse.cmake.org/t/could-not-find-zlib/4550 "2021-11-26T18:17:13Z")

</div>

Hey Guys, I am brand new to cmake and having some problems. I am trying to set up PrizmSDK: PrizmSDK for Casio Setup Mkg3a Problems - Cemetech | Forum | Casio Prizm/FX Development & Programming \[Topic\] I am getting an …

---

## [Build fail at ClamAV104 with Cmake22](https://discourse.cmake.org/t/build-fail-at-clamav104-with-cmake22/4554)

<div class="topic-metadata">

**Author:** [@Yongliang](https://discourse.cmake.org/u/Yongliang)\
**Replies:** 0\
**Last updated:** [November 26, 2021, 12:02pm UTC](https://discourse.cmake.org/t/build-fail-at-clamav104-with-cmake22/4554 "2021-11-26T12:02:52Z")

</div>

Please help me, thank you! １）environment：gcc,g++ GNU 7.1.0, SunOS solaris 5.11 11.3 i86pc i386 i86pc ２）The following is error Info. Consolidate compiler generated dependencies of target clamconf \[ 93%\] Linking C exec…

---

## [A way to reload toolchain file without removing downloaded dependencies](https://discourse.cmake.org/t/a-way-to-reload-toolchain-file-without-removing-downloaded-dependencies/4553)

<div class="topic-metadata">

**Author:** [@KKoovalsky](https://discourse.cmake.org/u/KKoovalsky)\
**Replies:** 0\
**Last updated:** [November 26, 2021, 9:24am UTC](https://discourse.cmake.org/t/a-way-to-reload-toolchain-file-without-removing-downloaded-dependencies/4553 "2021-11-26T09:24:11Z")

</div>

Hello! Is there a way to quickly reload the toolchain file, after applying some changes? Normally I do it like this: # Remove everything except dependencies downloaded with FetchContent module. rm -rf !(\_deps) # Insi…

---

## [Issue Understanding the CPM](https://discourse.cmake.org/t/issue-understanding-the-cpm/4543)

<div class="topic-metadata">

**Author:** [@mrmsdbdl](https://discourse.cmake.org/u/mrmsdbdl)\
**Replies:** 7\
**Last updated:** [November 25, 2021, 3:30pm UTC](https://discourse.cmake.org/t/issue-understanding-the-cpm/4543 "2021-11-25T15:30:13Z")

</div>

I am wondering if someone could help me understand an issue that I have with the CPM. I can integrated it, no problem. But for some reason, when I build my project. CPM starts to mix up everything. It creates a lib, and b…

---

## [Cross Compile to Arm-none-eabi with CMakePresets](https://discourse.cmake.org/t/cross-compile-to-arm-none-eabi-with-cmakepresets/4548)

<div class="topic-metadata">

**Author:** [@JuliusCaesar](https://discourse.cmake.org/u/JuliusCaesar)\
**Replies:** 0\
**Last updated:** [November 25, 2021, 2:10pm UTC](https://discourse.cmake.org/t/cross-compile-to-arm-none-eabi-with-cmakepresets/4548 "2021-11-25T14:10:39Z")

</div>

Hey guys, I’m currently trying to get cmake to work for cross compiling an embedded project using gcc arm-none-eabi. I found this nice toolchain and it helps me passing the required compiler tests. However the archite…

---

## [Clone Git Repository using new CMake FetchContent Functionality](https://discourse.cmake.org/t/clone-git-repository-using-new-cmake-fetchcontent-functionality/4487)

<div class="topic-metadata">

**Author:** [@JuliusCaesar](https://discourse.cmake.org/u/JuliusCaesar)\
**Replies:** 16\
**Last updated:** [November 25, 2021, 1:33pm UTC](https://discourse.cmake.org/t/clone-git-repository-using-new-cmake-fetchcontent-functionality/4487 "2021-11-25T13:33:25Z")

</div>

Hey guys, I Read about the new cmake FetchContent . i’d like to use this to clone and checkout a git repository include(FetchContent) function(CloneRepository repositoryURL branchName projectName sourceDir) #Comman…

---

## [Prevent creating empty directories using install(DIRECTORY)](https://discourse.cmake.org/t/prevent-creating-empty-directories-using-install-directory/4528)

<div class="topic-metadata">

**Author:** [@jjELT](https://discourse.cmake.org/u/jjELT)\
**Replies:** 2\
**Last updated:** [November 24, 2021, 7:51am UTC](https://discourse.cmake.org/t/prevent-creating-empty-directories-using-install-directory/4528 "2021-11-24T07:51:42Z")

</div>

When using install(DIRECTORY … \[…\]), how can I prevent empty directories from being created? For instance, when installing all header files and template implementation files using # Install the header files and templat…

---

## [CPack Archive Generator TOPLEVEL\_DIRECTORY Name](https://discourse.cmake.org/t/cpack-archive-generator-toplevel-directory-name/4533)

<div class="topic-metadata">

**Author:** [@jjELT](https://discourse.cmake.org/u/jjELT)\
**Replies:** 2\
**Last updated:** [November 24, 2021, 7:34am UTC](https://discourse.cmake.org/t/cpack-archive-generator-toplevel-directory-name/4533 "2021-11-24T07:34:12Z")

</div>

When creating e.g. a ZIP file for all installed binaries using the CPack Archive Generator, there appears to be no way to define the name of the toplevel directory within the created archive. One can only enable/disable…

---

## [Partial build, even for a single top-level target?](https://discourse.cmake.org/t/partial-build-even-for-a-single-top-level-target/4535)

<div class="topic-metadata">

**Author:** [@Stefaan](https://discourse.cmake.org/u/Stefaan)\
**Replies:** 1\
**Last updated:** [November 24, 2021, 2:31am UTC](https://discourse.cmake.org/t/partial-build-even-for-a-single-top-level-target/4535 "2021-11-24T02:31:59Z")

</div>

Hi! I really like how modern CMake allows adding sources to a top-level target, from within a subdirectory. Before this, (I think) I needed to have per-subdirectory library targets defined, to have subdir CMakeLists.txt…

---

## [visual studio environment error](https://discourse.cmake.org/t/visual-studio-environment-error/4444)

<div class="topic-metadata">

**Author:** [@wangtao8869](https://discourse.cmake.org/u/wangtao8869)\
**Replies:** 3\
**Last updated:** [November 24, 2021, 2:22am UTC](https://discourse.cmake.org/t/visual-studio-environment-error/4444 "2021-11-24T02:22:36Z")

</div>

when i try to use cmake to generate the visual studio sln project file with GPU, it shows error. Error Cuda — build in 32 bits i use visual studio 2019, if the cmake file is wrong? thank you! if(NOT \_resultNVCC EQUAL…

---

## [How to use host tools using find\_package when cross-compiling (eg. Qt5LinguistTools)](https://discourse.cmake.org/t/how-to-use-host-tools-using-find-package-when-cross-compiling-eg-qt5linguisttools/4224)

<div class="topic-metadata">

**Author:** [@amurzeau](https://discourse.cmake.org/u/amurzeau)\
**Replies:** 3\
**Last updated:** [November 24, 2021, 2:20am UTC](https://discourse.cmake.org/t/how-to-use-host-tools-using-find-package-when-cross-compiling-eg-qt5linguisttools/4224 "2021-11-24T02:20:48Z")

</div>

Hi, I’m trying to do this: Cross compile a Qt application: building on Linux and target Windows using MinGW I have a cross compiled Qt already Use Qt Linguists tools from the host using find\_package(Qt5LinguistTools) …

---

## [Custom target is not being built unless the ALL keyword is included](https://discourse.cmake.org/t/custom-target-is-not-being-built-unless-the-all-keyword-is-included/4511)

<div class="topic-metadata">

**Author:** [@kgurney](https://discourse.cmake.org/u/kgurney)\
**Replies:** 3\
**Last updated:** [November 23, 2021, 10:10pm UTC](https://discourse.cmake.org/t/custom-target-is-not-being-built-unless-the-all-keyword-is-included/4511 "2021-11-23T22:10:52Z")

</div>

My understanding is that custom targets which depend on another executable or library target should always be built after the dependent target is built. Example: project(foo) add\_executable(foo foo.cpp) add\_custom\_ta…

---

## [Solaris 11.4: ‘to\_string’ is not a member of ‘std’ compiler error](https://discourse.cmake.org/t/solaris-11-4-to-string-is-not-a-member-of-std-compiler-error/4518)

<div class="topic-metadata">

**Author:** [@Yongliang](https://discourse.cmake.org/u/Yongliang)\
**Replies:** 5\
**Last updated:** [November 23, 2021, 11:31am UTC](https://discourse.cmake.org/t/solaris-11-4-to-string-is-not-a-member-of-std-compiler-error/4518 "2021-11-23T11:31:03Z")

</div>

when I compile on Sun Solaris11.4, the following error is reported, What do I do to solve it? thank you! Compiler Information: CMake 3.22.0, Copyright 2000-2021 Kitware, Inc. and Contributors C compiler on this system…

---

## [Recommendations for Python module inclusion](https://discourse.cmake.org/t/recommendations-for-python-module-inclusion/2612)

<div class="topic-metadata">

**Author:** [@Vino](https://discourse.cmake.org/u/Vino)\
**Replies:** 7\
**Last updated:** [November 23, 2021, 12:05am UTC](https://discourse.cmake.org/t/recommendations-for-python-module-inclusion/2612 "2021-11-23T00:05:33Z")

</div>

Hello, I am researching a current, modern ways how to implement CMAKE based build system for my project which is currently based on handwritten makefiles. The main part is written in C and consists of several libraries…

---

## [msys2: Unknown platform using MSYS2-MINGW32 in Windows 10](https://discourse.cmake.org/t/msys2-unknown-platform-using-msys2-mingw32-in-windows-10/4521)

<div class="topic-metadata">

**Author:** [@Richard\_Dobson](https://discourse.cmake.org/u/Richard_Dobson)\
**Replies:** 5\
**Last updated:** [November 22, 2021, 5:03pm UTC](https://discourse.cmake.org/t/msys2-unknown-platform-using-msys2-mingw32-in-windows-10/4521 "2021-11-22T17:03:20Z")

</div>

Hello, I am building a large cross-platform suite of commandline programs, no issues with older MINGW on Win7 (32bit) system - Cmake recognises platform id MINGW. Now trying MINGW32 on Windows 10 (64bit OS, but I a t…

---

## [Is there a way to integrate the call to vcvarsall.bat into the CMakePresets.json file?](https://discourse.cmake.org/t/is-there-a-way-to-integrate-the-call-to-vcvarsall-bat-into-the-cmakepresets-json-file/3100)

<div class="topic-metadata">

**Author:** [@Knitschi](https://discourse.cmake.org/u/Knitschi)\
**Replies:** 13\
**Last updated:** [November 19, 2021, 6:42pm UTC](https://discourse.cmake.org/t/is-there-a-way-to-integrate-the-call-to-vcvarsall-bat-into-the-cmakepresets-json-file/3100 "2021-11-19T18:42:36Z")

</div>

I am currently exploring the presets feature. I am trying to make a windows, ninja, clang-cl based build work. I managed to do it but it only works if I call Visual Studios vcvarsall.bat file first to get the correct en…

---

## [INCLUDE\_DIRECTORIES target property not reporting "indirect" ones](https://discourse.cmake.org/t/include-directories-target-property-not-reporting-indirect-ones/4493)

<div class="topic-metadata">

**Author:** [@ingolf](https://discourse.cmake.org/u/ingolf)\
**Replies:** 4\
**Last updated:** [November 17, 2021, 7:43pm UTC](https://discourse.cmake.org/t/include-directories-target-property-not-reporting-indirect-ones/4493 "2021-11-17T19:43:36Z")

</div>

Hi, in my project, there is add\_library(foo source1.c) target\_include\_directories(foo PUBLIC foo\_library\_includes) add library(bar source2.c) target\_link\_libraries(bar PRIVATE foo) Whenever I actually compile bar, fo…

---

## [Preserve source dir when using FetchContent or ExternalProject](https://discourse.cmake.org/t/preserve-source-dir-when-using-fetchcontent-or-externalproject/3112)

<div class="topic-metadata">

**Author:** [@ikicic](https://discourse.cmake.org/u/ikicic)\
**Replies:** 2\
**Last updated:** [April 11, 2021, 4:06pm UTC](https://discourse.cmake.org/t/preserve-source-dir-when-using-fetchcontent-or-externalproject/3112 "2021-04-11T16:06:42Z")

</div>

Is there a way to prevent FetchContent / ExternalProject from deleting existing source dir when downloading a git repository? I use FetchContent\_Declare and FetchContent\_MakeAvailable to download a repository into \<proj…

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

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