# Usage

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

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

**Page:** 64

---

## [window env variable and cmake path](https://discourse.cmake.org/t/window-env-variable-and-cmake-path/5410)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.cmake.org/u/alice)\
**Replies:** 4\
**Last updated:** [April 11, 2022, 1:36am UTC](https://discourse.cmake.org/t/window-env-variable-and-cmake-path/5410 "2022-04-11T01:36:25Z")

</div>

I set the windows env variable path=D:\\test\\fmt\\debug Then I let the cmakelist find\_library(\_FMT\_LIB NAMES fmt PATHS "D:\\test\\fmt\\release" The final result will be the D:\\test\\fmt\\debug How to let it to D:\\tes…

---

## [Whats the difference between using "devenv solution.sln" and "cmake --build --target" on windows](https://discourse.cmake.org/t/whats-the-difference-between-using-devenv-solution-sln-and-cmake-build-target-on-windows/5418)

<div class="topic-metadata">

**Author:** [@Lothar\_Scholz](https://discourse.cmake.org/u/Lothar_Scholz)\
**Replies:** 1\
**Last updated:** [April 10, 2022, 2:58pm UTC](https://discourse.cmake.org/t/whats-the-difference-between-using-devenv-solution-sln-and-cmake-build-target-on-windows/5418 "2022-04-10T14:58:26Z")

</div>

Is it in the end giving me the exact same result? Are both using msbuild in the end? I always used devenv in the past because thats what most google result tell me but it’s much faster to simply use cmake.

---

## [What does /fast do on install targets?](https://discourse.cmake.org/t/what-does-fast-do-on-install-targets/5397)

<div class="topic-metadata">

**Author:** [@mathomp4](https://discourse.cmake.org/u/mathomp4)\
**Replies:** 2\
**Last updated:** [April 9, 2022, 2:45pm UTC](https://discourse.cmake.org/t/what-does-fast-do-on-install-targets/5397 "2022-04-09T14:45:03Z")

</div>

This is probably a FAQ, but I couldn’t find anything in the CMake docs or Google, so I thought I’d ask here. I was doing some tab-completion today and saw that there is an install/fast target (and, of course, install/st…

---

## [CMake usage philosophy - between build and install, what is the good way ?](https://discourse.cmake.org/t/cmake-usage-philosophy-between-build-and-install-what-is-the-good-way/5341)

<div class="topic-metadata">

**Author:** [@Olivier](https://discourse.cmake.org/u/Olivier)\
**Replies:** 3\
**Last updated:** [April 9, 2022, 12:59pm UTC](https://discourse.cmake.org/t/cmake-usage-philosophy-between-build-and-install-what-is-the-good-way/5341 "2022-04-09T12:59:43Z")

</div>

Hello everyone, I’m trying to manage a very old monolythic project which contains either static libs or dynamic (around 98) and a set of exe (around 25). I don’t want to break all the work done for years, so I can’t exp…

---

## [CMake where one can build from the directory itself or from the root cmake](https://discourse.cmake.org/t/cmake-where-one-can-build-from-the-directory-itself-or-from-the-root-cmake/5399)

<div class="topic-metadata">

**Author:** [@Joel](https://discourse.cmake.org/u/Joel)\
**Replies:** 1\
**Last updated:** [April 9, 2022, 12:53pm UTC](https://discourse.cmake.org/t/cmake-where-one-can-build-from-the-directory-itself-or-from-the-root-cmake/5399 "2022-04-09T12:53:29Z")

</div>

Hi, I have a question about using CMake for a repository, with a root cmake at the top which add\_subdirectory()'s all the directories. However, I would also like to be able to build from individual directories without r…

---

## [find\_package path on windows](https://discourse.cmake.org/t/find-package-path-on-windows/5339)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.cmake.org/u/alice)\
**Replies:** 5\
**Last updated:** [April 9, 2022, 12:33pm UTC](https://discourse.cmake.org/t/find-package-path-on-windows/5339 "2022-04-09T12:33:06Z")

</div>

https://cmake.org/cmake/help/v3.0/command/find\_package.html find\_package(Boost REQUIRED COMPONENTS system filesystem date\_time PATHS "D:\\TEST\\boost\\debug\\lib" NO\_DEFAULT\_PATH) It cant parse path on windows.

---

## [DEBUG\_CONFIGURATIONS property?](https://discourse.cmake.org/t/debug-configurations-property/5409)

<div class="topic-metadata">

**Author:** [@benthevining](https://discourse.cmake.org/u/benthevining)\
**Replies:** 1\
**Last updated:** [April 8, 2022, 8:58pm UTC](https://discourse.cmake.org/t/debug-configurations-property/5409 "2022-04-08T20:58:30Z")

</div>

The DEBUG\_CONFIGURATIONS property doesn’t appear to be initialized by default. The docs for it do say This property must be set at the top level of the project and before the first target\_link\_libraries() command invoc…

---

## [CPack component call order?](https://discourse.cmake.org/t/cpack-component-call-order/5369)

<div class="topic-metadata">

**Author:** [@benthevining](https://discourse.cmake.org/u/benthevining)\
**Replies:** 1\
**Last updated:** [April 7, 2022, 3:09pm UTC](https://discourse.cmake.org/t/cpack-component-call-order/5369 "2022-04-07T15:09:39Z")

</div>

Very simple question – should cpack\_add\_component be called before or after any install() commands that mention that COMPONENT?

---

## [unresolved external symbol "public: static struct QMetaObject const" when linking to a shared Q\_OBJECT](https://discourse.cmake.org/t/unresolved-external-symbol-public-static-struct-qmetaobject-const-when-linking-to-a-shared-q-object/5338)

<div class="topic-metadata">

**Author:** [@zhang-qiang-github](https://discourse.cmake.org/u/zhang-qiang-github)\
**Replies:** 1\
**Last updated:** [April 7, 2022, 3:08pm UTC](https://discourse.cmake.org/t/unresolved-external-symbol-public-static-struct-qmetaobject-const-when-linking-to-a-shared-q-object/5338 "2022-04-07T15:08:22Z")

</div>

I want to make two QObject libraries using cmake on windows: ProA & ProB, where ProB depend on ProA. I want to make two QObject libraries using cmake on windows: ProA & ProB, where ProB depend on ProA. The code of ProA…

---

## [Pattern for choosing compiler options based on toolchain?](https://discourse.cmake.org/t/pattern-for-choosing-compiler-options-based-on-toolchain/5388)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 4\
**Last updated:** [April 7, 2022, 8:03am UTC](https://discourse.cmake.org/t/pattern-for-choosing-compiler-options-based-on-toolchain/5388 "2022-04-07T08:03:51Z")

</div>

I need to set different compiler options (using target\_compile\_options) depending on which toolchain is used. What is the recommended pattern for doing so? Should I do something like this in CMakeLists.txt? if("${CMAK…

---

## [How to copy dll files to the binary folder](https://discourse.cmake.org/t/how-to-copy-dll-files-to-the-binary-folder/5370)

<div class="topic-metadata">

**Author:** [@JuliusCaesar](https://discourse.cmake.org/u/JuliusCaesar)\
**Replies:** 4\
**Last updated:** [April 6, 2022, 10:28pm UTC](https://discourse.cmake.org/t/how-to-copy-dll-files-to-the-binary-folder/5370 "2022-04-06T22:28:13Z")

</div>

Hey guys, in order to get QT to work properly I have to copy the QT dlls to the binary folder on windows. According to the docs (https://cmake.org/cmake/help/latest/command/install.html#directory) this should be easily…

---

## [Using lld-link with MSVC compiler on Windows](https://discourse.cmake.org/t/using-lld-link-with-msvc-compiler-on-windows/5381)

<div class="topic-metadata">

**Author:** [@marstaik](https://discourse.cmake.org/u/marstaik)\
**Replies:** 1\
**Last updated:** [April 5, 2022, 9:32pm UTC](https://discourse.cmake.org/t/using-lld-link-with-msvc-compiler-on-windows/5381 "2022-04-05T21:32:48Z")

</div>

I’ve been struggling for a while to get a clean way to be able to link with a separate linker on windows… I have huge executables linking and on similar projects using meson (where it is very easy to specify the linker)…

---

## [Because CMake-gui does not use UTF-8 (without BOM) for URLs?](https://discourse.cmake.org/t/because-cmake-gui-does-not-use-utf-8-without-bom-for-urls/5335)

<div class="topic-metadata">

**Author:** [@Daniel\_Briceno](https://discourse.cmake.org/u/Daniel_Briceno)\
**Replies:** 3\
**Last updated:** [April 5, 2022, 2:12pm UTC](https://discourse.cmake.org/t/because-cmake-gui-does-not-use-utf-8-without-bom-for-urls/5335 "2022-04-05T14:12:03Z")

</div>

I have as a user a name that has the letter Unicode: ñ. So always by generating with cmake I did not find the routes, I saw the route through the file explorer and I also saw the cmakelists.txt file, it was beginning to …

---

## [Can I find the current test tag (cmCTest::GetCurrentTag) within a test?](https://discourse.cmake.org/t/can-i-find-the-current-test-tag-cmctest-getcurrenttag-within-a-test/5348)

<div class="topic-metadata">

**Author:** [@pmolodo](https://discourse.cmake.org/u/pmolodo)\
**Replies:** 1\
**Last updated:** [April 4, 2022, 1:26am UTC](https://discourse.cmake.org/t/can-i-find-the-current-test-tag-cmctest-getcurrenttag-within-a-test/5348 "2022-04-04T01:26:43Z")

</div>

ie, is it placed inside of a CMake variable (I could read from CTestCustom.cmake) or environment variable, or similar?

---

## [Installing CMake on Windows 10](https://discourse.cmake.org/t/installing-cmake-on-windows-10/5358)

<div class="topic-metadata">

**Author:** [@Philip\_Tilson](https://discourse.cmake.org/u/Philip_Tilson)\
**Replies:** 1\
**Last updated:** [April 4, 2022, 1:22am UTC](https://discourse.cmake.org/t/installing-cmake-on-windows-10/5358 "2022-04-04T01:22:07Z")

</div>

Hi - As a brand new user to the RasPi Pico module, I am attempting to install the various packages required for Windows 10, one of which is CMake. However, every time I try to install, whether from a .msi or from the .…

---

## [I'm struggling to understand how to run cmake on windows to clone a project that uses SDL2](https://discourse.cmake.org/t/im-struggling-to-understand-how-to-run-cmake-on-windows-to-clone-a-project-that-uses-sdl2/5355)

<div class="topic-metadata">

**Author:** [@RoadHog](https://discourse.cmake.org/u/RoadHog)\
**Replies:** 2\
**Last updated:** [April 2, 2022, 12:08pm UTC](https://discourse.cmake.org/t/im-struggling-to-understand-how-to-run-cmake-on-windows-to-clone-a-project-that-uses-sdl2/5355 "2022-04-02T12:08:10Z")

</div>

This is my first time using cmake, I cloned a project form github on my linux Virtual boxes, and ran the appropriate commands and it worked wonderfully. Problem is, when I try to use Visual studio on windows, everything…

---

## [print list of tests via TEST\_LIST variable](https://discourse.cmake.org/t/print-list-of-tests-via-test-list-variable/5277)

<div class="topic-metadata">

**Author:** [@yisseamake](https://discourse.cmake.org/u/yisseamake)\
**Replies:** 7\
**Last updated:** [April 2, 2022, 12:57am UTC](https://discourse.cmake.org/t/print-list-of-tests-via-test-list-variable/5277 "2022-04-02T00:57:38Z")

</div>

Could you please advise how view/print list of tests discovered by gtest\_discover\_tests. As per 3.17.5 user guide the option TEST\_LIST var Make the list of tests available in the variable var… Note that this variable is …

---

## [INTERFACE library not getting installed and no error reported](https://discourse.cmake.org/t/interface-library-not-getting-installed-and-no-error-reported/2185)

<div class="topic-metadata">

**Author:** [@yisseamake](https://discourse.cmake.org/u/yisseamake)\
**Replies:** 33\
**Last updated:** [April 2, 2022, 12:28am UTC](https://discourse.cmake.org/t/interface-library-not-getting-installed-and-no-error-reported/2185 "2022-04-02T00:28:59Z")

</div>

After INTERFACE (header only library) is added with add\_library and setting of INTERFACE for BUILD\_INTERFACE and INSTALL\_INTERFACE with target\_include\_directories, followed by install(TARGETS EXPORT and install(EXPOR…

---

## [TARGET\_OBJECTS macro, missing character in one of the object files](https://discourse.cmake.org/t/target-objects-macro-missing-character-in-one-of-the-object-files/4447)

<div class="topic-metadata">

**Author:** [@serge](https://discourse.cmake.org/u/serge)\
**Replies:** 14\
**Last updated:** [April 1, 2022, 2:46pm UTC](https://discourse.cmake.org/t/target-objects-macro-missing-character-in-one-of-the-object-files/4447 "2022-04-01T14:46:17Z")

</div>

Hello guys, I am using cmake 3.20.5 and we have created a quite big build system for windows / Linux and Mac. One of our library (OBJECT library) includes a big number of object files and when using TARGET\_OBJECTS macr…

---

## [Can I modify ctest via custom command line arguments?](https://discourse.cmake.org/t/can-i-modify-ctest-via-custom-command-line-arguments/5349)

<div class="topic-metadata">

**Author:** [@pmolodo](https://discourse.cmake.org/u/pmolodo)\
**Replies:** 3\
**Last updated:** [April 1, 2022, 12:27pm UTC](https://discourse.cmake.org/t/can-i-modify-ctest-via-custom-command-line-arguments/5349 "2022-04-01T12:27:31Z")

</div>

Suppose I have a test defined like: add\_test(NAME myCoolTest COMMAND testRunner normalArg) I’d like to be able to modify myCoolTest when I call ctest, by doing something like: ctest -R myCoolTest -D do-crazy=1 …whic…

---

## [Unable to resolve @rpath not found](https://discourse.cmake.org/t/unable-to-resolve-rpath-not-found/5325)

<div class="topic-metadata">

**Author:** [@Gary](https://discourse.cmake.org/u/Gary)\
**Replies:** 2\
**Last updated:** [March 31, 2022, 5:36pm UTC](https://discourse.cmake.org/t/unable-to-resolve-rpath-not-found/5325 "2022-03-31T17:36:15Z")

</div>

I’m trying to compile WSJT-X for MacOS 12.3. Environment includes Xcode, Macports, Cmake 3.22.3 and QT 5.15.2. I use the Cmake GUI to configure and generate build files. WSJT-X builds without errors when I use the make c…

---

## [find\_package method](https://discourse.cmake.org/t/find-package-method/5346)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.cmake.org/u/alice)\
**Replies:** 3\
**Last updated:** [March 31, 2022, 2:48pm UTC](https://discourse.cmake.org/t/find-package-method/5346 "2022-03-31T14:48:38Z")

</div>

I build a opencv library and put it on D:/TEST/opencv/release opencv structure like this HOW TO build it successfully method 1 On the cmakelist.txt find\_package(OpenCV REQUIRED PATHS "D:/TEST/opencv/release" NO\_DE…

---

## [vc143, detected vc142](https://discourse.cmake.org/t/vc143-detected-vc142/5345)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.cmake.org/u/alice)\
**Replies:** 5\
**Last updated:** [March 31, 2022, 2:44pm UTC](https://discourse.cmake.org/t/vc143-detected-vc142/5345 "2022-03-31T14:44:13Z")

</div>

what does it mean? vc143, detected vc142 Found package configuration file: 1\> \[CMake\] 1\> \[CMake\] D:/TEST/boost/debug/lib/cmake/boost\_system-1.78.0/boost\_system-config.cmake 1\> \[CMake\] 1\> \[CMake\] but it set boos…

---

## [Config Mode Search Procedure](https://discourse.cmake.org/t/config-mode-search-procedure/5340)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.cmake.org/u/alice)\
**Replies:** 1\
**Last updated:** [March 31, 2022, 2:04pm UTC](https://discourse.cmake.org/t/config-mode-search-procedure/5340 "2022-03-31T14:04:12Z")

</div>

fmt ├── release │ ├── include │ └── lib ├── fmt.lib ├── cmake/fmt ├── fmt-config.cmake command cmake -G "Visual Studio 16 2019" ^ -DCMAKE\_BUILD…

---

## [ARMclang always includes --target=arm-arm-none-eabi option](https://discourse.cmake.org/t/armclang-always-includes-target-arm-arm-none-eabi-option/5328)

<div class="topic-metadata">

**Author:** [@oscarh2](https://discourse.cmake.org/u/oscarh2)\
**Replies:** 2\
**Last updated:** [March 30, 2022, 11:44pm UTC](https://discourse.cmake.org/t/armclang-always-includes-target-arm-arm-none-eabi-option/5328 "2022-03-30T23:44:20Z")

</div>

I’m using CMake 3.21, and for policy CMP0123, I chose to use “NEW” in my CMakeLists.txt: cmake\_policy(SET CMP0123 NEW) And this is my toolchain file: set(CMAKE\_SYSTEM\_NAME Generic) set(CMAKE\_C\_COMPILER armclang) set(C…

---

## [The XCode generator sucks, can't we write a real new one?](https://discourse.cmake.org/t/the-xcode-generator-sucks-cant-we-write-a-real-new-one/5192)

<div class="topic-metadata">

**Author:** [@Lothar\_Scholz](https://discourse.cmake.org/u/Lothar_Scholz)\
**Replies:** 7\
**Last updated:** [March 30, 2022, 4:50pm UTC](https://discourse.cmake.org/t/the-xcode-generator-sucks-cant-we-write-a-real-new-one/5192 "2022-03-30T16:50:19Z")

</div>

The xcode generator is not generating xcode projects but only makefiles that xcode can use. It has many issues and is not working well with the IDE at all. I18N and testing for example is still an everlasting problem, b…

---

## [Incorrect CMAKE\_INSTALL\_LIBDIR with 3.23rc3 on Debian? Is this a bug?](https://discourse.cmake.org/t/incorrect-cmake-install-libdir-with-3-23rc3-on-debian-is-this-a-bug/5202)

<div class="topic-metadata">

**Author:** [@szhorvat](https://discourse.cmake.org/u/szhorvat)\
**Replies:** 5\
**Last updated:** [March 30, 2022, 2:49pm UTC](https://discourse.cmake.org/t/incorrect-cmake-install-libdir-with-3-23rc3-on-debian-is-this-a-bug/5202 "2022-03-30T14:49:03Z")

</div>

With the CMake 3.23 release candidates, the CMAKE\_INSTALL\_LIBDIR result variable provided by GnuInstallDirs contains the architecture name even when installing to a private location. Is this a bug or an intentional chang…

---

## [Compile test invokes wrong ar.exe](https://discourse.cmake.org/t/compile-test-invokes-wrong-ar-exe/5311)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 2\
**Last updated:** [March 29, 2022, 2:29pm UTC](https://discourse.cmake.org/t/compile-test-invokes-wrong-ar-exe/5311 "2022-03-29T14:29:59Z")

</div>

Hi, I am trying to configure CMakePresets to build an embedded application using the armclang compiler running on Windows. I’ve succeed when running within an ARM Developer Studio command prompt, which sets up the necess…

---

## [CMake Error at CMakeLists.txt:19 (project): Failed to run MSBuild command: to get the value of VCTargetsPath:](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-19-project-failed-to-run-msbuild-command-to-get-the-value-of-vctargetspath/5240)

<div class="topic-metadata">

**Author:** [@Kitoali](https://discourse.cmake.org/u/Kitoali)\
**Replies:** 1\
**Last updated:** [March 29, 2022, 9:48am UTC](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-19-project-failed-to-run-msbuild-command-to-get-the-value-of-vctargetspath/5240 "2022-03-29T09:48:15Z")

</div>

Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044. CMake Error at CMakeLists.txt:19 (project): Failed to run MSBuild command: D:/Coding/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/…

---

## [GenerateExportHeader error](https://discourse.cmake.org/t/generateexportheader-error/5304)

<div class="topic-metadata">

**Author:** [@benthevining](https://discourse.cmake.org/u/benthevining)\
**Replies:** 2\
**Last updated:** [March 26, 2022, 10:22pm UTC](https://discourse.cmake.org/t/generateexportheader-error/5304 "2022-03-26T22:22:28Z")

</div>

Attempting to use the GenerateExportHeader module, I get this error: CMake Error: File /exportheader.cmake.in does not exist. CMake Error at /usr/local/Cellar/cmake/3.22.3/share/cmake/Modules/GenerateExportHeader.cmake:…

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

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