# Code

**URL:** https://discourse.cmake.org/c/code/11.md?page=52

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

**Page:** 53

---

## [CPack Debian: Package has no dependencies](https://discourse.cmake.org/t/cpack-debian-package-has-no-dependencies/4506)

<div class="topic-metadata">

**Author:** [@Leon0402](https://discourse.cmake.org/u/Leon0402)\
**Replies:** 2\
**Last updated:** [November 23, 2021, 8:43pm UTC](https://discourse.cmake.org/t/cpack-debian-package-has-no-dependencies/4506 "2021-11-23T20:43:39Z")

</div>

Hi, I want to generate a .deb package and have dpkg installed (on my arch linux system). My code looks something like that: set(CPACK\_COMPONENTS\_ALL Beans) set(CPACK\_COMPONENTS\_GROUPING ALL\_COMPONENTS\_IN\_ONE) set(CPAC…

---

## [Installed file permissions in Windows](https://discourse.cmake.org/t/installed-file-permissions-in-windows/4523)

<div class="topic-metadata">

**Author:** [@giallu](https://discourse.cmake.org/u/giallu)\
**Replies:** 1\
**Last updated:** [November 22, 2021, 6:59pm UTC](https://discourse.cmake.org/t/installed-file-permissions-in-windows/4523 "2021-11-22T18:59:43Z")

</div>

I am building a Windows installer package for my application with CPack (Qt Installer Framework backend). I have a single file that needs to stay world writable in the installed tree, but so far I am failing. This is t…

---

## [XCode config generator expression becomes NOCONFIG](https://discourse.cmake.org/t/xcode-config-generator-expression-becomes-noconfig/4498)

<div class="topic-metadata">

**Author:** [@Leon0402](https://discourse.cmake.org/u/Leon0402)\
**Replies:** 5\
**Last updated:** [November 18, 2021, 3:31pm UTC](https://discourse.cmake.org/t/xcode-config-generator-expression-becomes-noconfig/4498 "2021-11-18T15:31:34Z")

</div>

I configure a file with generator expressions targeting single and multi configuration generators like so: configure\_file(StartServer.cpp.in StartServer.cpp.in @ONLY) file(GENERATE OUTPUT ${CMAKE\_CURRENT\_BINARY\_DIR}/…

---

## [Trying to add model files to VS project using cmake](https://discourse.cmake.org/t/trying-to-add-model-files-to-vs-project-using-cmake/1790)

<div class="topic-metadata">

**Author:** [@Zwan](https://discourse.cmake.org/u/Zwan)\
**Replies:** 4\
**Last updated:** [November 18, 2021, 10:19am UTC](https://discourse.cmake.org/t/trying-to-add-model-files-to-vs-project-using-cmake/1790 "2021-11-18T10:19:09Z")

</div>

Hi everyone. I use cmake to generate a Visual Studio project of my project. Now I want to add different model files like .blend, .ply, .obj as source files to have access from the IDE. Besides, I want to create&deploy …

---

## [RUNTIME\_DEPENDENCIES](https://discourse.cmake.org/t/runtime-dependencies/4497)

<div class="topic-metadata">

**Author:** [@Leon0402](https://discourse.cmake.org/u/Leon0402)\
**Replies:** 7\
**Last updated:** [November 17, 2021, 8:40pm UTC](https://discourse.cmake.org/t/runtime-dependencies/4497 "2021-11-17T20:40:19Z")

</div>

Hi, I use RUNTIME\_DEPENDENCIES to copy all dlls. But it doesn’t find all. In particular, it doesn’t find postgresql dlls. They are on my PATH though. Adding postgreql to the DIRECTORIES options gives me the lib directo…

---

## [CTest FIXTURES\_SETUP start Server in background](https://discourse.cmake.org/t/ctest-fixtures-setup-start-server-in-background/4495)

<div class="topic-metadata">

**Author:** [@Leon0402](https://discourse.cmake.org/u/Leon0402)\
**Replies:** 0\
**Last updated:** [November 17, 2021, 1:39pm UTC](https://discourse.cmake.org/t/ctest-fixtures-setup-start-server-in-background/4495 "2021-11-17T13:39:03Z")

</div>

Hi, my goal is to start my server before running the tests. I therefore use the FIXTURES\_SETUP functionality. My understanding is that a tests needs to finish and return a value, which tells cmake if the test is finishe…

---

## [percent signs in target\_compile\_definitions on Windows](https://discourse.cmake.org/t/percent-signs-in-target-compile-definitions-on-windows/4489)

<div class="topic-metadata">

**Author:** [@jobor](https://discourse.cmake.org/u/jobor)\
**Replies:** 2\
**Last updated:** [November 16, 2021, 3:17pm UTC](https://discourse.cmake.org/t/percent-signs-in-target-compile-definitions-on-windows/4489 "2021-11-16T15:17:27Z")

</div>

Consider a target with compile definitions like this target\_compile\_definitions(myapp PRIVATE TESTCASE\_BUILDDIR="${CMAKE\_BINARY\_DIR}/foo%2bar")) This works fine on Linux, but on Windows there will be errors. For examp…

---

## [How do angle-brackets varaibles get expanded (e.g. \<LINK\_FLAGS\>)? Can you add new ones?](https://discourse.cmake.org/t/how-do-angle-brackets-varaibles-get-expanded-e-g-link-flags-can-you-add-new-ones/4488)

<div class="topic-metadata">

**Author:** [@shabiel](https://discourse.cmake.org/u/shabiel)\
**Replies:** 1\
**Last updated:** [November 15, 2021, 5:24pm UTC](https://discourse.cmake.org/t/how-do-angle-brackets-varaibles-get-expanded-e-g-link-flags-can-you-add-new-ones/4488 "2021-11-15T17:24:55Z")

</div>

Hello everybody, This is yet another followup to Need CMake M Plugin help: Single target, Single source, multiple objects, multiples libraries. Lots of thinking makes me convinced that the solution cannot be provided b…

---

## [Can CMAKE\_\<LANG\>\_COMPILE\_OBJECT call a script or a macro/function?](https://discourse.cmake.org/t/can-cmake-lang-compile-object-call-a-script-or-a-macro-function/4448)

<div class="topic-metadata">

**Author:** [@shabiel](https://discourse.cmake.org/u/shabiel)\
**Replies:** 2\
**Last updated:** [November 15, 2021, 3:27pm UTC](https://discourse.cmake.org/t/can-cmake-lang-compile-object-call-a-script-or-a-macro-function/4448 "2021-11-15T15:27:38Z")

</div>

This is a follow-up to Need CMake M Plugin help: Single target, Single source, multiple objects, multiples libraries. Briefly, I have one source file, and I need to make two object files. Our original code looks like t…

---

## [FetchContent vs. BUILD\_TESTING](https://discourse.cmake.org/t/fetchcontent-vs-build-testing/4477)

<div class="topic-metadata">

**Author:** [@matta](https://discourse.cmake.org/u/matta)\
**Replies:** 4\
**Last updated:** [November 14, 2021, 11:43pm UTC](https://discourse.cmake.org/t/fetchcontent-vs-build-testing/4477 "2021-11-14T23:43:15Z")

</div>

Is there a best practice with respect to BUILD\_TESTING for projects that want to support being used as git submodules or FetchContent? The root issue I’m having is that a project currently uses BUILD\_TESTING directly. Th…

---

## [Using the ENVIRONMENT\_MODIFICATION property](https://discourse.cmake.org/t/using-the-environment-modification-property/4479)

<div class="topic-metadata">

**Author:** [@moongoal](https://discourse.cmake.org/u/moongoal)\
**Replies:** 1\
**Last updated:** [November 14, 2021, 5:37pm UTC](https://discourse.cmake.org/t/using-the-environment-modification-property/4479 "2021-11-14T17:37:43Z")

</div>

Hi, I’m attempting creation of tests leveraging the newly added ENVIRONMENT\_MODIFICATION property. After creating a test, I run the following: set\_tests\_properties( ${test\_name} PROPERTIES ENVIRONMENT\_MODIF…

---

## [Effect of force overwriting variables](https://discourse.cmake.org/t/effect-of-force-overwriting-variables/3207)

<div class="topic-metadata">

**Author:** [@Leon0402](https://discourse.cmake.org/u/Leon0402)\
**Replies:** 9\
**Last updated:** [November 13, 2021, 3:23pm UTC](https://discourse.cmake.org/t/effect-of-force-overwriting-variables/3207 "2021-11-13T15:23:35Z")

</div>

Hi everyone, in my project I include a dependency with FetchContent with such a line in it: set(BUILD\_TESTING OFF CACHE INTERNAL "" FORCE) BUILD\_TESTING is a variable declared by CTest as far as I understood it. And w…

---

## [CMake - search in list - "Unknown arguments specified"](https://discourse.cmake.org/t/cmake-search-in-list-unknown-arguments-specified/4471)

<div class="topic-metadata">

**Author:** [@LynarStudios](https://discourse.cmake.org/u/LynarStudios)\
**Replies:** 2\
**Last updated:** [November 12, 2021, 9:19am UTC](https://discourse.cmake.org/t/cmake-search-in-list-unknown-arguments-specified/4471 "2021-11-12T09:19:19Z")

</div>

Hello community :slight\_smile: I’m currently facing a cmake code issue, which I’m trying to understand and might need some support here. So I hope this is the right place to address this. The following code should dete…

---

## [Organizing a medium size code base for development builds](https://discourse.cmake.org/t/organizing-a-medium-size-code-base-for-development-builds/4450)

<div class="topic-metadata">

**Author:** [@giallu](https://discourse.cmake.org/u/giallu)\
**Replies:** 2\
**Last updated:** [November 11, 2021, 8:18am UTC](https://discourse.cmake.org/t/organizing-a-medium-size-code-base-for-development-builds/4450 "2021-11-11T08:18:09Z")

</div>

I have several top level projects that depends on a number of internal and external libraries. Right now, the top level projects are standardized to a layout like: project -- libraries -- dep1 -- dep2 -- …

---

## [Handling the installation of external dependencies](https://discourse.cmake.org/t/handling-the-installation-of-external-dependencies/4467)

<div class="topic-metadata">

**Author:** [@Dylan\_Reedy](https://discourse.cmake.org/u/Dylan_Reedy)\
**Replies:** 1\
**Last updated:** [November 11, 2021, 1:11am UTC](https://discourse.cmake.org/t/handling-the-installation-of-external-dependencies/4467 "2021-11-11T01:11:58Z")

</div>

Hi all, I’m trying to get my project, which has a non-CMake-target dependency, to link its dependency publically: target\_link\_libraries(MyLibrary PUBLIC $\<BUILD\_INTERFACE:${MyDependency}\> $\<INSTAL…

---

## [How to pass CMAKE\_OSX\_ARCHITECTURES to ExternalProject\_Add](https://discourse.cmake.org/t/how-to-pass-cmake-osx-architectures-to-externalproject-add/2262)

<div class="topic-metadata">

**Author:** [@Gonzalo\_Garramuno](https://discourse.cmake.org/u/Gonzalo_Garramuno)\
**Replies:** 4\
**Last updated:** [November 11, 2021, 1:08am UTC](https://discourse.cmake.org/t/how-to-pass-cmake-osx-architectures-to-externalproject-add/2262 "2021-11-11T01:08:05Z")

</div>

I am trying to compile a fat binary with ExternalProject\_Add. In order to do so, I need to pass x86\_64;arm64 in the CMAKE\_OSX\_ARCHITECTURES variable to ExternalProject\_Add. However, my attempts at it do not work: incl…

---

## [How to add "out-of-tree" common source files](https://discourse.cmake.org/t/how-to-add-out-of-tree-common-source-files/4442)

<div class="topic-metadata">

**Author:** [@larienna](https://discourse.cmake.org/u/larienna)\
**Replies:** 3\
**Last updated:** [November 7, 2021, 8:52pm UTC](https://discourse.cmake.org/t/how-to-add-out-of-tree-common-source-files/4442 "2021-11-07T20:52:39Z")

</div>

I have a project with the following directory structure server | daemon | | src | service | | src | commons The daemon is the linux version and service contains the windows version. Originally, I made 2 sep…

---

## [Help with tutorial step 2](https://discourse.cmake.org/t/help-with-tutorial-step-2/4403)

<div class="topic-metadata">

**Author:** [@jamadagni](https://discourse.cmake.org/u/jamadagni)\
**Replies:** 12\
**Last updated:** [November 9, 2021, 8:39am UTC](https://discourse.cmake.org/t/help-with-tutorial-step-2/4403 "2021-11-09T08:39:50Z")

</div>

Hello. I am trying to learn CMake using the Tutorial. I am at Step 2. The contents of my main CMakeLists.txt: cmake\_minimum\_required(VERSION 3.10) # set the project name and version project(Tutorial VERSION 1.0) # sp…

---

## [Configuring a file that has both '@' substitution and generator expressions](https://discourse.cmake.org/t/configuring-a-file-that-has-both-substitution-and-generator-expressions/3064)

<div class="topic-metadata">

**Author:** [@ruilvo](https://discourse.cmake.org/u/ruilvo)\
**Replies:** 7\
**Last updated:** [November 8, 2021, 8:09pm UTC](https://discourse.cmake.org/t/configuring-a-file-that-has-both-substitution-and-generator-expressions/3064 "2021-11-08T20:09:16Z")

</div>

So, I was trying to do a script to pass to install(SCRIPT ...) to package an application. For clarity of where my problem comes from, I was trying to run windeployqt.exe \[...\] myapp.exe from the script. This is what I …

---

## [cmake puts compiler flags in link commands on ninja file](https://discourse.cmake.org/t/cmake-puts-compiler-flags-in-link-commands-on-ninja-file/4408)

<div class="topic-metadata">

**Author:** [@FROMAGMA](https://discourse.cmake.org/u/FROMAGMA)\
**Replies:** 3\
**Last updated:** [November 8, 2021, 12:22pm UTC](https://discourse.cmake.org/t/cmake-puts-compiler-flags-in-link-commands-on-ninja-file/4408 "2021-11-08T12:22:38Z")

</div>

Hi, We are using CMake 3.21 and Ninja 1.10.2 under Windows and Linux. We are experimental using Intel oneApi icx compiler. At the linking step we get a warning (Linux) clang++: warning: argument unused during compila…

---

## [how to custom the static library ar process](https://discourse.cmake.org/t/how-to-custom-the-static-library-ar-process/4437)

<div class="topic-metadata">

**Author:** [@Princekin](https://discourse.cmake.org/u/Princekin)\
**Replies:** 3\
**Last updated:** [November 7, 2021, 12:59am UTC](https://discourse.cmake.org/t/how-to-custom-the-static-library-ar-process/4437 "2021-11-07T00:59:44Z")

</div>

I want to build a static library name xcrt that use CMake, SET(CMAKE\_AR "i386-elf-ar") set(CMAKE\_STATIC\_LINKER\_FLAGS rc CACHE STRING "" FORCE) add\_library(xcrt STATIC xcrt\_SRC} ) when build, it executes the command: …

---

## [making Ninja build output silent](https://discourse.cmake.org/t/making-ninja-build-output-silent/4439)

<div class="topic-metadata">

**Author:** [@hex](https://discourse.cmake.org/u/hex)\
**Replies:** 2\
**Last updated:** [November 6, 2021, 8:17pm UTC](https://discourse.cmake.org/t/making-ninja-build-output-silent/4439 "2021-11-06T20:17:50Z")

</div>

i noticed that Ninja prints build commands to the console. With Unix Makefile this doesn’t happen. I don’t have verbose build enabled. Is there a way to make Ninja builds silent? Reproducer: cmake\_minimum\_required(VERS…

---

## [how hide some \`Xcode Scheme\` when using CMake to generate a Xcode project?](https://discourse.cmake.org/t/how-hide-some-xcode-scheme-when-using-cmake-to-generate-a-xcode-project/4436)

<div class="topic-metadata">

**Author:** [@Princekin](https://discourse.cmake.org/u/Princekin)\
**Replies:** 0\
**Last updated:** [November 6, 2021, 2:55am UTC](https://discourse.cmake.org/t/how-hide-some-xcode-scheme-when-using-cmake-to-generate-a-xcode-project/4436 "2021-11-06T02:55:22Z")

</div>

I have a c project organized by CMake, I generated an Xcode project success based on it, I have many targets in my CMake project, Correspond to that, the generated Xcode project has many Scheme, I don’t want some Scheme …

---

## [How to change the xcode target source directory name?](https://discourse.cmake.org/t/how-to-change-the-xcode-target-source-directory-name/4435)

<div class="topic-metadata">

**Author:** [@Princekin](https://discourse.cmake.org/u/Princekin)\
**Replies:** 3\
**Last updated:** [November 6, 2021, 2:29am UTC](https://discourse.cmake.org/t/how-to-change-the-xcode-target-source-directory-name/4435 "2021-11-06T02:29:19Z")

</div>

Hi: I have a c project organized by CMake, I generated an Xcode project success based on it, Here is my c project directory Level ├── libs │ ├── pthread │ ├── uview │ ├── xcrt │ ├── xlibc │ └── xlibcpp the l…

---

## [Help using FindMPI in cross compile environment](https://discourse.cmake.org/t/help-using-findmpi-in-cross-compile-environment/4433)

<div class="topic-metadata">

**Author:** [@Simon\_Song](https://discourse.cmake.org/u/Simon_Song)\
**Replies:** 1\
**Last updated:** [November 6, 2021, 1:47am UTC](https://discourse.cmake.org/t/help-using-findmpi-in-cross-compile-environment/4433 "2021-11-06T01:47:13Z")

</div>

Dear cmake community, I’m trying to setup cross compilation (host x86, target arm64) with openmpi as a depdendency. I’d only need libmpi and libmpi\_cxx currently. I wanted to link the arm64 ubuntu distribution of openmp…

---

## [Testing in a superbuild](https://discourse.cmake.org/t/testing-in-a-superbuild/1906)

<div class="topic-metadata">

**Author:** [@alex](https://discourse.cmake.org/u/alex)\
**Replies:** 7\
**Last updated:** [November 4, 2021, 11:02am UTC](https://discourse.cmake.org/t/testing-in-a-superbuild/1906 "2021-11-04T11:02:41Z")

</div>

If I have a superbuild, ie. one that just consists of a sequence of ExternalProject calls, how can I use CTest to run all of the tests in all of the subprojects? Using enable\_testing() won’t do anything, but maybe there’…

---

## [Setting linker in Clang builds on Windows](https://discourse.cmake.org/t/setting-linker-in-clang-builds-on-windows/4407)

<div class="topic-metadata">

**Author:** [@benavidz](https://discourse.cmake.org/u/benavidz)\
**Replies:** 3\
**Last updated:** [November 3, 2021, 4:02pm UTC](https://discourse.cmake.org/t/setting-linker-in-clang-builds-on-windows/4407 "2021-11-03T16:02:07Z")

</div>

Hello, I have a C++ project which I would like to build with Clang, and link with MSVC link.exe. The only way I was able to figure out how to make this happen was to modify the Windows-Clang.cmake file included with my …

---

## [cmake how to set C# project property Auto-generate binding redirects](https://discourse.cmake.org/t/cmake-how-to-set-c-project-property-auto-generate-binding-redirects/4288)

<div class="topic-metadata">

**Author:** [@craigtao](https://discourse.cmake.org/u/craigtao)\
**Replies:** 6\
**Last updated:** [November 3, 2021, 1:43pm UTC](https://discourse.cmake.org/t/cmake-how-to-set-c-project-property-auto-generate-binding-redirects/4288 "2021-11-03T13:43:32Z")

</div>

cmake code: set\_property(TARGET Test PROPERTY AutoGenerateBindingRedirects TRUE) don’t invalid,

---

## [How to maintain code generator parallelism in cross-builds?](https://discourse.cmake.org/t/how-to-maintain-code-generator-parallelism-in-cross-builds/4375)

<div class="topic-metadata">

**Author:** [@alex](https://discourse.cmake.org/u/alex)\
**Replies:** 1\
**Last updated:** [November 2, 2021, 7:53pm UTC](https://discourse.cmake.org/t/how-to-maintain-code-generator-parallelism-in-cross-builds/4375 "2021-11-02T19:53:23Z")

</div>

So here’s a build scenario I’m trying to work through… I’m building N distinct code generators each producing one of N different sources. Everything works as expected when compiling for host. However, The code generato…

---

## [CMAKE uses CMD or Powershell depending on Computer](https://discourse.cmake.org/t/cmake-uses-cmd-or-powershell-depending-on-computer/4252)

<div class="topic-metadata">

**Author:** [@xllNessllx](https://discourse.cmake.org/u/xllNessllx)\
**Replies:** 5\
**Last updated:** [November 2, 2021, 6:55pm UTC](https://discourse.cmake.org/t/cmake-uses-cmd-or-powershell-depending-on-computer/4252 "2021-11-02T18:55:35Z")

</div>

The Problem: When executing CMAKE the generated Build-Commands use either the cmd or powershell cli. This can cause errors with long build command, as cmd has a much smaller character limit. The shell that will be use…

[Previous page](https://discourse.cmake.org/c/code/11.md?page=51)

[Next page](https://discourse.cmake.org/c/code/11.md?page=53)
