# Usage

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

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

**Page:** 72

---

## [Looking for a clean workaround to define environment variable during build step.](https://discourse.cmake.org/t/looking-for-a-clean-workaround-to-define-environment-variable-during-build-step/4348)

<div class="topic-metadata">

**Author:** [@zohar81](https://discourse.cmake.org/u/zohar81)\
**Replies:** 1\
**Last updated:** [October 27, 2021, 2:41pm UTC](https://discourse.cmake.org/t/looking-for-a-clean-workaround-to-define-environment-variable-during-build-step/4348 "2021-10-27T14:41:42Z")

</div>

Hi, I’d like to set some environment variables that is needed during build step. I know it’s currently not supported in build step, but only in configuration step set(ENV{myVar} value) Perhaps is there any alternative…

---

## [Assembly files are not processed at all](https://discourse.cmake.org/t/assembly-files-are-not-processed-at-all/4329)

<div class="topic-metadata">

**Author:** [@serge](https://discourse.cmake.org/u/serge)\
**Replies:** 2\
**Last updated:** [October 27, 2021, 11:54am UTC](https://discourse.cmake.org/t/assembly-files-are-not-processed-at-all/4329 "2021-10-27T11:54:24Z")

</div>

Hi guys, This one below works with Ninja / Linux but on windows / VS2019 it does not. Here is a simple CMakeList.txt with hello.cpp and file.asm sources: cmake\_minimum\_required (VERSION 3.19) enable\_language(CXX C ASM…

---

## [\[Conan\] Using a library without a stable interface](https://discourse.cmake.org/t/conan-using-a-library-without-a-stable-interface/4344)

<div class="topic-metadata">

**Author:** [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)\
**Replies:** 1\
**Last updated:** [October 26, 2021, 8:58pm UTC](https://discourse.cmake.org/t/conan-using-a-library-without-a-stable-interface/4344 "2021-10-26T20:58:02Z")

</div>

I was watching this video CMake + Conan: 3 Years Later - Mateusz Pusz . It seems like Conan is intended for libraries with stable interfaces that are properly semantically versioned. Does this need to be the case? Ca…

---

## [specify dependencies between add\_test tests?](https://discourse.cmake.org/t/specify-dependencies-between-add-test-tests/4319)

<div class="topic-metadata">

**Author:** [@wolfman21](https://discourse.cmake.org/u/wolfman21)\
**Replies:** 3\
**Last updated:** [October 25, 2021, 1:54pm UTC](https://discourse.cmake.org/t/specify-dependencies-between-add-test-tests/4319 "2021-10-25T13:54:00Z")

</div>

Is there a way to explicitly specify the order of execution for ctest tests added with add\_test? Specifically, I have one test that generates output which is required as input by two subsequent tests. It looks like the…

---

## [cmake not generating sln windows 10 AMD](https://discourse.cmake.org/t/cmake-not-generating-sln-windows-10-amd/4323)

<div class="topic-metadata">

**Author:** [@Zed](https://discourse.cmake.org/u/Zed)\
**Replies:** 2\
**Last updated:** [October 23, 2021, 6:18pm UTC](https://discourse.cmake.org/t/cmake-not-generating-sln-windows-10-amd/4323 "2021-10-23T18:18:15Z")

</div>

HI all- I run my small script to feed cmake from visual studio command prompt 2019. I run the script from a build directory located inside the folder path c:\\soci-master. This worked before but the -A is new to me. Plea…

---

## [Help with CMAKE\_CUDA\_ARCHITECTURES resulting in incorrect nvcc compiler flags](https://discourse.cmake.org/t/help-with-cmake-cuda-architectures-resulting-in-incorrect-nvcc-compiler-flags/3556)

<div class="topic-metadata">

**Author:** [@irnbrux](https://discourse.cmake.org/u/irnbrux)\
**Replies:** 1\
**Last updated:** [October 20, 2021, 1:27pm UTC](https://discourse.cmake.org/t/help-with-cmake-cuda-architectures-resulting-in-incorrect-nvcc-compiler-flags/3556 "2021-10-20T13:27:59Z")

</div>

Hi, I am trying to build against CUDA, but get a compiler error: nvcc fatal : ‘sm\_53’ is not in ‘keyword=value’ format from set(CMAKE\_CUDA\_ARCHITECTURES 53 75) The command line generated is C:\\PROGRA~1\\NVIDIA~2\\C…

---

## [Does CMake support linking multiple third party libraries?](https://discourse.cmake.org/t/does-cmake-support-linking-multiple-third-party-libraries/4311)

<div class="topic-metadata">

**Author:** [@maxcrous](https://discourse.cmake.org/u/maxcrous)\
**Replies:** 3\
**Last updated:** [October 19, 2021, 10:25pm UTC](https://discourse.cmake.org/t/does-cmake-support-linking-multiple-third-party-libraries/4311 "2021-10-19T22:25:09Z")

</div>

Hi all! This is a question I have also posted on Stackoverflow which has left me rather confused and head scratching. I am using CMake to define the compilation of a C++ executable. The goal is to use 2 third-party libr…

---

## [Help with recompiling on a cluster](https://discourse.cmake.org/t/help-with-recompiling-on-a-cluster/4258)

<div class="topic-metadata">

**Author:** [@jlquinn](https://discourse.cmake.org/u/jlquinn)\
**Replies:** 12\
**Last updated:** [October 19, 2021, 6:30pm UTC](https://discourse.cmake.org/t/help-with-recompiling-on-a-cluster/4258 "2021-10-19T18:30:50Z")

</div>

Hi all, I use cmake on a cluster of systems where for the most part I don’t control what node I get when submitting a job. I find that when I build my cmake project, it does a full recompile all the time instead of inc…

---

## [target vs component based install](https://discourse.cmake.org/t/target-vs-component-based-install/4285)

<div class="topic-metadata">

**Author:** [@kfsone](https://discourse.cmake.org/u/kfsone)\
**Replies:** 2\
**Last updated:** [October 19, 2021, 5:31pm UTC](https://discourse.cmake.org/t/target-vs-component-based-install/4285 "2021-10-19T17:31:41Z")

</div>

Working on modernizing a non-trivial monorepo with a significant amount of it’s own tooling (code gen, asset conversion, etc). As part of this I wanted to incorporate cmake tooling to build some of the tools and install …

---

## [Setting the CXX\_STANDARD does not work](https://discourse.cmake.org/t/setting-the-cxx-standard-does-not-work/4305)

<div class="topic-metadata">

**Author:** [@mscofield0](https://discourse.cmake.org/u/mscofield0)\
**Replies:** 3\
**Last updated:** [October 19, 2021, 3:22pm UTC](https://discourse.cmake.org/t/setting-the-cxx-standard-does-not-work/4305 "2021-10-19T15:22:37Z")

</div>

When I try to use set\_target\_properties(${PROJECT\_NAME} PROPERTIES CXX\_STANDARD 20) it won’t set the target to 20, or at least, the output doesn’t show it and CLion does not detect that the standard is C++17 and above (T…

---

## [What does --strip do?](https://discourse.cmake.org/t/what-does-strip-do/4302)

<div class="topic-metadata">

**Author:** [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)\
**Replies:** 4\
**Last updated:** [October 18, 2021, 10:35pm UTC](https://discourse.cmake.org/t/what-does-strip-do/4302 "2021-10-18T22:35:19Z")

</div>

In the cmake docs for installing there is a –strip flag: --strip Strip before installing. What does this do?

---

## [How to set CC (CUDA Compute Capability) 5.0 in CMake?](https://discourse.cmake.org/t/how-to-set-cc-cuda-compute-capability-5-0-in-cmake/4283)

<div class="topic-metadata">

**Author:** [@Sharmin\_Sultana\_Sheu](https://discourse.cmake.org/u/Sharmin_Sultana_Sheu)\
**Replies:** 2\
**Last updated:** [October 18, 2021, 6:38pm UTC](https://discourse.cmake.org/t/how-to-set-cc-cuda-compute-capability-5-0-in-cmake/4283 "2021-10-18T18:38:42Z")

</div>

Hi I am a new bee in this field. I am using CUDA version 11040 windows 10 CMake version:3.21.3 and 2 GPU:NVIDIA Quadro M1200 and Intel HD graphics 630. And having the error : CUDA Error: no kernel image is availabl…

---

## [Conditionally calling pkg\_check\_modules in config.cmake.in](https://discourse.cmake.org/t/conditionally-calling-pkg-check-modules-in-config-cmake-in/4265)

<div class="topic-metadata">

**Author:** [@mdorier](https://discourse.cmake.org/u/mdorier)\
**Replies:** 1\
**Last updated:** [October 15, 2021, 11:58pm UTC](https://discourse.cmake.org/t/conditionally-calling-pkg-check-modules-in-config-cmake-in/4265 "2021-10-15T23:58:29Z")

</div>

I have a project that search for an optional dependency using either find\_package, or pkg-config, as follows in its CMakeLists.txt: find\_package (PkgConfig REQUIRED) if (ENABLE\_LEVELDB) # leveldb is searched via pkg-con…

---

## [CTEST\_CUSTOM\_TESTS\_IGNORE doesn't use regex like docs suggest?](https://discourse.cmake.org/t/ctest-custom-tests-ignore-doesnt-use-regex-like-docs-suggest/4267)

<div class="topic-metadata">

**Author:** [@JonTheBurger](https://discourse.cmake.org/u/JonTheBurger)\
**Replies:** 3\
**Last updated:** [October 15, 2021, 11:42pm UTC](https://discourse.cmake.org/t/ctest-custom-tests-ignore-doesnt-use-regex-like-docs-suggest/4267 "2021-10-15T23:42:51Z")

</div>

I think there’s a documentation bug for CTEST\_CUSTOM\_TESTS\_IGNORE. The documentation says it uses regular expressions, but this does not seem to be the case. ctest -N Test project /home/vagrant/Projects/cxxscratch/build…

---

## [CPack installs project](https://discourse.cmake.org/t/cpack-installs-project/4289)

<div class="topic-metadata">

**Author:** [@Leon0402](https://discourse.cmake.org/u/Leon0402)\
**Replies:** 4\
**Last updated:** [October 15, 2021, 3:29pm UTC](https://discourse.cmake.org/t/cpack-installs-project/4289 "2021-10-15T15:29:04Z")

</div>

Hi, I very unsure right now, but I think cpack used to only generate the packages and not install the Project itself. But currently when running “cpack .” or “cmake … --target package” it attempts to install the projec…

---

## [How does target\_link\_libraries with the PUBLIC flag actually work?](https://discourse.cmake.org/t/how-does-target-link-libraries-with-the-public-flag-actually-work/4268)

<div class="topic-metadata">

**Author:** [@Dylan\_Reedy](https://discourse.cmake.org/u/Dylan_Reedy)\
**Replies:** 3\
**Last updated:** [October 15, 2021, 11:47am UTC](https://discourse.cmake.org/t/how-does-target-link-libraries-with-the-public-flag-actually-work/4268 "2021-10-15T11:47:50Z")

</div>

I’m curious how the use of the PUBLIC flag in target\_link\_libraries actually works. As an example, say I create a library libA.so which depends on libB.so. Some elements of libB.so are in the public interface of A, so I …

---

## [DEPFILE with Makefile generators](https://discourse.cmake.org/t/depfile-with-makefile-generators/4234)

<div class="topic-metadata">

**Author:** [@etobis](https://discourse.cmake.org/u/etobis)\
**Replies:** 11\
**Last updated:** [October 12, 2021, 2:16pm UTC](https://discourse.cmake.org/t/depfile-with-makefile-generators/4234 "2021-10-12T14:16:57Z")

</div>

Hi! I’m writing an add\_custom\_command in cmake 3.21.2. My command successfully generates what looks to me like a .d format file with its dependencies. I specify this file as DEPFILE in my add\_custom\_command. I was expec…

---

## [Using CMake to create xpc service in macOS.](https://discourse.cmake.org/t/using-cmake-to-create-xpc-service-in-macos/4244)

<div class="topic-metadata">

**Author:** [@zohar81](https://discourse.cmake.org/u/zohar81)\
**Replies:** 2\
**Last updated:** [October 12, 2021, 6:17am UTC](https://discourse.cmake.org/t/using-cmake-to-create-xpc-service-in-macos/4244 "2021-10-12T06:17:31Z")

</div>

Hi, I’d like to create an xpc service from cmake. Basically, a simple XPC service contains the following bundle (compiled a builtin skeleton xpc service from xcode) Build/Products/Debug/myxpcservice.xpc/ Build/Products/…

---

## [cannot find -lboost\_filesystem](https://discourse.cmake.org/t/cannot-find-lboost-filesystem/4212)

<div class="topic-metadata">

**Author:** [@shayan\_Hojati](https://discourse.cmake.org/u/shayan_Hojati)\
**Replies:** 16\
**Last updated:** [October 11, 2021, 2:53pm UTC](https://discourse.cmake.org/t/cannot-find-lboost-filesystem/4212 "2021-10-11T14:53:40Z")

</div>

I found a code from GitHub whose CMakeLists .txt file looks like this: cmake\_minimum\_required(VERSION 3.7) project(obj\_loader) execute\_process(COMMAND python -c "import tensorflow; print(tensorflow.sysconfig.get\_includ…

---

## [How to have CMake resolve directories](https://discourse.cmake.org/t/how-to-have-cmake-resolve-directories/4209)

<div class="topic-metadata">

**Author:** [@theoremseeker](https://discourse.cmake.org/u/theoremseeker)\
**Replies:** 4\
**Last updated:** [October 11, 2021, 5:28am UTC](https://discourse.cmake.org/t/how-to-have-cmake-resolve-directories/4209 "2021-10-11T05:28:05Z")

</div>

Currently, I have to add directories to my files in my C/C++ project both in the CMakeLists.txt and my include directives, for example: add\_library (library1 src/dir1/file1.h src/dir1/file1.c ) and in file1.c itself…

---

## [CPack archive missing system files on macOS](https://discourse.cmake.org/t/cpack-archive-missing-system-files-on-macos/4223)

<div class="topic-metadata">

**Author:** [@rheiland](https://discourse.cmake.org/u/rheiland)\
**Replies:** 3\
**Last updated:** [October 8, 2021, 11:21am UTC](https://discourse.cmake.org/t/cpack-archive-missing-system-files-on-macos/4223 "2021-10-08T11:21:47Z")

</div>

When I use CPack to create a ZIP archive of a project on Windows, it includes the system .dll dependencies. However, when I do it on macOS (using g++ from brew), it does not include any system deps, only the executable. …

---

## [Cross-Compile builds and executing tests on embedded/android targets? i.e. firmware.elf flash + run with gdb](https://discourse.cmake.org/t/cross-compile-builds-and-executing-tests-on-embedded-android-targets-i-e-firmware-elf-flash-run-with-gdb/4217)

<div class="topic-metadata">

**Author:** [@CraigEmteq](https://discourse.cmake.org/u/CraigEmteq)\
**Replies:** 2\
**Last updated:** [October 8, 2021, 9:32am UTC](https://discourse.cmake.org/t/cross-compile-builds-and-executing-tests-on-embedded-android-targets-i-e-firmware-elf-flash-run-with-gdb/4217 "2021-10-08T09:32:38Z")

</div>

Looking for ideas if/as there may be somethign wihtin Cmake that could make Cross-Compiled test execution simpler/viable? As it stands the output artefact cannot be executed on the host machine obviously, my first point…

---

## [Color gone? 3.21-rc3 to 3.21.3](https://discourse.cmake.org/t/color-gone-3-21-rc3-to-3-21-3/4225)

<div class="topic-metadata">

**Author:** [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)\
**Replies:** 1\
**Last updated:** [October 8, 2021, 12:53am UTC](https://discourse.cmake.org/t/color-gone-3-21-rc3-to-3-21-3/4225 "2021-10-08T00:53:23Z")

</div>

I’m using powershell as my terminal if that matters. I upgraded from 3.21-rc3 to 3.21.3 and the color output from my terminal is now gone. Anyone else see this?

---

## [Collating codesign for the end?](https://discourse.cmake.org/t/collating-codesign-for-the-end/4220)

<div class="topic-metadata">

**Author:** [@lundman](https://discourse.cmake.org/u/lundman)\
**Replies:** 1\
**Last updated:** [October 8, 2021, 12:44am UTC](https://discourse.cmake.org/t/collating-codesign-for-the-end/4220 "2021-10-08T00:44:51Z")

</div>

Currently I codesign executables with function(um\_add\_executable name) add\_executable(${ARGV}) add\_custom\_command( TARGET ${name} POST\_BUILD COMMAND "${SIGNTOOL\_PROGRAM}" Which is fine and works. But since each…

---

## [Cannot find wxWidgets for MinGW using find\_package](https://discourse.cmake.org/t/cannot-find-wxwidgets-for-mingw-using-find-package/3860)

<div class="topic-metadata">

**Author:** [@jjELT](https://discourse.cmake.org/u/jjELT)\
**Replies:** 0\
**Last updated:** [August 1, 2021, 5:29pm UTC](https://discourse.cmake.org/t/cannot-find-wxwidgets-for-mingw-using-find-package/3860 "2021-08-01T17:29:42Z")

</div>

Building wxWidgets with MinGW I downloaded wxWidgets 3.1.5, extracted it to \<EXTERNAL\_PROJECTS\>/Source/wxwidgets/v3.1.5 and used CMake to build it via these commands: C:/Program Files/CMake/bin/cmake.exe -S\<EXTERNAL\_PRO…

---

## [Complile C++ for Profiling](https://discourse.cmake.org/t/complile-c-for-profiling/3055)

<div class="topic-metadata">

**Author:** [@Master\_Andreas](https://discourse.cmake.org/u/Master_Andreas)\
**Replies:** 12\
**Last updated:** [October 6, 2021, 5:24pm UTC](https://discourse.cmake.org/t/complile-c-for-profiling/3055 "2021-10-06T17:24:31Z")

</div>

I want to compile my C++ project (using CMAKE) I want to use all the perfomance optimaizations of -DCMAKE\_BUILD\_TYPE=Release Except striping it of debug linkining (to allow the profiler to record the function calls wit…

---

## [Hashes for downloads from multiple urls](https://discourse.cmake.org/t/hashes-for-downloads-from-multiple-urls/4199)

<div class="topic-metadata">

**Author:** [@bcmkakme](https://discourse.cmake.org/u/bcmkakme)\
**Replies:** 9\
**Last updated:** [October 6, 2021, 4:51pm UTC](https://discourse.cmake.org/t/hashes-for-downloads-from-multiple-urls/4199 "2021-10-06T16:51:18Z")

</div>

In the documentation for including External projects https://cmake.org/cmake/help/latest/module/ExternalProject.html from 3.17 it is possible to have multiple URLs to attempt to download from, it may be the case that the…

---

## [How to set arch dependent include directory for universal mac binary?](https://discourse.cmake.org/t/how-to-set-arch-dependent-include-directory-for-universal-mac-binary/4197)

<div class="topic-metadata">

**Author:** [@thomthom](https://discourse.cmake.org/u/thomthom)\
**Replies:** 2\
**Last updated:** [October 3, 2021, 6:36pm UTC](https://discourse.cmake.org/t/how-to-set-arch-dependent-include-directory-for-universal-mac-binary/4197 "2021-10-03T18:36:28Z")

</div>

I’m trying to setup architecture dependant include paths in CMake for universal macOS builds. I’m using a library that have platform dependant include headers. The equivalent Xcode version of this is using an .xcconfig…

---

## [\`target\_compile\_options()\` not setting compile flags](https://discourse.cmake.org/t/target-compile-options-not-setting-compile-flags/4183)

<div class="topic-metadata">

**Author:** [@mscofield0](https://discourse.cmake.org/u/mscofield0)\
**Replies:** 4\
**Last updated:** [October 1, 2021, 12:59pm UTC](https://discourse.cmake.org/t/target-compile-options-not-setting-compile-flags/4183 "2021-10-01T12:59:32Z")

</div>

For some reason target\_compile\_options() isn’t setting the compile flags for my target. This is roughly what the CMake code looks like: macro(internal\_add\_application) parse\_arguments(${ARGV}) add\_executable(${PROJ…

---

## [FIND\_PACKAGE\_HANDLE\_STANDARD\_ARGS doesn't work in all project](https://discourse.cmake.org/t/find-package-handle-standard-args-doesnt-work-in-all-project/4180)

<div class="topic-metadata">

**Author:** [@AlexLuya](https://discourse.cmake.org/u/AlexLuya)\
**Replies:** 1\
**Last updated:** [October 1, 2021, 11:42am UTC](https://discourse.cmake.org/t/find-package-handle-standard-args-doesnt-work-in-all-project/4180 "2021-10-01T11:42:47Z")

</div>

my configuration ubuntu 21.04 cmake 3.14 or 3.21.3 I got this error: CMake Error at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message): Could NOT find X11 (missing: X11\_X11\_LIB) Call Sta…

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

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