# Usage

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

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

**Page:** 84

---

## [compiling .s files](https://discourse.cmake.org/t/compiling-s-files/2681)

<div class="topic-metadata">

**Author:** [@deepan](https://discourse.cmake.org/u/deepan)\
**Replies:** 7\
**Last updated:** [February 4, 2021, 12:57pm UTC](https://discourse.cmake.org/t/compiling-s-files/2681 "2021-02-04T12:57:05Z")

</div>

I am working on an embedded project with windriver compiler The obj file(crt0.o) has the starting point(contains “main”) as per compiler design. In my project, we have written our own assemlbly file(crt0.s). now i wan…

---

## [CMAKE\_PREFIX\_PATH absent from locations considered for Config module](https://discourse.cmake.org/t/cmake-prefix-path-absent-from-locations-considered-for-config-module/2685)

<div class="topic-metadata">

**Author:** [@MathiasMagnus](https://discourse.cmake.org/u/MathiasMagnus)\
**Replies:** 4\
**Last updated:** [February 3, 2021, 8:53pm UTC](https://discourse.cmake.org/t/cmake-prefix-path-absent-from-locations-considered-for-config-module/2685 "2021-02-03T20:53:22Z")

</div>

While maintaining the OpenCL repository CMake and CI scripts I came across an issue I can’t untangle. When building one of the components (OpenCL-ICD-Loader) that relies on another (OpenCL-Headers) I first build the dep…

---

## [How to avoid linking to system libraries](https://discourse.cmake.org/t/how-to-avoid-linking-to-system-libraries/2581)

<div class="topic-metadata">

**Author:** [@nabw](https://discourse.cmake.org/u/nabw)\
**Replies:** 7\
**Last updated:** [February 2, 2021, 11:12pm UTC](https://discourse.cmake.org/t/how-to-avoid-linking-to-system-libraries/2581 "2021-02-02T23:12:23Z")

</div>

Hello everyone, first post! Anyway, I am configuring the deal.II library on a server, and there is a nasty linking issue (https://github.com/dealii/dealii/issues/11245). We have two Boost libraries, one in /lib64 and th…

---

## [Generate idential binaries with CMake and IAR workspace](https://discourse.cmake.org/t/generate-idential-binaries-with-cmake-and-iar-workspace/2603)

<div class="topic-metadata">

**Author:** [@mstejskal](https://discourse.cmake.org/u/mstejskal)\
**Replies:** 8\
**Last updated:** [February 2, 2021, 1:38pm UTC](https://discourse.cmake.org/t/generate-idential-binaries-with-cmake-and-iar-workspace/2603 "2021-02-02T13:38:28Z")

</div>

Hi all, bit background what I’m trying to achieve. We want migrate from IAR workspace build system to CMake build system to make our builds more flexible. We have to stick with IAR compiler, at least for now. Target is …

---

## [CMake cannot find ifconsol.lib](https://discourse.cmake.org/t/cmake-cannot-find-ifconsol-lib/2668)

<div class="topic-metadata">

**Author:** [@dariomangoni](https://discourse.cmake.org/u/dariomangoni)\
**Replies:** 8\
**Last updated:** [February 1, 2021, 10:16pm UTC](https://discourse.cmake.org/t/cmake-cannot-find-ifconsol-lib/2668 "2021-02-01T22:16:18Z")

</div>

Hi all, I’ve been trying for days in any possible way, but after the install of the new Intel oneApi HPC I’m not able to compile any Fortran (mixed C/Fortran) code from CMake. I’m launching CMake by command prompt afte…

---

## [Need to find/replace all #include with new path which doesn't fit with old path](https://discourse.cmake.org/t/need-to-find-replace-all-include-with-new-path-which-doesnt-fit-with-old-path/2661)

<div class="topic-metadata">

**Author:** [@al-sabr](https://discourse.cmake.org/u/al-sabr)\
**Replies:** 8\
**Last updated:** [February 1, 2021, 5:22pm UTC](https://discourse.cmake.org/t/need-to-find-replace-all-include-with-new-path-which-doesnt-fit-with-old-path/2661 "2021-02-01T17:22:20Z")

</div>

Hi I am having a problem… I took 2 external projects in another project which compile without any problem. The only problem in my code is that the old #include which are in thousands are not working anymore. I give an ex…

---

## [Cmake does not find "gio-2.0'"](https://discourse.cmake.org/t/cmake-does-not-find-gio-2-0/2551)

<div class="topic-metadata">

**Author:** [@colt](https://discourse.cmake.org/u/colt)\
**Replies:** 5\
**Last updated:** [January 30, 2021, 11:58pm UTC](https://discourse.cmake.org/t/cmake-does-not-find-gio-2-0/2551 "2021-01-30T23:58:54Z")

</div>

Hello. This time I am using cmake in another program and it cannot find three other packages. One of them it is: gio-2.0 I executed cmake . and it returned: – valac 0.30.0 found – Checking for modules ‘sqlite3\>=3.6.1…

---

## [when to use find modules?](https://discourse.cmake.org/t/when-to-use-find-modules/2655)

<div class="topic-metadata">

**Author:** [@hex](https://discourse.cmake.org/u/hex)\
**Replies:** 3\
**Last updated:** [January 29, 2021, 5:04pm UTC](https://discourse.cmake.org/t/when-to-use-find-modules/2655 "2021-01-29T17:04:09Z")

</div>

the responsibility for package modules and packages with configuration details are basically the same. Professional CMake has an additional chapter which describes the use of config files for Non-CMake projects. Doesn’t …

---

## [Passing UTF-16 strings from CPack to NSIS](https://discourse.cmake.org/t/passing-utf-16-strings-from-cpack-to-nsis/2646)

<div class="topic-metadata">

**Author:** [@baleboy](https://discourse.cmake.org/u/baleboy)\
**Replies:** 11\
**Last updated:** [January 29, 2021, 4:06am UTC](https://discourse.cmake.org/t/passing-utf-16-strings-from-cpack-to-nsis/2646 "2021-01-29T04:06:21Z")

</div>

Hello, I’m working with a project that uses the CPack NSIS generator. I would like to display the “registered trademark” (®) symbol in the installer text, but I haven’t been able to make it work. I added the character d…

---

## [Documentation issue : Policy CMP0077](https://discourse.cmake.org/t/documentation-issue-policy-cmp0077/2644)

<div class="topic-metadata">

**Author:** [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)\
**Replies:** 3\
**Last updated:** [January 28, 2021, 9:51pm UTC](https://discourse.cmake.org/t/documentation-issue-policy-cmp0077/2644 "2021-01-28T21:51:33Z")

</div>

When I read this policy I thought: “Does this policy of honoring normal variables only apply if the cache variable was created with option()? What if the variable is created using set like this?” set(FOOBAR 1 CACHE ST…

---

## [error: pathspec did not match any file(s) known to git](https://discourse.cmake.org/t/error-pathspec-did-not-match-any-file-s-known-to-git/2641)

<div class="topic-metadata">

**Author:** [@Gilfoyle](https://discourse.cmake.org/u/Gilfoyle)\
**Replies:** 2\
**Last updated:** [January 27, 2021, 8:27pm UTC](https://discourse.cmake.org/t/error-pathspec-did-not-match-any-file-s-known-to-git/2641 "2021-01-27T20:27:50Z")

</div>

I am receiving this error after changing SOURCE\_DIR in FetchContent\_Declare: error: pathspec did not match any file(s) known to git a minimal example: cmake\_minimum\_required( VERSION 3.16 ) project(MyProj VERSION 0 LA…

---

## [CMAKE\_INSTALL\_PREFIX in CPACK\_PRE\_BUILD\_SCRIPTS](https://discourse.cmake.org/t/cmake-install-prefix-in-cpack-pre-build-scripts/2631)

<div class="topic-metadata">

**Author:** [@floofy\_kh](https://discourse.cmake.org/u/floofy_kh)\
**Replies:** 4\
**Last updated:** [January 27, 2021, 8:42am UTC](https://discourse.cmake.org/t/cmake-install-prefix-in-cpack-pre-build-scripts/2631 "2021-01-27T08:42:59Z")

</div>

Hello, I’m trying to use CPACK\_PRE\_BUILD\_SCRIPTS to filter out certain files from the staging directory before CPack begins packaging. The use case for this is that we call on an external package manager executable to c…

---

## [libgcc\_s\_dw2-1.dll required even with the -static option (MinGW64\_9\_3 compiler)](https://discourse.cmake.org/t/libgcc-s-dw2-1-dll-required-even-with-the-static-option-mingw64-9-3-compiler/2640)

<div class="topic-metadata">

**Author:** [@grimgort](https://discourse.cmake.org/u/grimgort)\
**Replies:** 0\
**Last updated:** [January 27, 2021, 8:38am UTC](https://discourse.cmake.org/t/libgcc-s-dw2-1-dll-required-even-with-the-static-option-mingw64-9-3-compiler/2640 "2021-01-27T08:38:36Z")

</div>

Hello, I have a problem that I can’t solve. My executable still depends on the libgcc\_s\_dw2-1.dll dll whereas I want to have it static in the executable. I have 2 libs A and B in c, one lib C in fortran and I create an…

---

## [How to use Resource Files (.rc) in CMake?](https://discourse.cmake.org/t/how-to-use-resource-files-rc-in-cmake/2628)

<div class="topic-metadata">

**Author:** [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)\
**Replies:** 2\
**Last updated:** [January 26, 2021, 7:58pm UTC](https://discourse.cmake.org/t/how-to-use-resource-files-rc-in-cmake/2628 "2021-01-26T19:58:24Z")

</div>

I have added a resource file to my project like so: target\_sources(foobar PRIVATE foobar.rc) I’m able to successfully compile my project with Visual Studio. However, my Ninja build fails.

---

## [cmake failed to get the value of VCTargetsPath with VS2019 16.7](https://discourse.cmake.org/t/cmake-failed-to-get-the-value-of-vctargetspath-with-vs2019-16-7/1839)

<div class="topic-metadata">

**Author:** [@JuliusCaesar](https://discourse.cmake.org/u/JuliusCaesar)\
**Replies:** 16\
**Last updated:** [January 25, 2021, 4:26pm UTC](https://discourse.cmake.org/t/cmake-failed-to-get-the-value-of-vctargetspath-with-vs2019-16-7/1839 "2021-01-25T16:26:16Z")

</div>

Hey guys, I’m using the latest CMake Version fpr Windows 10 64 Bit (at the moment this is 3.18.2) and the latest VS2019 version (16.7.3) Now when i run the Cmake generator with the following cmd cmake -G Visual Studio…

---

## [Can't find ZLIB (missing: ZLIB\_LIBRARY) Ubuntu 20 CMake](https://discourse.cmake.org/t/cant-find-zlib-missing-zlib-library-ubuntu-20-cmake/2610)

<div class="topic-metadata">

**Author:** [@cubbins](https://discourse.cmake.org/u/cubbins)\
**Replies:** 2\
**Last updated:** [January 25, 2021, 3:33pm UTC](https://discourse.cmake.org/t/cant-find-zlib-missing-zlib-library-ubuntu-20-cmake/2610 "2021-01-25T15:33:30Z")

</div>

I am compiling github’s OpenROAD. Following the instructions. github clone cd OpenROAD mkdir build, and cmake … The cmake checks, proceeds and stops, with an error ‘Could NOT find ZLIB’ I have issued the command, w…

---

## [How to include a generated header without referencing the buidl directory manually?](https://discourse.cmake.org/t/how-to-include-a-generated-header-without-referencing-the-buidl-directory-manually/2573)

<div class="topic-metadata">

**Author:** [@MichaWiedenmann](https://discourse.cmake.org/u/MichaWiedenmann)\
**Replies:** 2\
**Last updated:** [January 25, 2021, 10:05am UTC](https://discourse.cmake.org/t/how-to-include-a-generated-header-without-referencing-the-buidl-directory-manually/2573 "2021-01-25T10:05:32Z")

</div>

I have a idl-file. During the build a header gets generated in the intermediate directory. How can I include this header in my source? Currently I am including the header with the path to the intermediate directory. Thi…

---

## [Include directories for target\_precompile\_headers](https://discourse.cmake.org/t/include-directories-for-target-precompile-headers/2607)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.cmake.org/u/pauljurczak)\
**Replies:** 2\
**Last updated:** [January 23, 2021, 6:23pm UTC](https://discourse.cmake.org/t/include-directories-for-target-precompile-headers/2607 "2021-01-23T18:23:24Z")

</div>

I have this CMakeLists.txt: cmake\_minimum\_required(VERSION 3.18) project(ocv VERSION 0.1.0) find\_package(fmt REQUIRED) find\_package(OpenCV REQUIRED) add\_executable(ocv main.cpp grid.cpp) include\_directories( /home/…

---

## [file(GET\_RUNTIME\_DEPENDENCIES) issues](https://discourse.cmake.org/t/file-get-runtime-dependencies-issues/2574)

<div class="topic-metadata">

**Author:** [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)\
**Replies:** 18\
**Last updated:** [January 22, 2021, 5:50pm UTC](https://discourse.cmake.org/t/file-get-runtime-dependencies-issues/2574 "2021-01-22T17:50:16Z")

</div>

EDITED: This thread has become more about issues/bugs with file(GET\_RUNTIME\_DEPENDENCIES) which is completely different than the intended topic. To not confuse future readers I’ve edited the issue.

---

## [Filtering symbols from WINDOWS\_EXPORT\_ALL\_SYMBOLS?](https://discourse.cmake.org/t/filtering-symbols-from-windows-export-all-symbols/2598)

<div class="topic-metadata">

**Author:** [@steven-johnson](https://discourse.cmake.org/u/steven-johnson)\
**Replies:** 8\
**Last updated:** [January 22, 2021, 5:20pm UTC](https://discourse.cmake.org/t/filtering-symbols-from-windows-export-all-symbols/2598 "2021-01-22T17:20:00Z")

</div>

When I build a shared library / DLL, I’d like to be able to selectively export only symbols that match certain pattern (e.g. the ‘public’ namespace for my library), excluding things that are internal, or brought in from …

---

## [problems following the CMake library & cross compiling tutorial](https://discourse.cmake.org/t/problems-following-the-cmake-library-cross-compiling-tutorial/2601)

<div class="topic-metadata">

**Author:** [@w461](https://discourse.cmake.org/u/w461)\
**Replies:** 3\
**Last updated:** [January 22, 2021, 3:22pm UTC](https://discourse.cmake.org/t/problems-following-the-cmake-library-cross-compiling-tutorial/2601 "2021-01-22T15:22:21Z")

</div>

Hi, I am tying to combine the CMake library tutorial and Cross Compiling (https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-or-watchos) with the Dart C interoperability tutor…

---

## [How to select NSIS on a non standard location](https://discourse.cmake.org/t/how-to-select-nsis-on-a-non-standard-location/2570)

<div class="topic-metadata">

**Author:** [@Mathieu\_Westphal](https://discourse.cmake.org/u/Mathieu_Westphal)\
**Replies:** 3\
**Last updated:** [January 22, 2021, 9:12am UTC](https://discourse.cmake.org/t/how-to-select-nsis-on-a-non-standard-location/2570 "2021-01-22T09:12:50Z")

</div>

I have a computer that need to run NSIS for packaging with cpack, however the NSIS installed version on the system is not complete and needs to be patched (by adding an include file) in order to support the needs of my p…

---

## [iMac Catalina and cmake-3.19.3](https://discourse.cmake.org/t/imac-catalina-and-cmake-3-19-3/2572)

<div class="topic-metadata">

**Author:** [@szukw000](https://discourse.cmake.org/u/szukw000)\
**Replies:** 2\
**Last updated:** [January 22, 2021, 12:10am UTC](https://discourse.cmake.org/t/imac-catalina-and-cmake-3-19-3/2572 "2021-01-22T00:10:59Z")

</div>

I have a project that uses fltk, libjpeg and libz. The cmake configuration file contains: cmake \\ -DCMAKE\_BUILD\_TYPE:string=“Release” \\ -DZLIB\_INCLUDE\_DIR:path=“/usr/local/include” \\ -DZLIB\_LIBRARY:path=“/usr/local…

---

## [Problem: Differences in detected default WindowsSDK on two different machines](https://discourse.cmake.org/t/problem-differences-in-detected-default-windowssdk-on-two-different-machines/2585)

<div class="topic-metadata">

**Author:** [@sophonet](https://discourse.cmake.org/u/sophonet)\
**Replies:** 6\
**Last updated:** [January 21, 2021, 5:51am UTC](https://discourse.cmake.org/t/problem-differences-in-detected-default-windowssdk-on-two-different-machines/2585 "2021-01-21T05:51:31Z")

</div>

Hi community, there is a strange behavior when running CMake with the Visual Studio 15 2017 Win64 generator on two different machines using the same version of Visual Studio 2017 and the same version of CMake (3.19.3): …

---

## [Can add\_custom\_target(\<name\> SOURCES file1 file2) be used with an fxc compile?](https://discourse.cmake.org/t/can-add-custom-target-name-sources-file1-file2-be-used-with-an-fxc-compile/2548)

<div class="topic-metadata">

**Author:** [@dudge](https://discourse.cmake.org/u/dudge)\
**Replies:** 2\
**Last updated:** [January 20, 2021, 2:55pm UTC](https://discourse.cmake.org/t/can-add-custom-target-name-sources-file1-file2-be-used-with-an-fxc-compile/2548 "2021-01-20T14:55:09Z")

</div>

Directory ${CMAKE\_SOURCE\_DIR}/shaders contains the two files VSFont.hlsl and PSFont.hlsl. This folder also contains a CMAKELists.txt file with these lines: set(VSSrcHLSL “VSFont.hlsl” “PSFont.hlsl”) add\_custom\_target(…

---

## [MinGW C compiler “not able to compile a simple test program”](https://discourse.cmake.org/t/mingw-c-compiler-not-able-to-compile-a-simple-test-program/388)

<div class="topic-metadata">

**Author:** [@jwuttke](https://discourse.cmake.org/u/jwuttke)\
**Replies:** 4\
**Last updated:** [January 20, 2021, 1:50pm UTC](https://discourse.cmake.org/t/mingw-c-compiler-not-able-to-compile-a-simple-test-program/388 "2021-01-20T13:50:56Z")

</div>

I want to run MinGW as a C compiler. MinGW has been installed from Chocolatey. Invocation is from gitlab-runner through CMake: cmake -G "MinGW Makefiles" -DCMAKE\_C\_COMPILER=x86\_64-w64-mingw32-gcc -B. .. This fails with …

---

## [CMake wrongly chooses multiarch architecture](https://discourse.cmake.org/t/cmake-wrongly-chooses-multiarch-architecture/2562)

<div class="topic-metadata">

**Author:** [@tgq](https://discourse.cmake.org/u/tgq)\
**Replies:** 1\
**Last updated:** [January 19, 2021, 7:45pm UTC](https://discourse.cmake.org/t/cmake-wrongly-chooses-multiarch-architecture/2562 "2021-01-19T19:45:07Z")

</div>

Hello. Despite the information in toolchain file, CMake chooses host libraries instead of the target ones. My toolchain looks like that: set(CMAKE\_SYSTEM\_NAME Linux) set(CMAKE\_SYSTEM\_PROCESSOR arm) set(triple arm-linux…

---

## [How do you find documentation of -j option](https://discourse.cmake.org/t/how-do-you-find-documentation-of-j-option/2561)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.cmake.org/u/pauljurczak)\
**Replies:** 5\
**Last updated:** [January 19, 2021, 7:43pm UTC](https://discourse.cmake.org/t/how-do-you-find-documentation-of-j-option/2561 "2021-01-19T19:43:54Z")

</div>

AFAIK, cmake --build -j . is a legal command, but I can’t find documentation for -j option. I tried: cmake --help | grep -- "-j" cmake --help-command build\_command | grep -- "-j" as well as searching for -j and option …

---

## [Cmake does not find Opengl during build](https://discourse.cmake.org/t/cmake-does-not-find-opengl-during-build/2517)

<div class="topic-metadata">

**Author:** [@colt](https://discourse.cmake.org/u/colt)\
**Replies:** 3\
**Last updated:** [January 19, 2021, 7:30pm UTC](https://discourse.cmake.org/t/cmake-does-not-find-opengl-during-build/2517 "2021-01-19T19:30:43Z")

</div>

Hello, I am trying to build a software using Cmake. I do so by typing cmake . The result it is: Normal Build Using X11 for Vulkan CMake Error at /home/leopoldo/Arquivos-de-Programas-Linux/Cmake-3.19.2-Linux-x86\_64/…

---

## [A problem with documentation of find\_package](https://discourse.cmake.org/t/a-problem-with-documentation-of-find-package/2550)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.cmake.org/u/pauljurczak)\
**Replies:** 3\
**Last updated:** [January 19, 2021, 7:29pm UTC](https://discourse.cmake.org/t/a-problem-with-documentation-of-find-package/2550 "2021-01-19T19:29:36Z")

</div>

I couldn’t find a documentation page specifying how to arrive from a module name, e.g. FindCUDAToolkit to the proper syntax of calling find\_package, i.e. find\_package(CUDAToolkit) in this case. I’m I missing something? I…

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

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