# Usage

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

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

**Page:** 48

---

## [Issue with cmake finding SDK for Windows UWP apps](https://discourse.cmake.org/t/issue-with-cmake-finding-sdk-for-windows-uwp-apps/7697)

<div class="topic-metadata">

**Author:** [@Jalen\_Ballard](https://discourse.cmake.org/u/Jalen_Ballard)\
**Replies:** 0\
**Last updated:** [March 17, 2023, 12:13am UTC](https://discourse.cmake.org/t/issue-with-cmake-finding-sdk-for-windows-uwp-apps/7697 "2023-03-17T00:13:32Z")

</div>

Hello, I am trying to compile a Windows UWP-targeted project with cmake, but it seems that cmake is saying that it can’t find all the required Windows SDK files even though I believe I have installed the required pack…

---

## [FindPython3 behaves differently with every little change in CMakeLists.txt](https://discourse.cmake.org/t/findpython3-behaves-differently-with-every-little-change-in-cmakelists-txt/7684)

<div class="topic-metadata">

**Author:** [@tricostume](https://discourse.cmake.org/u/tricostume)\
**Replies:** 1\
**Last updated:** [March 16, 2023, 6:05pm UTC](https://discourse.cmake.org/t/findpython3-behaves-differently-with-every-little-change-in-cmakelists-txt/7684 "2023-03-16T18:05:27Z")

</div>

I am trying to use the next piece of cmake code: #set(Python3\_FIND\_STRATEGY LOCATION) #set(Python3\_FIND\_REGISTRY FIRST) #set(Python3\_FIND\_VIRTUALENV FIRST) find\_package(Python3 COMPONENTS Interpreter Development REQU…

---

## [CPack strip doesn't work with llvm-strip on macOS](https://discourse.cmake.org/t/cpack-strip-doesnt-work-with-llvm-strip-on-macos/7671)

<div class="topic-metadata">

**Author:** [@dbabokin](https://discourse.cmake.org/u/dbabokin)\
**Replies:** 2\
**Last updated:** [March 15, 2023, 5:32am UTC](https://discourse.cmake.org/t/cpack-strip-doesnt-work-with-llvm-strip-on-macos/7671 "2023-03-15T05:32:30Z")

</div>

I’m enabling CPACK\_STRIP\_FILES on macOS and I have manually built llvm toolchain in the path (same is reproducible with official LLVM build - https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+ll…

---

## [setting generated shared library path for client](https://discourse.cmake.org/t/setting-generated-shared-library-path-for-client/7649)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 3\
**Last updated:** [March 15, 2023, 1:09am UTC](https://discourse.cmake.org/t/setting-generated-shared-library-path-for-client/7649 "2023-03-15T01:09:51Z")

</div>

Hi, When “installing” a shared library target, is there a special way to declare the resulting .so/.dll path. So far I manage it like my static libraries and, at least on windows/mingw/make, my client code using the dl…

---

## [how to make "/Ob3" flag set in preset not overrided by default "/Ob0" after](https://discourse.cmake.org/t/how-to-make-ob3-flag-set-in-preset-not-overrided-by-default-ob0-after/7665)

<div class="topic-metadata">

**Author:** [@linuxaged](https://discourse.cmake.org/u/linuxaged)\
**Replies:** 1\
**Last updated:** [March 13, 2023, 9:24pm UTC](https://discourse.cmake.org/t/how-to-make-ob3-flag-set-in-preset-not-overrided-by-default-ob0-after/7665 "2023-03-13T21:24:04Z")

</div>

{ "name": "windows-msvc", "hidden": true, "generator": "Ninja", "binaryDir": "${sourceDir}/out/build/${presetName}", "installDir": "${sourceDir}/out/install/${presetName}", "cacheVariables": { …

---

## [How to fix build warning D9025 (Overriding /GR with /GR-)](https://discourse.cmake.org/t/how-to-fix-build-warning-d9025-overriding-gr-with-gr/878)

<div class="topic-metadata">

**Author:** [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)\
**Replies:** 7\
**Last updated:** [March 13, 2023, 9:22pm UTC](https://discourse.cmake.org/t/how-to-fix-build-warning-d9025-overriding-gr-with-gr/878 "2023-03-13T21:22:29Z")

</div>

My project needs to disable RTTI however I’m getting this build warning. This is all I’m doing. target\_compile\_optons(foo\_target PRIVATE /GR-)

---

## [cmake FetchContent](https://discourse.cmake.org/t/cmake-fetchcontent/7658)

<div class="topic-metadata">

**Author:** [@ashaheen](https://discourse.cmake.org/u/ashaheen)\
**Replies:** 1\
**Last updated:** [March 12, 2023, 7:36am UTC](https://discourse.cmake.org/t/cmake-fetchcontent/7658 "2023-03-12T07:36:28Z")

</div>

Hi, I am trying to use my private repo in CMakeFetch, but getting errors. Could someone help me with that. It works fine with googletests Here’s the sample cmake for cmake fetchContent include(FetchContent) FetchConte…

---

## [Machine readable output (non-trace)?](https://discourse.cmake.org/t/machine-readable-output-non-trace/7654)

<div class="topic-metadata">

**Author:** [@kfsone](https://discourse.cmake.org/u/kfsone)\
**Replies:** 2\
**Last updated:** [March 11, 2023, 9:35pm UTC](https://discourse.cmake.org/t/machine-readable-output-non-trace/7654 "2023-03-11T21:35:20Z")

</div>

–trace has the lovely --trace-format=json-v1. Is there something similar for regular cmake output? Having the cmake output in a structured, json form, would be super-useful for embedding cmake results in a larger struct…

---

## [\[Solved\] Problem with arm-none-eabi compiler variables on Windows](https://discourse.cmake.org/t/solved-problem-with-arm-none-eabi-compiler-variables-on-windows/7656)

<div class="topic-metadata">

**Author:** [@leoshusar](https://discourse.cmake.org/u/leoshusar)\
**Replies:** 0\
**Last updated:** [March 11, 2023, 3:03am UTC](https://discourse.cmake.org/t/solved-problem-with-arm-none-eabi-compiler-variables-on-windows/7656 "2023-03-11T03:03:09Z")

</div>

Hi! After several hours of trying to build blink with pico-sdk “the harder way :)” (mostly playing with CMake and learning), I am coming for help. I have setup VS 2022, CMake 3.25, ARM GNU toolchain, Ninja. So far so go…

---

## [Usage of ctest\_empty\_binary\_directory](https://discourse.cmake.org/t/usage-of-ctest-empty-binary-directory/7632)

<div class="topic-metadata">

**Author:** [@codeling](https://discourse.cmake.org/u/codeling)\
**Replies:** 1\
**Last updated:** [March 11, 2023, 1:03am UTC](https://discourse.cmake.org/t/usage-of-ctest-empty-binary-directory/7632 "2023-03-11T01:03:03Z")

</div>

We have our own CTest script runner. In that, I’m not sure how best to use ctest\_empty\_binary\_directory, and its interplay with ctest\_start. The bin folder seems to be created in ctest\_start; so it seems that ctest\_em…

---

## [Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please post that file on discourse.cmake.org.](https://discourse.cmake.org/t/your-cmakecache-txt-file-was-copied-to-copyofcmakecache-txt-please-post-that-file-on-discourse-cmake-org/7630)

<div class="topic-metadata">

**Author:** [@Jeslin](https://discourse.cmake.org/u/Jeslin)\
**Replies:** 3\
**Last updated:** [March 11, 2023, 12:58am UTC](https://discourse.cmake.org/t/your-cmakecache-txt-file-was-copied-to-copyofcmakecache-txt-please-post-that-file-on-discourse-cmake-org/7630 "2023-03-11T00:58:59Z")

</div>

I am getting below error. Please help me to resolve System is unknown to cmake, create: Platform/Windows to use this system, please post your config file on discourse.cmake.org so it can be added to cmake Your CMakeCa…

---

## [How to fix error: recompile with -fPIC](https://discourse.cmake.org/t/how-to-fix-error-recompile-with-fpic/7626)

<div class="topic-metadata">

**Author:** [@zhang-qiang-github](https://discourse.cmake.org/u/zhang-qiang-github)\
**Replies:** 1\
**Last updated:** [March 11, 2023, 12:57am UTC](https://discourse.cmake.org/t/how-to-fix-error-recompile-with-fpic/7626 "2023-03-11T00:57:24Z")

</div>

I am using cmake to build my project in linux. An error is reported: build\] \[ 0%\] Automatic MOC for target SUTKBaseCore \[build\] \[ 0%\] Built target SUTKBaseCore\_autogen \[build\] \[ 16%\] Linking CXX shared library libSUT…

---

## [What does find\_package in Config mode set?](https://discourse.cmake.org/t/what-does-find-package-in-config-mode-set/7611)

<div class="topic-metadata">

**Author:** [@ramcdona](https://discourse.cmake.org/u/ramcdona)\
**Replies:** 5\
**Last updated:** [March 10, 2023, 5:31am UTC](https://discourse.cmake.org/t/what-does-find-package-in-config-mode-set/7611 "2023-03-10T05:31:51Z")

</div>

Is there a way to get a list of all variables set by a call to find\_package? I find that in practice, find\_package is like a method with an undocumented interface. It does things, but you can’t know what it does. In m…

---

## [CMake cannot detect swift compiler in OS Ventura](https://discourse.cmake.org/t/cmake-cannot-detect-swift-compiler-in-os-ventura/7113)

<div class="topic-metadata">

**Author:** [@zohar81](https://discourse.cmake.org/u/zohar81)\
**Replies:** 2\
**Last updated:** [March 8, 2023, 6:16pm UTC](https://discourse.cmake.org/t/cmake-cannot-detect-swift-compiler-in-os-ventura/7113 "2023-03-08T18:16:07Z")

</div>

Hi, I’m working on macOS and have updated my OS version recently. when I try to build swift based library generated from cmake, I fail on the following line enable\_language(Swift) since the compiler couldn’t be found (…

---

## [FindCURL doesn't set CURL\_LIBRARIES and CURL\_INCLUDE\_DIRS](https://discourse.cmake.org/t/findcurl-doesnt-set-curl-libraries-and-curl-include-dirs/7619)

<div class="topic-metadata">

**Author:** [@etolga](https://discourse.cmake.org/u/etolga)\
**Replies:** 3\
**Last updated:** [March 8, 2023, 5:07pm UTC](https://discourse.cmake.org/t/findcurl-doesnt-set-curl-libraries-and-curl-include-dirs/7619 "2023-03-08T17:07:11Z")

</div>

I have build the libcurl from source with cmake and installed to /usr/local/ and I used find\_package(CURL 7.88.1 EXACT REQUIRED) in my project’s main CMakeLists.txt. It find CURL with 7.88.1 version, however, when I want…

---

## [NuGetTestProject license](https://discourse.cmake.org/t/nugettestproject-license/7631)

<div class="topic-metadata">

**Author:** [@Sophie\_W\_Lawrence](https://discourse.cmake.org/u/Sophie_W_Lawrence)\
**Replies:** 3\
**Last updated:** [March 8, 2023, 3:35pm UTC](https://discourse.cmake.org/t/nugettestproject-license/7631 "2023-03-08T15:35:40Z")

</div>

As the cmake project contains a sub-repository(NuGetTestProject) as part of its source. Could you please help confirm the license of this component ? https://github.com/Kitware/CMake/tree/master/Tests/RunCMake/VsNugetPa…

---

## [What does adding a module definition file via target\_sources do?](https://discourse.cmake.org/t/what-does-adding-a-module-definition-file-via-target-sources-do/7610)

<div class="topic-metadata">

**Author:** [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)\
**Replies:** 7\
**Last updated:** [March 8, 2023, 2:07am UTC](https://discourse.cmake.org/t/what-does-adding-a-module-definition-file-via-target-sources-do/7610 "2023-03-08T02:07:18Z")

</div>

I recently came across code like this: if(MSVC) target\_link\_options(foobar PRIVATE /DEF:${CMAKE\_CURRENT\_SOURCE\_DIR}/foobar.def ) elseif(MINGW) target\_sources(foobar PRIVATE ${CMAKE\_CURRENT\_S…

---

## [FetchContent ITK gives strange error (include): include called with wrong number of arguments.](https://discourse.cmake.org/t/fetchcontent-itk-gives-strange-error-include-include-called-with-wrong-number-of-arguments/7613)

<div class="topic-metadata">

**Author:** [@BlackCat\_Ruelle](https://discourse.cmake.org/u/BlackCat_Ruelle)\
**Replies:** 1\
**Last updated:** [March 7, 2023, 10:05pm UTC](https://discourse.cmake.org/t/fetchcontent-itk-gives-strange-error-include-include-called-with-wrong-number-of-arguments/7613 "2023-03-07T22:05:32Z")

</div>

Hi, I’m trying to use FetchContent to download ITK and build my project. But I got this string error: CMake Error at CMakeLists.txt:18 (include): include called with wrong number of arguments. include() only takes on…

---

## [building libtorrent with cmake](https://discourse.cmake.org/t/building-libtorrent-with-cmake/7602)

<div class="topic-metadata">

**Author:** [@a-sajjad72](https://discourse.cmake.org/u/a-sajjad72)\
**Replies:** 1\
**Last updated:** [March 7, 2023, 7:05pm UTC](https://discourse.cmake.org/t/building-libtorrent-with-cmake/7602 "2023-03-07T19:05:12Z")

</div>

i am building libtorrent with cmake, documentation here. i need help in specifying multiple build options. command i am using cmake -DCMAKE\_BUILD\_TYPE=Release -DCMAKE\_CXX\_STANDARD=14 -G Ninja .. Other build options …

---

## [Inquiring C++ standard from build target for analyzer config - possible regression, bug or missing documentation?](https://discourse.cmake.org/t/inquiring-c-standard-from-build-target-for-analyzer-config-possible-regression-bug-or-missing-documentation/7584)

<div class="topic-metadata">

**Author:** [@benedikt](https://discourse.cmake.org/u/benedikt)\
**Replies:** 8\
**Last updated:** [March 6, 2023, 8:32pm UTC](https://discourse.cmake.org/t/inquiring-c-standard-from-build-target-for-analyzer-config-possible-regression-bug-or-missing-documentation/7584 "2023-03-06T20:32:14Z")

</div>

Context We have some convenience functions to configure the code analyzers (cppcheck and clang-tidy) via the builtin cmake mechanisms (Properties CXX\_CLANG\_TIDY and CXX\_CPPCHECK). As we use this in multiple projects and …

---

## [Help with CPack for excluding some directories matching...but not all](https://discourse.cmake.org/t/help-with-cpack-for-excluding-some-directories-matching-but-not-all/7590)

<div class="topic-metadata">

**Author:** [@mathomp4](https://discourse.cmake.org/u/mathomp4)\
**Replies:** 2\
**Last updated:** [March 5, 2023, 4:51pm UTC](https://discourse.cmake.org/t/help-with-cpack-for-excluding-some-directories-matching-but-not-all/7590 "2023-03-05T16:51:31Z")

</div>

All, I need some help. I’ve already asked for CPack help here before, but I find I need more. Namely, I currently have this: set(CPACK\_SOURCE\_IGNORE\_FILES /.git/ /.mepo/ /build.\*/ /install.\*/ /CVS/ .\\\*.swp …

---

## [Linking the same library against two different targets](https://discourse.cmake.org/t/linking-the-same-library-against-two-different-targets/7597)

<div class="topic-metadata">

**Author:** [@MarijnStam](https://discourse.cmake.org/u/MarijnStam)\
**Replies:** 1\
**Last updated:** [March 4, 2023, 10:01pm UTC](https://discourse.cmake.org/t/linking-the-same-library-against-two-different-targets/7597 "2023-03-04T22:01:02Z")

</div>

Hello! I am working on a project on which a will be developing an application and bootloader for an embedded microcontroller. The project will be baremetal so no OS needs to be included. It is completely written in C. T…

---

## [Proposal-Figuring out cmake root file without setting it yourslf](https://discourse.cmake.org/t/proposal-figuring-out-cmake-root-file-without-setting-it-yourslf/7585)

<div class="topic-metadata">

**Author:** [@erezamihud](https://discourse.cmake.org/u/erezamihud)\
**Replies:** 2\
**Last updated:** [March 4, 2023, 9:02pm UTC](https://discourse.cmake.org/t/proposal-figuring-out-cmake-root-file-without-setting-it-yourslf/7585 "2023-03-04T21:02:56Z")

</div>

Hi, I have a project with nested projects, and some have peer dependency on each other and on other includes. F.e - cmake\_modules - Foo ----CmakeLists.txt #depends on cmake\_modules - Bar ----CmakeLists.txt #depends on …

---

## [CMake Error: The source directory does not appear to contain CMakeLists.txt.](https://discourse.cmake.org/t/cmake-error-the-source-directory-does-not-appear-to-contain-cmakelists-txt/7581)

<div class="topic-metadata">

**Author:** [@CNCG](https://discourse.cmake.org/u/CNCG)\
**Replies:** 5\
**Last updated:** [March 4, 2023, 6:23pm UTC](https://discourse.cmake.org/t/cmake-error-the-source-directory-does-not-appear-to-contain-cmakelists-txt/7581 "2023-03-04T18:23:41Z")

</div>

CMake Error: The source directory “C:/Development/wsbuild64” does not appear to contain CMakeLists.txt.

---

## [About LDLIBS etc.](https://discourse.cmake.org/t/about-ldlibs-etc/7558)

<div class="topic-metadata">

**Author:** [@ljh](https://discourse.cmake.org/u/ljh)\
**Replies:** 2\
**Last updated:** [March 3, 2023, 8:19am UTC](https://discourse.cmake.org/t/about-ldlibs-etc/7558 "2023-03-03T08:19:52Z")

</div>

Hi community, I wonder why CMake does not support these four settings directly: CPPFLAGS, CFLAGS, LDFLAGS, LDLIBS. I list their correspondings in CMake. I’m not sure if they are correct. CPPFLAGS: include\_directories…

---

## [Emulation the CMake 3.25 SYSTEM target and directory property](https://discourse.cmake.org/t/emulation-the-cmake-3-25-system-target-and-directory-property/7586)

<div class="topic-metadata">

**Author:** [@etiennemlb](https://discourse.cmake.org/u/etiennemlb)\
**Replies:** 0\
**Last updated:** [March 2, 2023, 10:15am UTC](https://discourse.cmake.org/t/emulation-the-cmake-3-25-system-target-and-directory-property/7586 "2023-03-02T10:15:12Z")

</div>

CMake 3.25 added the SYSTEM directory property one can add to add\_subdirectory() and FetchContent\_Declare and the SYSTEM target property. I use a library that has a conflicting compilation flag standard leading to a mu…

---

## [How to check file permissions with CMake?](https://discourse.cmake.org/t/how-to-check-file-permissions-with-cmake/7569)

<div class="topic-metadata">

**Author:** [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)\
**Replies:** 1\
**Last updated:** [March 1, 2023, 3:39pm UTC](https://discourse.cmake.org/t/how-to-check-file-permissions-with-cmake/7569 "2023-03-01T15:39:07Z")

</div>

Is there a way with CMake to check the permissions of a file? IE: Read/write/execute permissions?

---

## [Incompatible compatible number interface properties do not fail](https://discourse.cmake.org/t/incompatible-compatible-number-interface-properties-do-not-fail/7568)

<div class="topic-metadata">

**Author:** [@amaarten](https://discourse.cmake.org/u/amaarten)\
**Replies:** 1\
**Last updated:** [March 1, 2023, 12:53pm UTC](https://discourse.cmake.org/t/incompatible-compatible-number-interface-properties-do-not-fail/7568 "2023-03-01T12:53:30Z")

</div>

Hello! I’m trying to use Compatible Interface Properties to forbid people linking to 2 incompatible versions of my library. COMPATIBLE\_INTERFACE\_NUMBER\_MAX and COMPATIBLE\_INTERFACE\_NUMBER\_MIN look ideal for this. The …

---

## [make test failed](https://discourse.cmake.org/t/make-test-failed/7564)

<div class="topic-metadata">

**Author:** [@Gao\_Xiang](https://discourse.cmake.org/u/Gao_Xiang)\
**Replies:** 2\
**Last updated:** [March 1, 2023, 2:45am UTC](https://discourse.cmake.org/t/make-test-failed/7564 "2023-03-01T02:45:17Z")

</div>

I use the command to build the system, but I failed. make test -j8 The output is : 72% tests passed, 179 tests failed out of 649 452 - RunCMake.MaxRecursionDepth (Failed) 453 - RunCMake.add\_custom\_command (Fa…

---

## [FindLibXml2 finds local library when cross compiling](https://discourse.cmake.org/t/findlibxml2-finds-local-library-when-cross-compiling/7529)

<div class="topic-metadata">

**Author:** [@MarioKlebsch](https://discourse.cmake.org/u/MarioKlebsch)\
**Replies:** 4\
**Last updated:** [February 28, 2023, 1:56pm UTC](https://discourse.cmake.org/t/findlibxml2-finds-local-library-when-cross-compiling/7529 "2023-02-28T13:56:14Z")

</div>

I use FindLibXml2 in my CMakeLists.txt to detect wether libxml2 is available on the target system or wether it has to be built. include(FindLibXml2) add\_library(LibXml2 INTERFACE ) if (NOT LIBXML2\_FOUND) ... \<build l…

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

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