# Usage

**URL:** https://discourse.cmake.org/c/usage/12.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

---

## [How to use cmake to generate Visual Studio .sln and .vcxproj](https://discourse.cmake.org/t/how-to-use-cmake-to-generate-visual-studio-sln-and-vcxproj/5878)

<div class="topic-metadata">

**Author:** [@michaelk1](https://discourse.cmake.org/u/michaelk1)\
**Replies:** 9\
**Last updated:** [December 2, 2022, 8:55am UTC](https://discourse.cmake.org/t/how-to-use-cmake-to-generate-visual-studio-sln-and-vcxproj/5878 "2022-12-02T08:55:01Z")

</div>

Hi, I am new to this forum, so an Hello to all of you. My problem: I try to generate VS .sln and .vcxproj files from existing cmake files using cmake. So i will be able to use VS without cmake. But do not know how. T…

---

## [Install dlls on windows](https://discourse.cmake.org/t/install-dlls-on-windows/6904)

<div class="topic-metadata">

**Author:** [@bramtayl](https://discourse.cmake.org/u/bramtayl)\
**Replies:** 2\
**Last updated:** [December 1, 2022, 10:59pm UTC](https://discourse.cmake.org/t/install-dlls-on-windows/6904 "2022-12-01T22:59:36Z")

</div>

Hello, new to C++ and cmake, so apologies if I’m missing something obvious… I’m trying to build a small project that depends on two packages I downloaded from vcpkg, “gamma” and “qtbase”. I’m building from within VSCode…

---

## [Creating directories step fails with ExternalProject\_Add](https://discourse.cmake.org/t/creating-directories-step-fails-with-externalproject-add/6990)

<div class="topic-metadata">

**Author:** [@mpconte](https://discourse.cmake.org/u/mpconte)\
**Replies:** 3\
**Last updated:** [December 1, 2022, 5:45pm UTC](https://discourse.cmake.org/t/creating-directories-step-fails-with-externalproject-add/6990 "2022-12-01T17:45:30Z")

</div>

When trying to build and install a library using ExternalProject\_Add, I receive the following error: \[ 70%\] Creating directories for 'sensor\_network' /bin/sh: 1: /root/cmake-3.25.0-linux-x86\_64/bin/cmake;-Dcfgdir=;-P;/r…

---

## [Question about specify verbosity of installation script code](https://discourse.cmake.org/t/question-about-specify-verbosity-of-installation-script-code/6962)

<div class="topic-metadata">

**Author:** [@Francois-Xavier\_Le\_B](https://discourse.cmake.org/u/Francois-Xavier_Le_B)\
**Replies:** 2\
**Last updated:** [December 1, 2022, 5:44pm UTC](https://discourse.cmake.org/t/question-about-specify-verbosity-of-installation-script-code/6962 "2022-12-01T17:44:48Z")

</div>

Hello, \[cmake version 3.24.3 on Debian Bullseye\] With -DCMAKE\_INSTALL\_MESSAGE=NEVER, we can silent the following messages: – Installing: XXX – Up-to-date: XXX Is there a way to silent the following ones: – Symlinki…

---

## [ExternalProject\_Add configure permission denied](https://discourse.cmake.org/t/externalproject-add-configure-permission-denied/6984)

<div class="topic-metadata">

**Author:** [@mpconte](https://discourse.cmake.org/u/mpconte)\
**Replies:** 12\
**Last updated:** [December 1, 2022, 5:18pm UTC](https://discourse.cmake.org/t/externalproject-add-configure-permission-denied/6984 "2022-12-01T17:18:59Z")

</div>

I’m trying to build a library which depends on other libraries built via ExternalProject\_Add as well which have built successfully, but for this particular project, in the configure step I receive a “Permission denied” e…

---

## [Why CMake add\_custom\_command with DEPFILE reruns every time?](https://discourse.cmake.org/t/why-cmake-add-custom-command-with-depfile-reruns-every-time/6978)

<div class="topic-metadata">

**Author:** [@Crazy\_Sage](https://discourse.cmake.org/u/Crazy_Sage)\
**Replies:** 8\
**Last updated:** [December 1, 2022, 10:42am UTC](https://discourse.cmake.org/t/why-cmake-add-custom-command-with-depfile-reruns-every-time/6978 "2022-12-01T10:42:22Z")

</div>

I’m trying to write my cmake script as follows: set(OUTPUT\_FILE "${CMAKE\_BINARY\_DIR}/static\_init/generated/${target}/static\_init.cpp") set(DEP\_FILE "${CMAKE\_BINARY\_DIR}/static\_init/input/${target}.d") write\_file(${DEP\_F…

---

## [using /fsanitize=address option](https://discourse.cmake.org/t/using-fsanitize-address-option/6976)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 5\
**Last updated:** [December 1, 2022, 10:27am UTC](https://discourse.cmake.org/t/using-fsanitize-address-option/6976 "2022-12-01T10:27:53Z")

</div>

Hi When compiling project with msvc cl, I use the NMake makefiles generator. Though, if adding /fsanitize=address option to my compilation and linking option. My project compile but does nothing when it runs (it display…

---

## [How to set \<build-tool-options\> via CMakeLists.txt?](https://discourse.cmake.org/t/how-to-set-build-tool-options-via-cmakelists-txt/6925)

<div class="topic-metadata">

**Author:** [@Kuxe](https://discourse.cmake.org/u/Kuxe)\
**Replies:** 4\
**Last updated:** [November 30, 2022, 9:16pm UTC](https://discourse.cmake.org/t/how-to-set-build-tool-options-via-cmakelists-txt/6925 "2022-11-30T21:16:20Z")

</div>

I’d like to have a CMake-option called ENABLE\_NINJA\_EXPLAIN that when enabled causes the build to be invoked like so: ninja -d explain Now, when invoking CMake from command-line, you can do: cmake --build --preset \<pr…

---

## [ifdef C Header file for multimachine](https://discourse.cmake.org/t/ifdef-c-header-file-for-multimachine/6946)

<div class="topic-metadata">

**Author:** [@realbabilu](https://discourse.cmake.org/u/realbabilu)\
**Replies:** 1\
**Last updated:** [November 30, 2022, 7:35pm UTC](https://discourse.cmake.org/t/ifdef-c-header-file-for-multimachine/6946 "2022-11-30T19:35:16Z")

</div>

Hello i just new in cmake in windows. I use gcc/gfortran migw from equation and intel openapi fortran c compiler. I will try to connect the superlu that have cmakefiles.txt and multi-machine ifdef in slu\_cnames.h heade…

---

## [CPack, install(CODE) and RPM](https://discourse.cmake.org/t/cpack-install-code-and-rpm/6983)

<div class="topic-metadata">

**Author:** [@starseeker](https://discourse.cmake.org/u/starseeker)\
**Replies:** 2\
**Last updated:** [November 30, 2022, 6:47pm UTC](https://discourse.cmake.org/t/cpack-install-code-and-rpm/6983 "2022-11-30T18:47:23Z")

</div>

I’m seeing a peculiarity trying to use install(CODE) with CPack and RPM. The install code line I have is: install(CODE “execute\_process(COMMAND $\<TARGET\_FILE:buildpath\_replace\> "${CMAKE\_INSTALL\_PREFIX}/${dir}/${bpf}")”…

---

## [How to rerun cmake custom command, when one of its dependencies becomes "dirty"?](https://discourse.cmake.org/t/how-to-rerun-cmake-custom-command-when-one-of-its-dependencies-becomes-dirty/6965)

<div class="topic-metadata">

**Author:** [@Crazy\_Sage](https://discourse.cmake.org/u/Crazy_Sage)\
**Replies:** 5\
**Last updated:** [November 30, 2022, 9:25am UTC](https://discourse.cmake.org/t/how-to-rerun-cmake-custom-command-when-one-of-its-dependencies-becomes-dirty/6965 "2022-11-30T09:25:56Z")

</div>

I have python script that is run through add\_custom\_command in my project, this script analyzes target sources and generate additional one for the target. get\_target\_property(TARGET\_SOURCES ${target} SOURCES) add\_custom…

---

## [cmake in msvc terminal with yasm not building asm files - works in linux](https://discourse.cmake.org/t/cmake-in-msvc-terminal-with-yasm-not-building-asm-files-works-in-linux/6968)

<div class="topic-metadata">

**Author:** [@jbagg](https://discourse.cmake.org/u/jbagg)\
**Replies:** 2\
**Last updated:** [November 28, 2022, 8:20pm UTC](https://discourse.cmake.org/t/cmake-in-msvc-terminal-with-yasm-not-building-asm-files-works-in-linux/6968 "2022-11-28T20:20:30Z")

</div>

I am having trouble getting cmake to build asm files on windows in a MSVC 2022 terminal. I am building a shared library that has both asm and c source code. The CMakeList.txt builds both the c and asm objects just fine…

---

## [Disable Parallel builds or enforce specific Targets are not built in parallel](https://discourse.cmake.org/t/disable-parallel-builds-or-enforce-specific-targets-are-not-built-in-parallel/6922)

<div class="topic-metadata">

**Author:** [@developer](https://discourse.cmake.org/u/developer)\
**Replies:** 2\
**Last updated:** [November 28, 2022, 5:29pm UTC](https://discourse.cmake.org/t/disable-parallel-builds-or-enforce-specific-targets-are-not-built-in-parallel/6922 "2022-11-28T17:29:53Z")

</div>

I’m using CMake to wrap some Make builds by creating some custom targets that simply call a shell script which invoke make. These existing Make builds are in source builds. I now have two different ways I wish to call ma…

---

## [testing for library build type for packaging purposes](https://discourse.cmake.org/t/testing-for-library-build-type-for-packaging-purposes/6940)

<div class="topic-metadata">

**Author:** [@giallu](https://discourse.cmake.org/u/giallu)\
**Replies:** 1\
**Last updated:** [November 23, 2022, 11:17pm UTC](https://discourse.cmake.org/t/testing-for-library-build-type-for-packaging-purposes/6940 "2022-11-23T23:17:09Z")

</div>

I use vcpkg to install few external dependencies (zlib, pthreads, etc) for my projects, then pick them up with find\_package() calls; sometimes I want to link them statically and vcpkg makes this easy by allowing me to us…

---

## [Testing if a compiler feature has been required on a target](https://discourse.cmake.org/t/testing-if-a-compiler-feature-has-been-required-on-a-target/6931)

<div class="topic-metadata">

**Author:** [@David\_Hunter](https://discourse.cmake.org/u/David_Hunter)\
**Replies:** 3\
**Last updated:** [November 23, 2022, 6:18pm UTC](https://discourse.cmake.org/t/testing-if-a-compiler-feature-has-been-required-on-a-target/6931 "2022-11-23T18:18:55Z")

</div>

If I require a compiler feature like the example in the documentation target\_compile\_features(mylib PUBLIC cxx\_constexpr) How do I then test that the target has had that feature required So I want some code that does i…

---

## [extract install from external projects](https://discourse.cmake.org/t/extract-install-from-external-projects/6912)

<div class="topic-metadata">

**Author:** [@Fabian188](https://discourse.cmake.org/u/Fabian188)\
**Replies:** 2\
**Last updated:** [November 23, 2022, 11:02am UTC](https://discourse.cmake.org/t/extract-install-from-external-projects/6912 "2022-11-23T11:02:14Z")

</div>

There is a software package consisting of CMake based products in subdirectories of the package root One needs to go into the subdirectories manually in the proper order and call cmake within these subdirectories. There…

---

## [Newer versions of MacOS require linking against \*.tbd files and not old system paths to \*.dylib](https://discourse.cmake.org/t/newer-versions-of-macos-require-linking-against-tbd-files-and-not-old-system-paths-to-dylib/6871)

<div class="topic-metadata">

**Author:** [@tye59](https://discourse.cmake.org/u/tye59)\
**Replies:** 7\
**Last updated:** [November 23, 2022, 1:58am UTC](https://discourse.cmake.org/t/newer-versions-of-macos-require-linking-against-tbd-files-and-not-old-system-paths-to-dylib/6871 "2022-11-23T01:58:52Z")

</div>

I’ve seen posts mentioning building on MacOS ~12+ no longer works using conventional paths to system libraries, e.g., /usr/lib/libm.dylib, because those libraires are now hidden for security. Instead linking needs to b…

---

## [Is there a way to get the build command line?](https://discourse.cmake.org/t/is-there-a-way-to-get-the-build-command-line/6891)

<div class="topic-metadata">

**Author:** [@Jack](https://discourse.cmake.org/u/Jack)\
**Replies:** 11\
**Last updated:** [November 21, 2022, 7:53pm UTC](https://discourse.cmake.org/t/is-there-a-way-to-get-the-build-command-line/6891 "2022-11-21T19:53:04Z")

</div>

CMake obviously knows what the command build line would be because it is executing it. Can I get what that build line would be through the CMake system so that I can interrogate it?

---

## [Build fails if gcc version != gfortran version](https://discourse.cmake.org/t/build-fails-if-gcc-version-gfortran-version/6916)

<div class="topic-metadata">

**Author:** [@krefson](https://discourse.cmake.org/u/krefson)\
**Replies:** 8\
**Last updated:** [November 21, 2022, 3:43pm UTC](https://discourse.cmake.org/t/build-fails-if-gcc-version-gfortran-version/6916 "2022-11-21T15:43:46Z")

</div>

I am attempting to build a mixed Fortran/C project on OpenSUSE Leap 14.5 with gcc gcc (SUSE Linux) 7.5.0 and GNU Fortran (SUSE Linux) 11.3.0 This is a supported installation from the OpenSUSE main package repo, which…

---

## [The target name is reserved or not valid for certain CMake features...](https://discourse.cmake.org/t/the-target-name-is-reserved-or-not-valid-for-certain-cmake-features/6913)

<div class="topic-metadata">

**Author:** [@Rich\_von\_Lehe](https://discourse.cmake.org/u/Rich_von_Lehe)\
**Replies:** 2\
**Last updated:** [November 20, 2022, 1:28pm UTC](https://discourse.cmake.org/t/the-target-name-is-reserved-or-not-valid-for-certain-cmake-features/6913 "2022-11-20T13:28:43Z")

</div>

I am not sure why this library alias is causing this error. Using double colon :: seems to be permitted with import and alias targets. See double-colon in target name . error: The target name "zeromq::zeromq" is re…

---

## [Question about unclear behavior with a list](https://discourse.cmake.org/t/question-about-unclear-behavior-with-a-list/6899)

<div class="topic-metadata">

**Author:** [@Francois-Xavier\_Le\_B](https://discourse.cmake.org/u/Francois-Xavier_Le_B)\
**Replies:** 4\
**Last updated:** [November 19, 2022, 2:00pm UTC](https://discourse.cmake.org/t/question-about-unclear-behavior-with-a-list/6899 "2022-11-19T14:00:36Z")

</div>

Hello, \[cmake version 3.24.3 on Debian Bullseye\] With a minimal CMakeLists.txt: cmake\_minimum\_required(VERSION 3.24) project(cmake\_test C) mkdir build && cd build && cmake .. gives: -- The C compiler identificatio…

---

## [How to change "Applications" subfolder for "productbuild"](https://discourse.cmake.org/t/how-to-change-applications-subfolder-for-productbuild/6897)

<div class="topic-metadata">

**Author:** [@jpfeuffer](https://discourse.cmake.org/u/jpfeuffer)\
**Replies:** 3\
**Last updated:** [November 18, 2022, 11:52pm UTC](https://discourse.cmake.org/t/how-to-change-applications-subfolder-for-productbuild/6897 "2022-11-18T23:52:28Z")

</div>

Hi! Is it possible to change the subfolder where components get installed to with the productbuild CPack generator? It always installs everything in “Applications”. I would like to at least bundle everything under “Ap…

---

## [Out-of-Tree Source Libraries](https://discourse.cmake.org/t/out-of-tree-source-libraries/6898)

<div class="topic-metadata">

**Author:** [@go2sh](https://discourse.cmake.org/u/go2sh)\
**Replies:** 0\
**Last updated:** [November 18, 2022, 1:44pm UTC](https://discourse.cmake.org/t/out-of-tree-source-libraries/6898 "2022-11-18T13:44:29Z")

</div>

Hi all, I’m currently developing a solution to include an out-of-tree source-based library into a project. Say I have a global library source folder “/home/test/Coding/libx” with many different components/parts which a…

---

## [ExternalData - how to integrate with SVN](https://discourse.cmake.org/t/externaldata-how-to-integrate-with-svn/6894)

<div class="topic-metadata">

**Author:** [@menno](https://discourse.cmake.org/u/menno)\
**Replies:** 1\
**Last updated:** [November 17, 2022, 4:28pm UTC](https://discourse.cmake.org/t/externaldata-how-to-integrate-with-svn/6894 "2022-11-17T16:28:12Z")

</div>

We’re looking at the ExternalData module to help separate code from binary data in our Subversion repository, similar to how this is done in the VTK and ParaView codebases. In those git-based repositories, the developer…

---

## [swig cmake windows - debug \_d suffix](https://discourse.cmake.org/t/swig-cmake-windows-debug-d-suffix/6878)

<div class="topic-metadata">

**Author:** [@nitawa](https://discourse.cmake.org/u/nitawa)\
**Replies:** 5\
**Last updated:** [November 17, 2022, 3:40pm UTC](https://discourse.cmake.org/t/swig-cmake-windows-debug-d-suffix/6878 "2022-11-17T15:40:31Z")

</div>

Dear experts, I used to use cmake 3.12 + Swig to generate some C++/Python API in Release/Debug mode. I recently moved to cmake 3.24 and I can see that now, in Debug mode, a suffix \_d is added to the generated librarie…

---

## [How to improve the DLL management](https://discourse.cmake.org/t/how-to-improve-the-dll-management/6881)

<div class="topic-metadata">

**Author:** [@xhustango](https://discourse.cmake.org/u/xhustango)\
**Replies:** 2\
**Last updated:** [November 17, 2022, 3:30pm UTC](https://discourse.cmake.org/t/how-to-improve-the-dll-management/6881 "2022-11-17T15:30:33Z")

</div>

Hi there, I am currently developing some unit and integration tests that are dependent on Qt6. Right now I am using the following custom command to copy and paste the DLLs needed to execute the test on the CI machine. …

---

## [CMake AutoMoc Usage](https://discourse.cmake.org/t/cmake-automoc-usage/6865)

<div class="topic-metadata">

**Author:** [@chenli](https://discourse.cmake.org/u/chenli)\
**Replies:** 3\
**Last updated:** [November 17, 2022, 3:28pm UTC](https://discourse.cmake.org/t/cmake-automoc-usage/6865 "2022-11-17T15:28:15Z")

</div>

Hellow everyone, I have a question about qt signals in header file. In documentaion to cmake i read which file will be proccessed by auo-moc: "For all C++ source files \<source\_base\>.\<source\_extension\> in the target’s …

---

## [CMake isn't building my executable anymore. :(](https://discourse.cmake.org/t/cmake-isnt-building-my-executable-anymore/6883)

<div class="topic-metadata">

**Author:** [@Jack](https://discourse.cmake.org/u/Jack)\
**Replies:** 1\
**Last updated:** [November 16, 2022, 9:49pm UTC](https://discourse.cmake.org/t/cmake-isnt-building-my-executable-anymore/6883 "2022-11-16T21:49:37Z")

</div>

Every time I think I have CMake figured out, it then flummoxes me. I edit the CMakeLists.txt file in my project file and then from the root folder, I type cmake . to rebuild the build environment (I’m using VS 17.4.0). …

---

## [Object File Propragating: CMake Debug Help](https://discourse.cmake.org/t/object-file-propragating-cmake-debug-help/6874)

<div class="topic-metadata">

**Author:** [@Drue\_Peters](https://discourse.cmake.org/u/Drue_Peters)\
**Replies:** 2\
**Last updated:** [November 15, 2022, 9:54pm UTC](https://discourse.cmake.org/t/object-file-propragating-cmake-debug-help/6874 "2022-11-15T21:54:54Z")

</div>

We have a few core libraries that are really large as they’re used for modeling. If we need to add support for a new thing to model, then a small team will build modeling support for that thing. This was a great use for …

---

## [Static executable on linux using latest CMake](https://discourse.cmake.org/t/static-executable-on-linux-using-latest-cmake/6872)

<div class="topic-metadata">

**Author:** [@Glad](https://discourse.cmake.org/u/Glad)\
**Replies:** 4\
**Last updated:** [November 15, 2022, 9:51pm UTC](https://discourse.cmake.org/t/static-executable-on-linux-using-latest-cmake/6872 "2022-11-15T21:51:43Z")

</div>

Hi, I am using CMake 3.24.3. What is the cleanest way, most modern way, to mandate a static executable? I want to make sure that my final binary will be able to run on remote Linux servers, without worrying about the …

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

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