# Usage

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

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

**Page:** 96

---

## [Getting several undefined reference to \`boost::system::generic\_category()' errors](https://discourse.cmake.org/t/getting-several-undefined-reference-to-boost-generic-category-errors/761)

<div class="topic-metadata">

**Author:** [@johnratius](https://discourse.cmake.org/u/johnratius)\
**Replies:** 0\
**Last updated:** [March 3, 2020, 9:49pm UTC](https://discourse.cmake.org/t/getting-several-undefined-reference-to-boost-generic-category-errors/761 "2020-03-03T21:49:24Z")

</div>

I am trying to get this CMake file to run. I am using the CMake files from this git repo. It uses OpenFrameworks which uses a lot of libraries. The error I am getting is this: \[ 33%\] Linking CXX executable untitled2.ex…

---

## [c file is only compiled when it is used by add\_subdirectory](https://discourse.cmake.org/t/c-file-is-only-compiled-when-it-is-used-by-add-subdirectory/754)

<div class="topic-metadata">

**Author:** [@MichaWiedenmann](https://discourse.cmake.org/u/MichaWiedenmann)\
**Replies:** 2\
**Last updated:** [March 3, 2020, 2:22pm UTC](https://discourse.cmake.org/t/c-file-is-only-compiled-when-it-is-used-by-add-subdirectory/754 "2020-03-03T14:22:07Z")

</div>

I have a C++ project with a .c and .cpp file: # d:\\top\\sub\\CMakeLists.txt cmake\_minimum\_required(VERSION 3.16) project(foo CXX) add\_executable(foo WIN32 file1.cpp file2.c) when generating a vcxproj the .c file gets lis…

---

## [Question about the precompiled-header feature of CMake 3.16.x](https://discourse.cmake.org/t/question-about-the-precompiled-header-feature-of-cmake-3-16-x/682)

<div class="topic-metadata">

**Author:** [@mmoelle1](https://discourse.cmake.org/u/mmoelle1)\
**Replies:** 3\
**Last updated:** [February 29, 2020, 11:13pm UTC](https://discourse.cmake.org/t/question-about-the-precompiled-header-feature-of-cmake-3-16-x/682 "2020-02-29T23:13:28Z")

</div>

I started to use the precompiled-header feature introduced with Make 3.16.x (Thank you for this!) It all works fine when using it in the planned way. What I would like to achieve is to extract the compile instruction us…

---

## [cuda-memcheck as MEMORYCHECK\_COMMAND](https://discourse.cmake.org/t/cuda-memcheck-as-memorycheck-command/198)

<div class="topic-metadata">

**Author:** [@allen-barnett](https://discourse.cmake.org/u/allen-barnett)\
**Replies:** 5\
**Last updated:** [February 28, 2020, 9:50pm UTC](https://discourse.cmake.org/t/cuda-memcheck-as-memorycheck-command/198 "2020-02-28T21:50:23Z")

</div>

I tried setting MEMORYCHECK\_COMMAND to /usr/local/bin/cuda-memcheck, but “ctest -T memcheck” yielded this message: Do not understand memory checker: /usr/local/cuda/bin/cuda-memcheck Looking at the code, there are ind…

---

## [How does CMake parse and execute its lists and modules](https://discourse.cmake.org/t/how-does-cmake-parse-and-execute-its-lists-and-modules/734)

<div class="topic-metadata">

**Author:** [@satrapes](https://discourse.cmake.org/u/satrapes)\
**Replies:** 2\
**Last updated:** [February 28, 2020, 8:50pm UTC](https://discourse.cmake.org/t/how-does-cmake-parse-and-execute-its-lists-and-modules/734 "2020-02-28T20:50:59Z")

</div>

Hello, I am trying to understand how does CMake go through CMakeLists.txt files and .cmake files to produce the output in order to fix a bug in my cmake code. Can someone help?

---

## [target\_link\_directories for imported targets](https://discourse.cmake.org/t/target-link-directories-for-imported-targets/717)

<div class="topic-metadata">

**Author:** [@sghosh](https://discourse.cmake.org/u/sghosh)\
**Replies:** 1\
**Last updated:** [February 28, 2020, 8:46pm UTC](https://discourse.cmake.org/t/target-link-directories-for-imported-targets/717 "2020-02-28T20:46:38Z")

</div>

In my project I am using MAP\_IMPORTED\_CONFIG\_FINAL for an external library for a custom configuration FINAL . Is there some working example of how to set the target\_link\_directories for an imported target for the custom …

---

## [build issue with libmetal package](https://discourse.cmake.org/t/build-issue-with-libmetal-package/700)

<div class="topic-metadata">

**Author:** [@biswajit](https://discourse.cmake.org/u/biswajit)\
**Replies:** 1\
**Last updated:** [February 28, 2020, 8:33pm UTC](https://discourse.cmake.org/t/build-issue-with-libmetal-package/700 "2020-02-28T20:33:25Z")

</div>

Hi , I am trying to cross compile the libmetal\_v2\_0 package using cmake on linux. while building i am getting error like : error: ‘METAL\_MUTEX\_INIT’ undeclared (first use in this function); did you mean ‘METAL\_LOG\_IN…

---

## [how to remove substring/suffix using generator expressions](https://discourse.cmake.org/t/how-to-remove-substring-suffix-using-generator-expressions/701)

<div class="topic-metadata">

**Author:** [@mmoelle1](https://discourse.cmake.org/u/mmoelle1)\
**Replies:** 6\
**Last updated:** [February 28, 2020, 8:32pm UTC](https://discourse.cmake.org/t/how-to-remove-substring-suffix-using-generator-expressions/701 "2020-02-28T20:32:25Z")

</div>

Assume that I have the expression “/home/user/foo.bar” as the result of a generator-expression and I would like to remove the suffix “.bar”. In practice, the first expression is the full path to an object file and the se…

---

## [compile\_commands, great, why is there no link\_commands](https://discourse.cmake.org/t/compile-commands-great-why-is-there-no-link-commands/698)

<div class="topic-metadata">

**Author:** [@Lieven](https://discourse.cmake.org/u/Lieven)\
**Replies:** 2\
**Last updated:** [February 28, 2020, 8:16pm UTC](https://discourse.cmake.org/t/compile-commands-great-why-is-there-no-link-commands/698 "2020-02-28T20:16:43Z")

</div>

by specifying “CMAKE\_EXPORT\_COMPILE\_COMMANDS” one can obtain the json compilation database, which can be used for many aspects (tools, but also manual inspection to check with which options a certain file got compiled). …

---

## [alternative commands for windows](https://discourse.cmake.org/t/alternative-commands-for-windows/666)

<div class="topic-metadata">

**Author:** [@forbi\_11342](https://discourse.cmake.org/u/forbi_11342)\
**Replies:** 1\
**Last updated:** [February 28, 2020, 7:11pm UTC](https://discourse.cmake.org/t/alternative-commands-for-windows/666 "2020-02-28T19:11:42Z")

</div>

Hi, what would be the alternative of these commands $ cmake . $ make $ sudo make install for x86 Native Tools Command Prompt for VS 2019 ? cmake . works fine, but from the next I get the error that the command is …

---

## [CMakeTestCXXCompiler fail on GCC 9.2 under Ubuntu 18.04](https://discourse.cmake.org/t/cmaketestcxxcompiler-fail-on-gcc-9-2-under-ubuntu-18-04/725)

<div class="topic-metadata">

**Author:** [@MatthieuHernandez](https://discourse.cmake.org/u/MatthieuHernandez)\
**Replies:** 5\
**Last updated:** [February 28, 2020, 9:49am UTC](https://discourse.cmake.org/t/cmaketestcxxcompiler-fail-on-gcc-9-2-under-ubuntu-18-04/725 "2020-02-28T09:49:11Z")

</div>

I use wsl with Ubuntu 18.04. I upgraded my GCC from version 7 to version 9.2 and now I can no longer compile my project. I have this error message. I also upgraded my cmake version from 3.10 to 3.16.4 cmake -G"Unix Mak…

---

## [How to build a universal 32-bit cmake, like the pre-built one they provide for 64-bit?](https://discourse.cmake.org/t/how-to-build-a-universal-32-bit-cmake-like-the-pre-built-one-they-provide-for-64-bit/390)

<div class="topic-metadata">

**Author:** [@ztarem](https://discourse.cmake.org/u/ztarem)\
**Replies:** 9\
**Last updated:** [February 26, 2020, 4:45am UTC](https://discourse.cmake.org/t/how-to-build-a-universal-32-bit-cmake-like-the-pre-built-one-they-provide-for-64-bit/390 "2020-02-26T04:45:31Z")

</div>

Kitware provides cmake-XXX-Linux-x86\_64.sh, but no 32-bit equivalent. The cmake binary in their archive can run on any combination of 64-bit Linux OS and kernel that I am aware of. I need the same capability for 32-bit …

---

## [how to get the temporary install directory used by CPackDeb ?](https://discourse.cmake.org/t/how-to-get-the-temporary-install-directory-used-by-cpackdeb/692)

<div class="topic-metadata">

**Author:** [@Ubiquite](https://discourse.cmake.org/u/Ubiquite)\
**Replies:** 1\
**Last updated:** [February 24, 2020, 4:15pm UTC](https://discourse.cmake.org/t/how-to-get-the-temporary-install-directory-used-by-cpackdeb/692 "2020-02-24T16:15:06Z")

</div>

Hi all I need to run a command with install(CODE “…”) when generating my .deb with make package. For this command I need to know the path of the temporary install made by cpack. It seems to be in \_CPack\_Packages/Linux…

---

## [CMake Error at cmake/include/tools.cmake:420 (MESSAGE):](https://discourse.cmake.org/t/cmake-error-at-cmake-include-tools-cmake-420-message/690)

<div class="topic-metadata">

**Author:** [@Konstantin](https://discourse.cmake.org/u/Konstantin)\
**Replies:** 1\
**Last updated:** [February 24, 2020, 2:29pm UTC](https://discourse.cmake.org/t/cmake-error-at-cmake-include-tools-cmake-420-message/690 "2020-02-24T14:29:44Z")

</div>

Hello, Let me describe my problem briefly. I’m trying to build a project according to the instructions from here: I use these tools \[root@dr-npdexp01 ~\]# cmake --version cmake version 3.16.4 CMake suite maintain…

---

## [MSVC Flag /TP is set on a C target when added as a subdirectory](https://discourse.cmake.org/t/msvc-flag-tp-is-set-on-a-c-target-when-added-as-a-subdirectory/680)

<div class="topic-metadata">

**Author:** [@Cojosh](https://discourse.cmake.org/u/Cojosh)\
**Replies:** 2\
**Last updated:** [February 24, 2020, 2:28pm UTC](https://discourse.cmake.org/t/msvc-flag-tp-is-set-on-a-c-target-when-added-as-a-subdirectory/680 "2020-02-24T14:28:27Z")

</div>

Hi, I am currently unable to add a static c library (among other c++ targets) with add\_subdirectory as cmake seems to set /TP (c++ mode) causing the compile to fail, even when explicitly setting LANGUAGE and LINKER\_LANG…

---

## [Problem with findpackage(CURL REQUIRED) and precompiled curl 7.68.0 for Windows](https://discourse.cmake.org/t/problem-with-findpackage-curl-required-and-precompiled-curl-7-68-0-for-windows/686)

<div class="topic-metadata">

**Author:** [@Kerstin\_Keller](https://discourse.cmake.org/u/Kerstin_Keller)\
**Replies:** 3\
**Last updated:** [February 24, 2020, 10:41am UTC](https://discourse.cmake.org/t/problem-with-findpackage-curl-required-and-precompiled-curl-7-68-0-for-windows/686 "2020-02-24T10:41:43Z")

</div>

Hi, I am using CMake 3.16.3 and having problems with the provided FindCurl.cmake script. I have unzipped the precompiled version downloaded from the curl website in a given location and set both CMAKE\_PREFIX\_PATH and C…

---

## [use or build](https://discourse.cmake.org/t/use-or-build/675)

<div class="topic-metadata">

**Author:** [@Tomasz](https://discourse.cmake.org/u/Tomasz)\
**Replies:** 2\
**Last updated:** [February 23, 2020, 2:39pm UTC](https://discourse.cmake.org/t/use-or-build/675 "2020-02-23T14:39:02Z")

</div>

Hi I have lib installed in /usr/local/lib. I try to use it as package in other project. I create .cmake file and i put it in appropriate directory. Package was found by cmake but linker error occurred. Is a way in cmake…

---

## [Are the commands "cmake -build . --target package" and "cpack ." equivalent?](https://discourse.cmake.org/t/are-the-commands-cmake-build-target-package-and-cpack-equivalent/612)

<div class="topic-metadata">

**Author:** [@jwuttke](https://discourse.cmake.org/u/jwuttke)\
**Replies:** 6\
**Last updated:** [February 21, 2020, 3:08pm UTC](https://discourse.cmake.org/t/are-the-commands-cmake-build-target-package-and-cpack-equivalent/612 "2020-02-21T15:08:58Z")

</div>

Are the commands “cmake -build . --target package” and “cpack .” fully equivalent? If yes, why would one ever use the former? (One possible reason I know: Under Windows, cpack is ambiguous, as Chocolatey has an obsolet…

---

## [Definition of "main file" as used in cmake-generator-expressions(7)](https://discourse.cmake.org/t/definition-of-main-file-as-used-in-cmake-generator-expressions-7/649)

<div class="topic-metadata">

**Author:** [@jwuttke](https://discourse.cmake.org/u/jwuttke)\
**Replies:** 4\
**Last updated:** [February 20, 2020, 6:51am UTC](https://discourse.cmake.org/t/definition-of-main-file-as-used-in-cmake-generator-expressions-7/649 "2020-02-20T06:51:18Z")

</div>

Help page cmake-generator-expresions(7), section Target-Dependent Queries, depends heavily on the notion of a “main file”. What is meant by this?

---

## [Problem using CMake with a NTFS share](https://discourse.cmake.org/t/problem-using-cmake-with-a-ntfs-share/608)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 3\
**Last updated:** [February 18, 2020, 3:28pm UTC](https://discourse.cmake.org/t/problem-using-cmake-with-a-ntfs-share/608 "2020-02-18T15:28:01Z")

</div>

We have a CMake project that builds a C++ executable using Ninja on Linux (using gnu g++). It works fine when running entirely on the build machine’s local filesystem. However, some of our users want to store their pro…

---

## [Benefits of using target\_sources() on INTERFACE targets?](https://discourse.cmake.org/t/benefits-of-using-target-sources-on-interface-targets/648)

<div class="topic-metadata">

**Author:** [@KUGA2](https://discourse.cmake.org/u/KUGA2)\
**Replies:** 3\
**Last updated:** [February 18, 2020, 2:49pm UTC](https://discourse.cmake.org/t/benefits-of-using-target-sources-on-interface-targets/648 "2020-02-18T14:49:46Z")

</div>

Should I, and why should I add my headers to header only libraries? add\_library(headeronly INTERFACE) target\_include\_directories(headeronly "include") target\_sources(headeronly INTERFACE "include/header.h") The headers…

---

## [Unknow system error when using cmake-gui](https://discourse.cmake.org/t/unknow-system-error-when-using-cmake-gui/172)

<div class="topic-metadata">

**Author:** [@Rufus7](https://discourse.cmake.org/u/Rufus7)\
**Replies:** 2\
**Last updated:** [February 17, 2020, 11:27pm UTC](https://discourse.cmake.org/t/unknow-system-error-when-using-cmake-gui/172 "2020-02-17T23:27:47Z")

</div>

Few days ago, I used cmake to configure a package and it worked fine. But for some reason I need to uninstall this package and install it all over again. So I run these commands under /build: $sudo make uninstall $sudo…

---

## [On usage of ExternalData module](https://discourse.cmake.org/t/on-usage-of-externaldata-module/633)

<div class="topic-metadata">

**Author:** [@Adem\_Budak](https://discourse.cmake.org/u/Adem_Budak)\
**Replies:** 3\
**Last updated:** [February 16, 2020, 1:10am UTC](https://discourse.cmake.org/t/on-usage-of-externaldata-module/633 "2020-02-16T01:10:28Z")

</div>

Hi, I’m trying to fetch an archive file from the remote and want to put it on source directory at build time. So tried the following code: if(CHIP8\_DOWNLOAD\_ROMS) …

---

## [How cmake search custom system and language from specific directories?](https://discourse.cmake.org/t/how-cmake-search-custom-system-and-language-from-specific-directories/607)

<div class="topic-metadata">

**Author:** [@lijianzhong](https://discourse.cmake.org/u/lijianzhong)\
**Replies:** 1\
**Last updated:** [February 16, 2020, 12:57am UTC](https://discourse.cmake.org/t/how-cmake-search-custom-system-and-language-from-specific-directories/607 "2020-02-16T00:57:21Z")

</div>

Our project need to add some custom system and custom language support. But we don’t want to make change to cmake program. So if i put the languange extension in PROJECT\_ROOT/cmake/modules/ and PROJECT\_ROOT/cmake/modules…

---

## [cmake -E tar fails to create archive on Windows 10 with "CMake Error: archive\_write\_header: Can't record entry in tar file without pathname"](https://discourse.cmake.org/t/cmake-e-tar-fails-to-create-archive-on-windows-10-with-cmake-error-archive-write-header-cant-record-entry-in-tar-file-without-pathname/586)

<div class="topic-metadata">

**Author:** [@ivanonys](https://discourse.cmake.org/u/ivanonys)\
**Replies:** 1\
**Last updated:** [February 16, 2020, 12:48am UTC](https://discourse.cmake.org/t/cmake-e-tar-fails-to-create-archive-on-windows-10-with-cmake-error-archive-write-header-cant-record-entry-in-tar-file-without-pathname/586 "2020-02-16T00:48:50Z")

</div>

Hi, c:\\work\\test\_cmake\_tar\>cmake -E tar c out.tar – file.txt CMake Error: archive\_write\_header: Can’t record entry in tar file without pathname CMake Error: Problem creating tar: out.tar c:\\work\\test\_cmake\_tar\>type f…

---

## [Building v3.16.2 - Failures during make test?](https://discourse.cmake.org/t/building-v3-16-2-failures-during-make-test/477)

<div class="topic-metadata">

**Author:** [@AndyWharton](https://discourse.cmake.org/u/AndyWharton)\
**Replies:** 6\
**Last updated:** [February 16, 2020, 12:04am UTC](https://discourse.cmake.org/t/building-v3-16-2-failures-during-make-test/477 "2020-02-16T00:04:31Z")

</div>

I’m trying to build v3.16.2 from source, using: ./bootstrap --parallel=32 --prefix=~/local -- -DCMAKE\_BUILD\_TYPE:STRING=Release \\ && make -j32 \\ && make test \\ && make install But I’m seeing some failed tests… 99% tes…

---

## [Exclude build directories from cpack source package](https://discourse.cmake.org/t/exclude-build-directories-from-cpack-source-package/423)

<div class="topic-metadata">

**Author:** [@Acsor](https://discourse.cmake.org/u/Acsor)\
**Replies:** 1\
**Last updated:** [February 15, 2020, 11:58pm UTC](https://discourse.cmake.org/t/exclude-build-directories-from-cpack-source-package/423 "2020-02-15T23:58:17Z")

</div>

I have a basic CMake setup for a project whose sources I want to distribute as an archive. My current CPack config. is as follows include(InstallRequiredSystemLibraries) set(CPACK\_PACKAGE\_NAME bikaya) set(CPACK\_RESOURC…

---

## [CMake 3.13 Error Installation of a program](https://discourse.cmake.org/t/cmake-3-13-error-installation-of-a-program/425)

<div class="topic-metadata">

**Author:** [@LordCalvin](https://discourse.cmake.org/u/LordCalvin)\
**Replies:** 1\
**Last updated:** [February 15, 2020, 11:56pm UTC](https://discourse.cmake.org/t/cmake-3-13-error-installation-of-a-program/425 "2020-02-15T23:56:14Z")

</div>

Hi everybody, I have a question for a CMake related issue with installing a program. I use this command to install TensorRT with CMake: cmake .. -DTENSORRT\_ROOT=/usr/src/tensorrt/samples/python/yolov3\_onnx/onnx-tensor…

---

## [SPIR-V compiler custom\_command has unexpected execution order](https://discourse.cmake.org/t/spir-v-compiler-custom-command-has-unexpected-execution-order/353)

<div class="topic-metadata">

**Author:** [@Bodie](https://discourse.cmake.org/u/Bodie)\
**Replies:** 4\
**Last updated:** [February 15, 2020, 11:28pm UTC](https://discourse.cmake.org/t/spir-v-compiler-custom-command-has-unexpected-execution-order/353 "2020-02-15T23:28:56Z")

</div>

Hi all! First post. I’ve been using CMake with C++ for a while, but have avoided custom commands and targets until now. Here’s my CMakeLists.txt: https://paste.ubuntu.com/p/KTMTk473qm/ BackgroundI have a C++ library …

---

## [How to get pkg-config working inside cmake on appveyor-ci / win10 / msys](https://discourse.cmake.org/t/how-to-get-pkg-config-working-inside-cmake-on-appveyor-ci-win10-msys/324)

<div class="topic-metadata">

**Author:** [@shlomif](https://discourse.cmake.org/u/shlomif)\
**Replies:** 1\
**Last updated:** [February 15, 2020, 11:07pm UTC](https://discourse.cmake.org/t/how-to-get-pkg-config-working-inside-cmake-on-appveyor-ci-win10-msys/324 "2020-02-15T23:07:57Z")

</div>

I created a cmake-based installer and a mageia linux package for my rinutils library. Now when trying to get the bhs solver branch to find “librinutils.pc” it works fine in travis-ci but fails in appveyor where it uses M…

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

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