# Usage

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

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

**Page:** 35

---

## [Building gollvm on Windows 10 (i386): unable to determine host target triple; string sub-command REGEX, mode MATCH needs at least 5 arguments; Unknown architecture host](https://discourse.cmake.org/t/building-gollvm-on-windows-10-i386-unable-to-determine-host-target-triple-string-sub-command-regex-mode-match-needs-at-least-5-arguments-unknown-architecture-host/1654)

<div class="topic-metadata">

**Author:** [@Ivan\_Serdyuk](https://discourse.cmake.org/u/Ivan_Serdyuk)\
**Replies:** 5\
**Last updated:** [December 8, 2023, 9:45pm UTC](https://discourse.cmake.org/t/building-gollvm-on-windows-10-i386-unable-to-determine-host-target-triple-string-sub-command-regex-mode-match-needs-at-least-5-arguments-unknown-architecture-host/1654 "2023-12-08T21:45:17Z")

</div>

I have experienced some issues (gollvm’s project README), which look pretty much CMake related: cmake -DCMAKE\_BUILD\_TYPE=Debug -DCMAKE\_CXX\_FLAGS=-stdlib=libc++ -DCMAKE\_CXX\_COMPILER=clang++ -DCMAKE\_C\_COMPILER=clang -DGO…

---

## [CMake 3.28.0, FetchContent filed to resolve dependency target](https://discourse.cmake.org/t/cmake-3-28-0-fetchcontent-filed-to-resolve-dependency-target/9583)

<div class="topic-metadata">

**Author:** [@mc-nv](https://discourse.cmake.org/u/mc-nv)\
**Replies:** 1\
**Last updated:** [December 8, 2023, 3:48pm UTC](https://discourse.cmake.org/t/cmake-3-28-0-fetchcontent-filed-to-resolve-dependency-target/9583 "2023-12-08T15:48:45Z")

</div>

I’m trying to use FetchContent\_Declare() with CMake 3.28.0 as following: FetchContent\_Declare( repo-backend GIT\_REPOSITORY https://github.com/triton-inference-server/backend.git GIT\_TAG main GIT\_SHALLOW ON) Fetc…

---

## [If find\_package not support some library](https://discourse.cmake.org/t/if-find-package-not-support-some-library/9575)

<div class="topic-metadata">

**Author:** [@Sea\_Sea](https://discourse.cmake.org/u/Sea_Sea)\
**Replies:** 1\
**Last updated:** [December 8, 2023, 10:34am UTC](https://discourse.cmake.org/t/if-find-package-not-support-some-library/9575 "2023-12-08T10:34:35Z")

</div>

If xxlib is not the modules listed here are part of the CMake distribution. I want to write a FindXXlib.cmake to find the library. For the begin, should it use find\_package (like FindXXlib\_1.cmake)? Or directly us…

---

## [cannot find opencv modules for cmake v3.28](https://discourse.cmake.org/t/cannot-find-opencv-modules-for-cmake-v3-28/9555)

<div class="topic-metadata">

**Author:** [@Sea\_Sea](https://discourse.cmake.org/u/Sea_Sea)\
**Replies:** 3\
**Last updated:** [December 8, 2023, 10:29am UTC](https://discourse.cmake.org/t/cannot-find-opencv-modules-for-cmake-v3-28/9555 "2023-12-08T10:29:26Z")

</div>

In the lastest cmake-modules, I cannt find the opencv. I remember it had been exist. https://cmake.org/cmake/help/v3.28/manual/cmake-modules.7.html

---

## [target\_link\_libraries and include file](https://discourse.cmake.org/t/target-link-libraries-and-include-file/9567)

<div class="topic-metadata">

**Author:** [@Sea\_Sea](https://discourse.cmake.org/u/Sea_Sea)\
**Replies:** 3\
**Last updated:** [December 8, 2023, 10:26am UTC](https://discourse.cmake.org/t/target-link-libraries-and-include-file/9567 "2023-12-08T10:26:20Z")

</div>

I install a libdatachannel library by myself, on main.cpp #include \<rtc/rtc.hpp\> on CMakeLists.txt ... target\_link\_libraries(app PRIVATE ${LibDataChannel\_LIBRARIES}) The cmake show this error fatal error C1083: can…

---

## [how to properly use clang on windows](https://discourse.cmake.org/t/how-to-properly-use-clang-on-windows/9554)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 6\
**Last updated:** [December 8, 2023, 8:02am UTC](https://discourse.cmake.org/t/how-to-properly-use-clang-on-windows/9554 "2023-12-08T08:02:39Z")

</div>

I installed LLVM on windows (through the official installer) and I generate my project with the mingw-makefile generator (as I installed gcc through mingw). This fails with folllowing error during the compiler test sta…

---

## [Compiler is not using c++17 standard even though I configured it in CMakeLists.txt](https://discourse.cmake.org/t/compiler-is-not-using-c-17-standard-even-though-i-configured-it-in-cmakelists-txt/9570)

<div class="topic-metadata">

**Author:** [@FederalPoop](https://discourse.cmake.org/u/FederalPoop)\
**Replies:** 2\
**Last updated:** [December 6, 2023, 5:50pm UTC](https://discourse.cmake.org/t/compiler-is-not-using-c-17-standard-even-though-i-configured-it-in-cmakelists-txt/9570 "2023-12-06T17:50:42Z")

</div>

Hello, I’m trying to use ROOT’s libraries in Visual Studio Community 2022 v17.8.3. Some of them need the c++17 standard to compile, so I configured it in CMakeLists.txt However, when I try building the project, the comp…

---

## [CUDA selction with Visual Studio Generator](https://discourse.cmake.org/t/cuda-selction-with-visual-studio-generator/9535)

<div class="topic-metadata">

**Author:** [@cudawarped](https://discourse.cmake.org/u/cudawarped)\
**Replies:** 5\
**Last updated:** [December 4, 2023, 12:58pm UTC](https://discourse.cmake.org/t/cuda-selction-with-visual-studio-generator/9535 "2023-12-04T12:58:40Z")

</div>

If I have two CUDA toolkits installed say 12.2 and 12.3 the default Visual Studio behaviour appears to be to use CUDA 12.3, how can I generate a Visual Studio project which uses CUDA toolkit 12.2 when CUDA is a first cla…

---

## [copy dll to target path, randomly got "file COPY cannot set permissions on", but break my build pipeline](https://discourse.cmake.org/t/copy-dll-to-target-path-randomly-got-file-copy-cannot-set-permissions-on-but-break-my-build-pipeline/9539)

<div class="topic-metadata">

**Author:** [@Huanle](https://discourse.cmake.org/u/Huanle)\
**Replies:** 4\
**Last updated:** [December 2, 2023, 3:51am UTC](https://discourse.cmake.org/t/copy-dll-to-target-path-randomly-got-file-copy-cannot-set-permissions-on-but-break-my-build-pipeline/9539 "2023-12-02T03:51:49Z")

</div>

It seems not an error like the stacktrace says “No error.​” But the build pipeline will stop. Wonder anyone got the same issue, please help. Want to know how to prevent the “cannot set permissions” or ways to ignore th…

---

## [set\_source\_files\_properties with /Tp and /Tc](https://discourse.cmake.org/t/set-source-files-properties-with-tp-and-tc/9533)

<div class="topic-metadata">

**Author:** [@n-mam](https://discourse.cmake.org/u/n-mam)\
**Replies:** 1\
**Last updated:** [December 1, 2023, 6:06am UTC](https://discourse.cmake.org/t/set-source-files-properties-with-tp-and-tc/9533 "2023-12-01T06:06:36Z")

</div>

Hi, I am in the process of porting my project from sln to cmake and I have a situation where I need to compile 2 specific .c files as cpp. I used set\_source\_files\_properties on these 2 files like so: set\_source\_files\_p…

---

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

<div class="topic-metadata">

**Author:** [@tanmayd26](https://discourse.cmake.org/u/tanmayd26)\
**Replies:** 1\
**Last updated:** [November 30, 2023, 7:30pm UTC](https://discourse.cmake.org/t/find-package/9529 "2023-11-30T19:30:18Z")

</div>

I am getting this Cmake error CMake Error at autorally/autorally\_core/src/StateEstimator/CMakeLists.txt:15 (add\_executable): Target "StateEstimator" links to target "TBB::tbb" but the target was not found. Perhaps …

---

## [find\_library search the windows Path](https://discourse.cmake.org/t/find-library-search-the-windows-path/9490)

<div class="topic-metadata">

**Author:** [@Sea\_Sea](https://discourse.cmake.org/u/Sea_Sea)\
**Replies:** 4\
**Last updated:** [November 28, 2023, 7:55am UTC](https://discourse.cmake.org/t/find-library-search-the-windows-path/9490 "2023-11-28T07:55:29Z")

</div>

I set the windowns Path C:\\tmp\\prebuild I put the libdatachannel folder into C:\\tmp\\prebuild It like this Then use this find\_package(libdatachannel REQUIRED) find\_library(\_DataChannel\_LIB NAMES datachannel ) But…

---

## [Help with resolving CTest 'illegal exception' error.](https://discourse.cmake.org/t/help-with-resolving-ctest-illegal-exception-error/9515)

<div class="topic-metadata">

**Author:** [@Jason-1138](https://discourse.cmake.org/u/Jason-1138)\
**Replies:** 3\
**Last updated:** [November 28, 2023, 1:39am UTC](https://discourse.cmake.org/t/help-with-resolving-ctest-illegal-exception-error/9515 "2023-11-28T01:39:29Z")

</div>

In the CI build environment I am using (Jenkins) the project I am building sometimes gets odd test failures. The test failures don’t appear to be caused by the unit test itself but instead seem to be an error in CTest. …

---

## [Building multiple configs at the same time with the ninja multiconfig generator ?](https://discourse.cmake.org/t/building-multiple-configs-at-the-same-time-with-the-ninja-multiconfig-generator/9396)

<div class="topic-metadata">

**Author:** [@neundorf](https://discourse.cmake.org/u/neundorf)\
**Replies:** 3\
**Last updated:** [November 24, 2023, 5:50pm UTC](https://discourse.cmake.org/t/building-multiple-configs-at-the-same-time-with-the-ninja-multiconfig-generator/9396 "2023-11-24T17:50:30Z")

</div>

Hi, when using the Makefile or single-config ninja generators, I can (have to) create separate build trees e.g. for Debug- and Release-build. Once I have those separate build directories, I can build in them in paralle…

---

## [Facing issues while trying to upgrade Cmake 3.16.3 to 3.24.0 in WSL-Ubuntu 20.04](https://discourse.cmake.org/t/facing-issues-while-trying-to-upgrade-cmake-3-16-3-to-3-24-0-in-wsl-ubuntu-20-04/9498)

<div class="topic-metadata">

**Author:** [@honey-speaks-tech](https://discourse.cmake.org/u/honey-speaks-tech)\
**Replies:** 2\
**Last updated:** [November 24, 2023, 2:25pm UTC](https://discourse.cmake.org/t/facing-issues-while-trying-to-upgrade-cmake-3-16-3-to-3-24-0-in-wsl-ubuntu-20-04/9498 "2023-11-24T14:25:30Z")

</div>

Hello, I am trying to upgrade Cmake in my WSL – Ubuntu 20.4 environment from 3.16.3 to 3.24.0 following the instructions in Kitware APT repository webpage. However I am getting the below errors while running step 2:- …

---

## [defaulting a cached variable if not set by the user command line](https://discourse.cmake.org/t/defaulting-a-cached-variable-if-not-set-by-the-user-command-line/9493)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 3\
**Last updated:** [November 24, 2023, 12:00pm UTC](https://discourse.cmake.org/t/defaulting-a-cached-variable-if-not-set-by-the-user-command-line/9493 "2023-11-24T12:00:43Z")

</div>

My need is roughly the same as in \[CMake\] Can an option enforce a default, even if cache is present?. I understand, from this thread, that cmake may relaunch a configuration by itself, without using the command line arg…

---

## [A way to include a lot of directories](https://discourse.cmake.org/t/a-way-to-include-a-lot-of-directories/9479)

<div class="topic-metadata">

**Author:** [@cortes707](https://discourse.cmake.org/u/cortes707)\
**Replies:** 9\
**Last updated:** [November 24, 2023, 7:57am UTC](https://discourse.cmake.org/t/a-way-to-include-a-lot-of-directories/9479 "2023-11-24T07:57:54Z")

</div>

Hello, everyone. First, I am using CMake 3.27 from MingW 13.2.0, Windows 10 X64, VSCode 1.80.2, CMake Tools Extension v1.15.27 I have a project with like less than 1000 source & header files. About 150-160 directories.…

---

## [what is $\<TARGET\_FILE\_DIR\>](https://discourse.cmake.org/t/what-is-target-file-dir/9499)

<div class="topic-metadata">

**Author:** [@Sea\_Sea](https://discourse.cmake.org/u/Sea_Sea)\
**Replies:** 1\
**Last updated:** [November 24, 2023, 7:53am UTC](https://discourse.cmake.org/t/what-is-target-file-dir/9499 "2023-11-24T07:53:43Z")

</div>

"$\<TARGET\_FILE\_DIR:datachannel\>/datachannel.dll" $\<TARGET\_FILE\_DIR:datachannel-copy-paste-offerer\> What does it mean? where can I find the document? I try to use message to print the variable , but it can not ge…

---

## [Error in configuration process, project files may be invalid.](https://discourse.cmake.org/t/error-in-configuration-process-project-files-may-be-invalid/7853)

<div class="topic-metadata">

**Author:** [@ccyu00](https://discourse.cmake.org/u/ccyu00)\
**Replies:** 3\
**Last updated:** [November 23, 2023, 10:46am UTC](https://discourse.cmake.org/t/error-in-configuration-process-project-files-may-be-invalid/7853 "2023-11-23T10:46:00Z")

</div>

I have installed VS 2202. I am using CMake 3.26.2 windows x64 to configure and BRL-CAD. However, I am getting “Error in configuration process, project files may be invalid”. It shows “could not find any instance of Visu…

---

## [CMAKE\_SYSTEM\_NAME = WindowsStore](https://discourse.cmake.org/t/cmake-system-name-windowsstore/9488)

<div class="topic-metadata">

**Author:** [@Sea\_Sea](https://discourse.cmake.org/u/Sea_Sea)\
**Replies:** 1\
**Last updated:** [November 23, 2023, 2:05am UTC](https://discourse.cmake.org/t/cmake-system-name-windowsstore/9488 "2023-11-23T02:05:15Z")

</div>

I only get ‘windows’ . what is the condition to show WindowsStore if(CMAKE\_SYSTEM\_NAME STREQUAL "WindowsStore")

---

## [add\_library and target\_include\_directories](https://discourse.cmake.org/t/add-library-and-target-include-directories/9482)

<div class="topic-metadata">

**Author:** [@Sea\_Sea](https://discourse.cmake.org/u/Sea_Sea)\
**Replies:** 1\
**Last updated:** [November 22, 2023, 2:28pm UTC](https://discourse.cmake.org/t/add-library-and-target-include-directories/9482 "2023-11-22T14:28:29Z")

</div>

add\_library already use the ${CMAKE\_CURRENT\_SOURCE\_DIR}/include/rtc why does target\_include\_directories do it again?

---

## [unable to submit tests to cdash.org](https://discourse.cmake.org/t/unable-to-submit-tests-to-cdash-org/9446)

<div class="topic-metadata">

**Author:** [@saadmuizz](https://discourse.cmake.org/u/saadmuizz)\
**Replies:** 11\
**Last updated:** [November 22, 2023, 2:21pm UTC](https://discourse.cmake.org/t/unable-to-submit-tests-to-cdash-org/9446 "2023-11-22T14:21:28Z")

</div>

It may not be CDash problem but with my CMake configurations itself. I’m unable to submit the tests to the cdash.org, for the command ctest --submit I get the error: Although i have added tests through add\_test No te…

---

## [Is it possible to configure a file at build time?](https://discourse.cmake.org/t/is-it-possible-to-configure-a-file-at-build-time/9476)

<div class="topic-metadata">

**Author:** [@Brian](https://discourse.cmake.org/u/Brian)\
**Replies:** 2\
**Last updated:** [November 21, 2023, 1:23pm UTC](https://discourse.cmake.org/t/is-it-possible-to-configure-a-file-at-build-time/9476 "2023-11-21T13:23:59Z")

</div>

Hi All, Is it possible to configure a file at build time? I want the functionality that configure\_file provides but I need it to run after another set of files have been generated. I already have a custom command that…

---

## [check\_cxx\_compiler\_flag does not work on unknown warning options of clang](https://discourse.cmake.org/t/check-cxx-compiler-flag-does-not-work-on-unknown-warning-options-of-clang/9470)

<div class="topic-metadata">

**Author:** [@swhc](https://discourse.cmake.org/u/swhc)\
**Replies:** 4\
**Last updated:** [November 21, 2023, 1:52am UTC](https://discourse.cmake.org/t/check-cxx-compiler-flag-does-not-work-on-unknown-warning-options-of-clang/9470 "2023-11-21T01:52:16Z")

</div>

I use check\_cxx\_compiler\_flag to check -Werror=implicit-fallthrough=3 on clang 16.0.6 and it succeeds but actually clang doesn’t support such flags. Use clang++ -Werror=implicit-fallthough=3 -c A.cc and it gets: warnin…

---

## [msys/mingw32 Platform/MINGW32\_NT-10.0-19045 to use this system,](https://discourse.cmake.org/t/msys-mingw32-platform-mingw32-nt-10-0-19045-to-use-this-system/9458)

<div class="topic-metadata">

**Author:** [@Yigal\_Hochberg](https://discourse.cmake.org/u/Yigal_Hochberg)\
**Replies:** 1\
**Last updated:** [November 20, 2023, 1:35pm UTC](https://discourse.cmake.org/t/msys-mingw32-platform-mingw32-nt-10-0-19045-to-use-this-system/9458 "2023-11-20T13:35:29Z")

</div>

Hi, I installed msys2/mingw32 gcc and try to build using msys cmake. I get the following error:

---

## [Check available generators](https://discourse.cmake.org/t/check-available-generators/9391)

<div class="topic-metadata">

**Author:** [@mdziuban](https://discourse.cmake.org/u/mdziuban)\
**Replies:** 6\
**Last updated:** [November 20, 2023, 1:34pm UTC](https://discourse.cmake.org/t/check-available-generators/9391 "2023-11-20T13:34:00Z")

</div>

Is there a way to check available CMake generators? Some argument to query it from CMake? I cannot find a way to do this. I mean generators that are actually available and will successfully configure projects. For exampl…

---

## [Get ride of \`Release\` on build path output](https://discourse.cmake.org/t/get-ride-of-release-on-build-path-output/9381)

<div class="topic-metadata">

**Author:** [@skhaz](https://discourse.cmake.org/u/skhaz)\
**Replies:** 11\
**Last updated:** [November 20, 2023, 1:33pm UTC](https://discourse.cmake.org/t/get-ride-of-release-on-build-path-output/9381 "2023-11-20T13:33:17Z")

</div>

How do I make CMake force MSVC to place the binary produced by the build in the “build” directory? I ask because for all platforms (Linux, macOS & WebAssembly) the final binary is located in build , but only on Windows …

---

## [proper setting of the include system property of an imported target.](https://discourse.cmake.org/t/proper-setting-of-the-include-system-property-of-an-imported-target/9379)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 1\
**Last updated:** [November 20, 2023, 12:40pm UTC](https://discourse.cmake.org/t/proper-setting-of-the-include-system-property-of-an-imported-target/9379 "2023-11-20T12:40:50Z")

</div>

My goal is simple. When I consume a given library header through: find\_package(\<package\>) target\_link\_libraries(\<target\> \[Inheritance\] \<package\>) I would like to treat \<package\> header as system or not system regardles…

---

## [Creating multiple monolithic packages (deb)](https://discourse.cmake.org/t/creating-multiple-monolithic-packages-deb/9457)

<div class="topic-metadata">

**Author:** [@mirni](https://discourse.cmake.org/u/mirni)\
**Replies:** 1\
**Last updated:** [November 19, 2023, 2:46am UTC](https://discourse.cmake.org/t/creating-multiple-monolithic-packages-deb/9457 "2023-11-19T02:46:58Z")

</div>

Hi all, I need to create multiple standalone (self-contained, monolithic) debian packages, by “monolithic” I mean that the package contains everything it needs for the binaries to run. The premise of cmake/cpack is tha…

---

## [Avoiding Cygwin when searching for FLEX](https://discourse.cmake.org/t/avoiding-cygwin-when-searching-for-flex/9447)

<div class="topic-metadata">

**Author:** [@EosPengwern](https://discourse.cmake.org/u/EosPengwern)\
**Replies:** 3\
**Last updated:** [November 19, 2023, 2:38am UTC](https://discourse.cmake.org/t/avoiding-cygwin-when-searching-for-flex/9447 "2023-11-19T02:38:17Z")

</div>

In a previous question I asked for help with finding Flex. Following the advice given, I was able to find it and work with it. The version of Flex found was in my C:\\Cygwin\\bin directory. For various reasons not to do w…

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

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