# Usage

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

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

**Page:** 60

---

## [FindZLIB fails starting with CMake 3.17](https://discourse.cmake.org/t/findzlib-fails-starting-with-cmake-3-17/6046)

<div class="topic-metadata">

**Author:** [@lhog](https://discourse.cmake.org/u/lhog)\
**Replies:** 4\
**Last updated:** [July 12, 2022, 12:00pm UTC](https://discourse.cmake.org/t/findzlib-fails-starting-with-cmake-3-17/6046 "2022-07-12T12:00:54Z")

</div>

Hi! I have a project where FindZLIB used to return correct ZLIB\_LIBRARY\_RELEASE on 3.16.x (zlib1.dll), however starting with 3.17.x and further I’m getting: CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modul…

---

## [cmake multi sub projects : problem with path of lib](https://discourse.cmake.org/t/cmake-multi-sub-projects-problem-with-path-of-lib/6021)

<div class="topic-metadata">

**Author:** [@mickae1](https://discourse.cmake.org/u/mickae1)\
**Replies:** 15\
**Last updated:** [July 12, 2022, 10:21am UTC](https://discourse.cmake.org/t/cmake-multi-sub-projects-problem-with-path-of-lib/6021 "2022-07-12T10:21:31Z")

</div>

Hi, I have a project with sub projects : ├── CMakeLists.txt ├── projects ├── libA │ ├── CMakeLists.txt │ ├── include │ │ └── libA │ │ └── my\_liba.h …

---

## [How to add a \`DEPENDS\` onto \`execute\_process\`](https://discourse.cmake.org/t/how-to-add-a-depends-onto-execute-process/6048)

<div class="topic-metadata">

**Author:** [@Barry\_Revzin](https://discourse.cmake.org/u/Barry_Revzin)\
**Replies:** 3\
**Last updated:** [July 11, 2022, 10:23pm UTC](https://discourse.cmake.org/t/how-to-add-a-depends-onto-execute-process/6048 "2022-07-11T22:23:31Z")

</div>

I have a build setup that involves doing something like: execute\_process( COMMAND python do\_some\_stuff.py --output moar\_build.cmake OUTPUT\_FILE moar\_build.cmake) include(moar\_build.cmake) Basically, I have this…

---

## [the -x c++ flag](https://discourse.cmake.org/t/the-x-c-flag/6043)

<div class="topic-metadata">

**Author:** [@MKR](https://discourse.cmake.org/u/MKR)\
**Replies:** 1\
**Last updated:** [July 11, 2022, 12:36pm UTC](https://discourse.cmake.org/t/the-x-c-flag/6043 "2022-07-11T12:36:24Z")

</div>

How can I pass the -x c++ flag to the compiler (clang++/g++) with cMake?

---

## [fatal error C1189: #error: STL1001: Unexpected compiler version, expected MSVC 19.29 or newer.](https://discourse.cmake.org/t/fatal-error-c1189-error-stl1001-unexpected-compiler-version-expected-msvc-19-29-or-newer/6031)

<div class="topic-metadata">

**Author:** [@snowuyl](https://discourse.cmake.org/u/snowuyl)\
**Replies:** 9\
**Last updated:** [July 11, 2022, 8:11am UTC](https://discourse.cmake.org/t/fatal-error-c1189-error-stl1001-unexpected-compiler-version-expected-msvc-19-29-or-newer/6031 "2022-07-11T08:11:30Z")

</div>

c: cd C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build vcvars64.bat vcvarsall.bat x64 -vcvars\_ver=14.29 d: git clone cd https://github.com/NordicSemiconductor/pc-ble-driver cd pc-ble-driv…

---

## [Wrong percentage status when building one of many targets](https://discourse.cmake.org/t/wrong-percentage-status-when-building-one-of-many-targets/2557)

<div class="topic-metadata">

**Author:** [@tgq](https://discourse.cmake.org/u/tgq)\
**Replies:** 5\
**Last updated:** [July 9, 2022, 1:18pm UTC](https://discourse.cmake.org/t/wrong-percentage-status-when-building-one-of-many-targets/2557 "2022-07-09T13:18:27Z")

</div>

Hello. There is this annoying problem, that when a package comes with a ton of targets (like llvm), invoking make on just a few targets makes the progress not show the actual percentage of built code, but looks more or l…

---

## [How can I change the output path and the output name of a compiler?](https://discourse.cmake.org/t/how-can-i-change-the-output-path-and-the-output-name-of-a-compiler/6011)

<div class="topic-metadata">

**Author:** [@MKR](https://discourse.cmake.org/u/MKR)\
**Replies:** 4\
**Last updated:** [July 9, 2022, 1:14pm UTC](https://discourse.cmake.org/t/how-can-i-change-the-output-path-and-the-output-name-of-a-compiler/6011 "2022-07-09T13:14:20Z")

</div>

I want to change the output path and the output name of the gcc-Compiler (the -o flag of the compiler) for a specific target. How can I do this?

---

## [Combining two projects](https://discourse.cmake.org/t/combining-two-projects/5988)

<div class="topic-metadata">

**Author:** [@alexanderzhirov](https://discourse.cmake.org/u/alexanderzhirov)\
**Replies:** 1\
**Last updated:** [July 9, 2022, 1:10pm UTC](https://discourse.cmake.org/t/combining-two-projects/5988 "2022-07-09T13:10:37Z")

</div>

There are two projects: FreeRDP and cFLTK (a C wrapper for the FLTK library). I am writing a GUI for FreeRDP and I want to combine my work with the FreeRDP source code project. My attempt at unification: I have separa…

---

## [How to properly get FINAL compile arguments for file/target?](https://discourse.cmake.org/t/how-to-properly-get-final-compile-arguments-for-file-target/5968)

<div class="topic-metadata">

**Author:** [@marstaik](https://discourse.cmake.org/u/marstaik)\
**Replies:** 7\
**Last updated:** [July 9, 2022, 1:07pm UTC](https://discourse.cmake.org/t/how-to-properly-get-final-compile-arguments-for-file-target/5968 "2022-07-09T13:07:34Z")

</div>

I have a custom clang-tool that generates additional headers for both my headers and source files when they contain certain information. I basically need to define a custom command for each source/header file in a targe…

---

## [CUSTOMBUILD : error : could not load cache on cmake \> 3.23.0](https://discourse.cmake.org/t/custombuild-error-could-not-load-cache-on-cmake-3-23-0/6026)

<div class="topic-metadata">

**Author:** [@kmilo9999](https://discourse.cmake.org/u/kmilo9999)\
**Replies:** 4\
**Last updated:** [July 9, 2022, 2:13am UTC](https://discourse.cmake.org/t/custombuild-error-could-not-load-cache-on-cmake-3-23-0/6026 "2022-07-09T02:13:18Z")

</div>

Hello, I have a CMakeList script that runs with cmake \<= 3.22.5. However, with \>= 3.23.0 it throws an error: Performing install step for 'Choreograph' CUSTOMBUILD : error : could not load cache\[F:\\MYPROJECT\\superbuil…

---

## [erroneous lines in generated VC Solution](https://discourse.cmake.org/t/erroneous-lines-in-generated-vc-solution/6032)

<div class="topic-metadata">

**Author:** [@KrisThielemans](https://discourse.cmake.org/u/KrisThielemans)\
**Replies:** 0\
**Last updated:** [July 8, 2022, 8:43am UTC](https://discourse.cmake.org/t/erroneous-lines-in-generated-vc-solution/6032 "2022-07-08T08:43:25Z")

</div>

The solution file generated by CMake from our project starts with some lines related to a path, probably from one of our dependencies, which generate errors in older VS versions, and warnings with VS 2019. sirf Microsof…

---

## [How do you evaluate a generator expression without the surrounding quotes?](https://discourse.cmake.org/t/how-do-you-evaluate-a-generator-expression-without-the-surrounding-quotes/6017)

<div class="topic-metadata">

**Author:** [@marstaik](https://discourse.cmake.org/u/marstaik)\
**Replies:** 2\
**Last updated:** [July 7, 2022, 5:15pm UTC](https://discourse.cmake.org/t/how-do-you-evaluate-a-generator-expression-without-the-surrounding-quotes/6017 "2022-07-07T17:15:29Z")

</div>

So this is probably a bit of a silly question, maybe? I’m not sure how to output the result of a generator expression without quotes… IE: add\_custom\_command( OUTPUT ${output\_file} COMMAND refl\_exe …

---

## [Can't figure out how to replicate std make command: file.x \> file.c \> file.o](https://discourse.cmake.org/t/cant-figure-out-how-to-replicate-std-make-command-file-x-file-c-file-o/5995)

<div class="topic-metadata">

**Author:** [@SurfskiDude](https://discourse.cmake.org/u/SurfskiDude)\
**Replies:** 1\
**Last updated:** [July 5, 2022, 11:50am UTC](https://discourse.cmake.org/t/cant-figure-out-how-to-replicate-std-make-command-file-x-file-c-file-o/5995 "2022-07-05T11:50:11Z")

</div>

I am trying to find a cmake way for a job that can be done as follows using standard make: file.x : file.c mygenerator file.x \> file.c file.c: file.o gcc -o file.o file.c

---

## [CMake can't find a package](https://discourse.cmake.org/t/cmake-cant-find-a-package/5974)

<div class="topic-metadata">

**Author:** [@mpasp](https://discourse.cmake.org/u/mpasp)\
**Replies:** 3\
**Last updated:** [July 2, 2022, 9:40pm UTC](https://discourse.cmake.org/t/cmake-cant-find-a-package/5974 "2022-07-02T21:40:42Z")

</div>

Basically i need to use deal.II but cmake doesn’t seems to find it. If I install dealii with ‘sudo apt install libdeal.ii-dev’ there are no problems and cmake can find it but i can’t use the -dev version for some bugs in…

---

## [cmake qt6: unresolved external symbol "public: virtual struct QMetaObject"](https://discourse.cmake.org/t/cmake-qt6-unresolved-external-symbol-public-virtual-struct-qmetaobject/5954)

<div class="topic-metadata">

**Author:** [@zhang-qiang-github](https://discourse.cmake.org/u/zhang-qiang-github)\
**Replies:** 13\
**Last updated:** [July 1, 2022, 5:37pm UTC](https://discourse.cmake.org/t/cmake-qt6-unresolved-external-symbol-public-virtual-struct-qmetaobject/5954 "2022-07-01T17:37:10Z")

</div>

I am building qt6 project with cmake. I want to generate a library with QWidget, and the code is: #ifndef GLOBAL\_EXPORTS #define GLOBAL\_EXPORT \_\_declspec(dllexport) #else #define GLOBAL\_EXPORT \_\_declspec(dllimport…

---

## [GCC cannot find dependent libraries when cross compiling](https://discourse.cmake.org/t/gcc-cannot-find-dependent-libraries-when-cross-compiling/5930)

<div class="topic-metadata">

**Author:** [@william](https://discourse.cmake.org/u/william)\
**Replies:** 2\
**Last updated:** [July 1, 2022, 11:30am UTC](https://discourse.cmake.org/t/gcc-cannot-find-dependent-libraries-when-cross-compiling/5930 "2022-07-01T11:30:05Z")

</div>

I’m cross compiling for armv7l linux on x86\_64 linux using the following setup: toolchain.cmake: set(CMAKE\_SYSTEM\_NAME Linux) set(CMAKE\_SYSTEM\_PROCESSOR arm) set(CMAKE\_C\_COMPILER arm-linux-gnueabihf-gcc) set(CMAKE\_CXX…

---

## [XCode project with localizable resources](https://discourse.cmake.org/t/xcode-project-with-localizable-resources/5960)

<div class="topic-metadata">

**Author:** [@andrey\_c](https://discourse.cmake.org/u/andrey_c)\
**Replies:** 1\
**Last updated:** [June 30, 2022, 11:48am UTC](https://discourse.cmake.org/t/xcode-project-with-localizable-resources/5960 "2022-06-30T11:48:23Z")

</div>

Hello. How can be added localized XCode resources via CMake? Examples from internet says use set\_source\_files\_properties(\<files...\> PROPERTIES MACOSX\_PACKAGE\_LOCATION Resources/\<lang\_id\>.lproj) But application termin…

---

## [Trying to build a flatpak fails with a cmake internal compiler test error.](https://discourse.cmake.org/t/trying-to-build-a-flatpak-fails-with-a-cmake-internal-compiler-test-error/5961)

<div class="topic-metadata">

**Author:** [@Lothar\_Scholz](https://discourse.cmake.org/u/Lothar_Scholz)\
**Replies:** 1\
**Last updated:** [June 29, 2022, 4:54pm UTC](https://discourse.cmake.org/t/trying-to-build-a-flatpak-fails-with-a-cmake-internal-compiler-test-error/5961 "2022-06-29T16:54:05Z")

</div>

Trying to build a flatpak makes cmake crash at the 2nd internal test. As far as i can see everything is right in the build sandbox. cc is redirecting to GNU C 12. But at the same time i have no real debugging available…

---

## [absolute path is record when generate package](https://discourse.cmake.org/t/absolute-path-is-record-when-generate-package/5953)

<div class="topic-metadata">

**Author:** [@zhang-qiang-github](https://discourse.cmake.org/u/zhang-qiang-github)\
**Replies:** 3\
**Last updated:** [June 28, 2022, 4:56pm UTC](https://discourse.cmake.org/t/absolute-path-is-record-when-generate-package/5953 "2022-06-28T16:56:30Z")

</div>

I want to generate myself package, and the generated package can be import by find\_package(). Everyhing is OK except a cude relative library. Let’s say I want to generate a Basic package. In the geberated Basic.cmake: …

---

## [Help getting started with Pico](https://discourse.cmake.org/t/help-getting-started-with-pico/5711)

<div class="topic-metadata">

**Author:** [@parrst](https://discourse.cmake.org/u/parrst)\
**Replies:** 14\
**Last updated:** [June 28, 2022, 3:55pm UTC](https://discourse.cmake.org/t/help-getting-started-with-pico/5711 "2022-06-28T15:55:12Z")

</div>

Brand new to the Pico, but supper excited to have something more powerful than an Arduino and not as big as a full fledged Pi. I have long stayed away from C due to the complexities of the compiling process. Well this is…

---

## [How to add option to the compiler?](https://discourse.cmake.org/t/how-to-add-option-to-the-compiler/5948)

<div class="topic-metadata">

**Author:** [@zhang-qiang-github](https://discourse.cmake.org/u/zhang-qiang-github)\
**Replies:** 3\
**Last updated:** [June 28, 2022, 5:39am UTC](https://discourse.cmake.org/t/how-to-add-option-to-the-compiler/5948 "2022-06-28T05:39:34Z")

</div>

I want to build a project uisng cmake+qt6. My CMakeLists.txt is: cmake\_minimum\_required(VERSION 3.15) project(qt\_cmake) set(CMAKE\_AUTOMOC ON) set(CMAKE\_AUTORCC ON) set(CMAKE\_AUTOUIC ON) set(CMAKE\_CXX\_STANDARD 17) set…

---

## [Xcode 13.4.1 error: Requested but did not find extension point with identifier Xcode.IDEKit.](https://discourse.cmake.org/t/xcode-13-4-1-error-requested-but-did-not-find-extension-point-with-identifier-xcode-idekit/5949)

<div class="topic-metadata">

**Author:** [@Karan\_Dixit](https://discourse.cmake.org/u/Karan_Dixit)\
**Replies:** 0\
**Last updated:** [June 28, 2022, 4:59am UTC](https://discourse.cmake.org/t/xcode-13-4-1-error-requested-but-did-not-find-extension-point-with-identifier-xcode-idekit/5949 "2022-06-28T04:59:55Z")

</div>

We are building an application that would be cross-platform and hence using CMake as the build system: Getting the below error when code signing is allowed using XCODE\_ATTRIBUTE\_CODE\_SIGNING\_ALLOWED “Yes” Command CodeSi…

---

## [Cannot find library header files when cross compiling](https://discourse.cmake.org/t/cannot-find-library-header-files-when-cross-compiling/5926)

<div class="topic-metadata">

**Author:** [@william](https://discourse.cmake.org/u/william)\
**Replies:** 3\
**Last updated:** [June 27, 2022, 5:58pm UTC](https://discourse.cmake.org/t/cannot-find-library-header-files-when-cross-compiling/5926 "2022-06-27T17:58:42Z")

</div>

I’m cross compiling for arm on Arch Linux host, but the cross compiler cannot find any library headers. CMakeLists.txt cmake\_minimum\_required(VERSION 3.13) project(cross-compile-demo C) find\_package(LibArchive REQUIRE…

---

## [Intel 2022.1 ifx compiler not recognized under windows 10](https://discourse.cmake.org/t/intel-2022-1-ifx-compiler-not-recognized-under-windows-10/5945)

<div class="topic-metadata">

**Author:** [@FROMAGMA](https://discourse.cmake.org/u/FROMAGMA)\
**Replies:** 3\
**Last updated:** [June 27, 2022, 3:10pm UTC](https://discourse.cmake.org/t/intel-2022-1-ifx-compiler-not-recognized-under-windows-10/5945 "2022-06-27T15:10:35Z")

</div>

Hi, Using cmake 3.22.2 or later and ninja 1.11.0 with Intel oneAPI 2022.1 we get with the following CMakeList.txt: cmake\_minimum\_required(VERSION 3.22.2) set ( CMAKE\_C\_COMPILER “C:/Program Files (x86)/Intel/oneAPI/com…

---

## [Is it possible to hide targets/commands when running \`cmake --build build --target help\`?](https://discourse.cmake.org/t/is-it-possible-to-hide-targets-commands-when-running-cmake-build-build-target-help/5936)

<div class="topic-metadata">

**Author:** [@dundargoc](https://discourse.cmake.org/u/dundargoc)\
**Replies:** 1\
**Last updated:** [June 25, 2022, 11:36pm UTC](https://discourse.cmake.org/t/is-it-possible-to-hide-targets-commands-when-running-cmake-build-build-target-help/5936 "2022-06-25T23:36:04Z")

</div>

I was wondering if there’s a way to hide certain targets and commands when running cmake --build build --target help or mark them as private somehow? A lot of the targets in my project are “internal only”, meaning that t…

---

## [Help with CMake, Intel MPI, and GNU Fortran](https://discourse.cmake.org/t/help-with-cmake-intel-mpi-and-gnu-fortran/377)

<div class="topic-metadata">

**Author:** [@mathomp4](https://discourse.cmake.org/u/mathomp4)\
**Replies:** 4\
**Last updated:** [June 25, 2022, 1:25am UTC](https://discourse.cmake.org/t/help-with-cmake-intel-mpi-and-gnu-fortran/377 "2022-06-25T01:25:09Z")

</div>

All, I’m hoping to get some help using Intel MPI with CMake, but with GNU Fortran as the compiler, not Intel Fortran (which works fine). For example, I have a code called mpiversion.F90 that isn’t very special: program…

---

## [How to specify a list of object in generation expression $\<TARGET\_OBJECTS:...\>](https://discourse.cmake.org/t/how-to-specify-a-list-of-object-in-generation-expression-target-objects/5908)

<div class="topic-metadata">

**Author:** [@krishna116](https://discourse.cmake.org/u/krishna116)\
**Replies:** 4\
**Last updated:** [June 24, 2022, 1:48pm UTC](https://discourse.cmake.org/t/how-to-specify-a-list-of-object-in-generation-expression-target-objects/5908 "2022-06-24T13:48:00Z")

</div>

I use cmake version 3.22.2 I have tried follow samples, all of them cannot work. add\_library(libFoo $\<TARGET\_OBJECTS: obj1 obj2 obj3\>) add\_library(libFoo $\<TARGET\_OBJECTS:obj1;obj2;obj3\>) add\_library(libFoo $\<TARGET\_OB…

---

## [Visual Studio 2019 - c++ is it possible to suppress function overloading](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893)

<div class="topic-metadata">

**Author:** [@michaelk1](https://discourse.cmake.org/u/michaelk1)\
**Replies:** 21\
**Last updated:** [June 24, 2022, 10:36am UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893 "2022-06-24T10:36:37Z")

</div>

Hi, is there a way to modify VS options to suppress function overloading, i.e. suppression of duplicate functions? thanks in advance cua michael

---

## [Is it an indented feature or a bug that OBJECT libraries does not propagate transient dependencies?](https://discourse.cmake.org/t/is-it-an-indented-feature-or-a-bug-that-object-libraries-does-not-propagate-transient-dependencies/5920)

<div class="topic-metadata">

**Author:** [@Anders\_Rein](https://discourse.cmake.org/u/Anders_Rein)\
**Replies:** 3\
**Last updated:** [June 23, 2022, 10:48pm UTC](https://discourse.cmake.org/t/is-it-an-indented-feature-or-a-bug-that-object-libraries-does-not-propagate-transient-dependencies/5920 "2022-06-23T22:48:46Z")

</div>

If I have a project with 3 different modules that depend on each other like this: mycorelib ← mylib ← myapp myapp is an executable. If I build mycorelib and mylib as STATIC libraries then everything works out fine. myl…

---

## [CMake GUI error on 'Open Project'](https://discourse.cmake.org/t/cmake-gui-error-on-open-project/5357)

<div class="topic-metadata">

**Author:** [@Gibtnix](https://discourse.cmake.org/u/Gibtnix)\
**Replies:** 2\
**Last updated:** [June 22, 2022, 3:47pm UTC](https://discourse.cmake.org/t/cmake-gui-error-on-open-project/5357 "2022-06-22T15:47:36Z")

</div>

Hello everyone, I noticed the following behavior of CMake on Windows in combination with Visual Studio: If I configure the project using the CMake GUI and use Configure/Generate to create a Visual Studio solution (\*.sln…

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

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