# Usage

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

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

**Page:** 67

---

## [Fully Understand the concept of target\_link\_libraries](https://discourse.cmake.org/t/fully-understand-the-concept-of-target-link-libraries/5062)

<div class="topic-metadata">

**Author:** [@two\_Two](https://discourse.cmake.org/u/two_Two)\
**Replies:** 1\
**Last updated:** [February 20, 2022, 2:13pm UTC](https://discourse.cmake.org/t/fully-understand-the-concept-of-target-link-libraries/5062 "2022-02-20T14:13:59Z")

</div>

I would like to fully understanding target\_link\_libraries .If I write target\_link\_libraries( A B C ) In this case A(shared),B(static),C(shared) are libraries. I wonder: 1.What would the terminal command be in Ubuntu i…

---

## [ld unable to find iostreams functions under MSYS2](https://discourse.cmake.org/t/ld-unable-to-find-iostreams-functions-under-msys2/2330)

<div class="topic-metadata">

**Author:** [@R030t1](https://discourse.cmake.org/u/R030t1)\
**Replies:** 13\
**Last updated:** [February 20, 2022, 1:42pm UTC](https://discourse.cmake.org/t/ld-unable-to-find-iostreams-functions-under-msys2/2330 "2022-02-20T13:42:10Z")

</div>

If I include iostreams I receive linking errors running under MSYS2 targeting x86\_64: cmake . -GNinja ninja ... undefined reference to std::ios\_base::Init, etc. If I try to use cout it fails to find those methods as w…

---

## [Could not find CMAKE\_ROOT !!!](https://discourse.cmake.org/t/could-not-find-cmake-root/5046)

<div class="topic-metadata">

**Author:** [@Parul\_Baranwal](https://discourse.cmake.org/u/Parul_Baranwal)\
**Replies:** 1\
**Last updated:** [February 17, 2022, 7:22pm UTC](https://discourse.cmake.org/t/could-not-find-cmake-root/5046 "2022-02-17T19:22:27Z")

</div>

I downloaded cmake using following command (base) pbaranw@enggpz1p23:~$ cmake\_version=3.22.2 (base) pbaranw@enggpz1p23:~$ wget https://github.com/Kitware/CMake/releases/download/v$cmake\_version/cmake-$cmake\_version.ta…

---

## [Is there a generic way to detect and reject underlinking?](https://discourse.cmake.org/t/is-there-a-generic-way-to-detect-and-reject-underlinking/5059)

<div class="topic-metadata">

**Author:** [@paterno](https://discourse.cmake.org/u/paterno)\
**Replies:** 1\
**Last updated:** [February 18, 2022, 9:58pm UTC](https://discourse.cmake.org/t/is-there-a-generic-way-to-detect-and-reject-underlinking/5059 "2022-02-18T21:58:34Z")

</div>

In many projects I use: set(LINKER\_OPTIONS "LINKER:-z,defs") to prevent underlinking. But this requires tests for what platform is being used (macOS does not recognize this flag, and doesn’t need it), and perhaps even …

---

## [CMake gets stuck during Build](https://discourse.cmake.org/t/cmake-gets-stuck-during-build/5047)

<div class="topic-metadata">

**Author:** [@mrmsdbdl](https://discourse.cmake.org/u/mrmsdbdl)\
**Replies:** 1\
**Last updated:** [February 18, 2022, 8:10am UTC](https://discourse.cmake.org/t/cmake-gets-stuck-during-build/5047 "2022-02-18T08:10:34Z")

</div>

I’m dealing with this strange situation that I cannot really wrap my head around! :tired\_face: So, I have a CMake scripts called Patch.cmake here that goes and modify some library paths of some of the libraries that I’m…

---

## [binary tree](https://discourse.cmake.org/t/binary-tree/5009)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.cmake.org/u/alice)\
**Replies:** 8\
**Last updated:** [February 17, 2022, 11:02am UTC](https://discourse.cmake.org/t/binary-tree/5009 "2022-02-17T11:02:22Z")

</div>

https://cmake.org/cmake/help/v3.23/manual/cmake.1.html#build-a-project What is the already-generated project binary tree? Here is the introduction for source tree and build tree https://cmake.org/cmake/help/v3.23/manu…

---

## [Transitivity and install( ... RUNTIME\_DEPENDENCIES ...)](https://discourse.cmake.org/t/transitivity-and-install-runtime-dependencies/5030)

<div class="topic-metadata">

**Author:** [@nasos](https://discourse.cmake.org/u/nasos)\
**Replies:** 4\
**Last updated:** [February 17, 2022, 9:29pm UTC](https://discourse.cmake.org/t/transitivity-and-install-runtime-dependencies/5030 "2022-02-17T21:29:35Z")

</div>

Hello, I am trying to understand how to use the RUNTIME\_DEPENDENCIES feature. Here I have a simple example that defines a SHARED library (dep), and then a library that uses it (mylib) and then an executable (myexe) tha…

---

## [cmake --install prefix not work](https://discourse.cmake.org/t/cmake-install-prefix-not-work/5040)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.cmake.org/u/alice)\
**Replies:** 3\
**Last updated:** [February 17, 2022, 8:30pm UTC](https://discourse.cmake.org/t/cmake-install-prefix-not-work/5040 "2022-02-17T20:30:12Z")

</div>

https://zlib.net/zlib-1.2.11.tar.gz I follow the steps to install the project and use the prefix in Install a Project step. But it doesnt change the install path. cd %project% # Generate a Project Buildsystem cmake -G …

---

## [Installed binary distribution for Linux aarch64 - but cannot execute binaries](https://discourse.cmake.org/t/installed-binary-distribution-for-linux-aarch64-but-cannot-execute-binaries/5037)

<div class="topic-metadata">

**Author:** [@tomoreilly](https://discourse.cmake.org/u/tomoreilly)\
**Replies:** 11\
**Last updated:** [February 17, 2022, 5:57pm UTC](https://discourse.cmake.org/t/installed-binary-distribution-for-linux-aarch64-but-cannot-execute-binaries/5037 "2022-02-17T17:57:16Z")

</div>

I’m running ubuntu-14.04 (yep, quite old). Architecture is aarch64: $ uname -m aarch64 I downloaded the binary installer script cmake-3.23.0-rc1-linux-aarch64.sh from the downloads page, and run that script. I can see…

---

## [Bad permissions (umask?) on CMakeFiles on Linux (with Ninja)](https://discourse.cmake.org/t/bad-permissions-umask-on-cmakefiles-on-linux-with-ninja/5041)

<div class="topic-metadata">

**Author:** [@emmenlau](https://discourse.cmake.org/u/emmenlau)\
**Replies:** 3\
**Last updated:** [February 17, 2022, 2:50pm UTC](https://discourse.cmake.org/t/bad-permissions-umask-on-cmakefiles-on-linux-with-ninja/5041 "2022-02-17T14:50:14Z")

</div>

We have a strange problem since about half a year, where cmake sometimes creates all \*.o files in the /CMakeFiles/ build folder with read-only permissions -r--r--r--. The problem is not fully reproducible, or at least we…

---

## [Issue Compiling Pynest2D Library for Cura](https://discourse.cmake.org/t/issue-compiling-pynest2d-library-for-cura/5021)

<div class="topic-metadata">

**Author:** [@ZachHowell](https://discourse.cmake.org/u/ZachHowell)\
**Replies:** 9\
**Last updated:** [February 17, 2022, 6:34am UTC](https://discourse.cmake.org/t/issue-compiling-pynest2d-library-for-cura/5021 "2022-02-17T06:34:16Z")

</div>

I am currently making my way through the library compilation detailed in the “Running Cura from Source on Windows” article on Ultimaker’s Cura Wiki. I seem to have hit a snag at Pynest2D. Since as a new user I cannot at…

---

## [find\_package config search order](https://discourse.cmake.org/t/find-package-config-search-order/5015)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 3\
**Last updated:** [February 16, 2022, 2:49pm UTC](https://discourse.cmake.org/t/find-package-config-search-order/5015 "2022-02-16T14:49:35Z")

</div>

CMake 3.10/Ubuntu 18.04 I’m looking for a custom OpenCV installation I set OpenCV\_DIR environment variable to the path to the OpenCV.cmake directory find\_package finds the default installed version (in /usr/something……

---

## [Can ctest be run on read only file system](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845)

<div class="topic-metadata">

**Author:** [@Haocheng\_Liu1](https://discourse.cmake.org/u/Haocheng_Liu1)\
**Replies:** 15\
**Last updated:** [February 15, 2022, 4:59pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845 "2022-02-15T16:59:17Z")

</div>

Hey, hope it finds you guys well. Recently we are trying to run ctest on read-only file system(kind of a sim farm) and it hits below error. Searching on the internet does not find any related topics. Wonder if it’s doab…

---

## [generate visual studio 2019 arch default](https://discourse.cmake.org/t/generate-visual-studio-2019-arch-default/5010)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.cmake.org/u/alice)\
**Replies:** 2\
**Last updated:** [February 15, 2022, 2:59pm UTC](https://discourse.cmake.org/t/generate-visual-studio-2019-arch-default/5010 "2022-02-15T14:59:04Z")

</div>

Q1 IMAGE Is the arch defaut 32bit-build ? Q2 The command line cmake -G "Visual Studio 16 2019" will generate a Visual Studio .sln file for a 32-bit build? If it is, should I command the cmake -G "Visual Studio …

---

## [generator Visual Studio 16 2019](https://discourse.cmake.org/t/generator-visual-studio-16-2019/5011)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.cmake.org/u/alice)\
**Replies:** 5\
**Last updated:** [February 15, 2022, 2:44pm UTC](https://discourse.cmake.org/t/generator-visual-studio-16-2019/5011 "2022-02-15T14:44:46Z")

</div>

I have a project and use the command to build it. mkdir build cd build cmake -G "ninja" ^ -DCMAKE\_INSTALL\_PREFIX=..\\release ^ -DCMAKE\_BUILD\_TYPE=Release ninja -j12 install Now I want to build it with Visual Studio …

---

## [VS2019 Compiler Identification is Unknown (Fresh Install VS2019 and CMAKE)](https://discourse.cmake.org/t/vs2019-compiler-identification-is-unknown-fresh-install-vs2019-and-cmake/2770)

<div class="topic-metadata">

**Author:** [@TomzBench](https://discourse.cmake.org/u/TomzBench)\
**Replies:** 8\
**Last updated:** [February 15, 2022, 6:56am UTC](https://discourse.cmake.org/t/vs2019-compiler-identification-is-unknown-fresh-install-vs2019-and-cmake/2770 "2022-02-15T06:56:27Z")

</div>

The C compiler identification could not be found in “C:/{snip}/CMakeFiles/3.19.5/CompilerIdC/CompilerIdC.exe” The C compiler identification could not be found in “C:/{snip}/CMakeFiles/3.19.5/CompilerIdC/CompilerIdC.vcxp…

---

## [Usage of CMAKE\_IMPORT\_FILE\_VERSION](https://discourse.cmake.org/t/usage-of-cmake-import-file-version/4982)

<div class="topic-metadata">

**Author:** [@Tachi](https://discourse.cmake.org/u/Tachi)\
**Replies:** 5\
**Last updated:** [February 14, 2022, 9:24pm UTC](https://discourse.cmake.org/t/usage-of-cmake-import-file-version/4982 "2022-02-14T21:24:44Z")

</div>

Hi everyone! First time here, so sorry if I’m posting this in the wrong section. I’m trying to implement generation of CMake exports in Meson, a build system that you may or may not know about. My goal is to be able to …

---

## [use custom file extension for zip cpack archive generator](https://discourse.cmake.org/t/use-custom-file-extension-for-zip-cpack-archive-generator/5004)

<div class="topic-metadata">

**Author:** [@hex](https://discourse.cmake.org/u/hex)\
**Replies:** 1\
**Last updated:** [February 14, 2022, 6:07pm UTC](https://discourse.cmake.org/t/use-custom-file-extension-for-zip-cpack-archive-generator/5004 "2022-02-14T18:07:58Z")

</div>

When using cpack the extension is determined from the archive format. My zip archives require a vendor specific file extension. It doesn’t seem like cpack supports this. Is this currently possible?

---

## [find\_package error: The following configuration files were considered but not accepted - what does it mean?](https://discourse.cmake.org/t/find-package-error-the-following-configuration-files-were-considered-but-not-accepted-what-does-it-mean/5003)

<div class="topic-metadata">

**Author:** [@Stefan\_Lang](https://discourse.cmake.org/u/Stefan_Lang)\
**Replies:** 3\
**Last updated:** [February 14, 2022, 6:07pm UTC](https://discourse.cmake.org/t/find-package-error-the-following-configuration-files-were-considered-but-not-accepted-what-does-it-mean/5003 "2022-02-14T18:07:32Z")

</div>

I’m trying to build some open source libs on Windows using cmake-gui and running into several cmake errors where find\_package does find a {package}-config.cmake file, but fails to accept it! I’m at a loss what to do now.…

---

## [Finding LibArchive on GitHub Action](https://discourse.cmake.org/t/finding-libarchive-on-github-action/4990)

<div class="topic-metadata">

**Author:** [@mrmsdbdl](https://discourse.cmake.org/u/mrmsdbdl)\
**Replies:** 2\
**Last updated:** [February 14, 2022, 3:07pm UTC](https://discourse.cmake.org/t/finding-libarchive-on-github-action/4990 "2022-02-14T15:07:05Z")

</div>

For some reason I cannot convince CMake to find LibArchive! On my local machine, I don’t have any problem but when I’m trying to setup the CI on Github, find\_package(LibArchive) just doesn’t work (even though I expect Xc…

---

## [Performance Profiling](https://discourse.cmake.org/t/performance-profiling/4913)

<div class="topic-metadata">

**Author:** [@Giorgi\_Didberidze](https://discourse.cmake.org/u/Giorgi_Didberidze)\
**Replies:** 2\
**Last updated:** [February 14, 2022, 2:06pm UTC](https://discourse.cmake.org/t/performance-profiling/4913 "2022-02-14T14:06:19Z")

</div>

Hello. I would like to know what profiling tools I should use in order to get the performance analysis of CMake project. The project is written in several languages, as a result there are several control files to inspect…

---

## [from CmakeCache.txt to CMakeLists.txt](https://discourse.cmake.org/t/from-cmakecache-txt-to-cmakelists-txt/4987)

<div class="topic-metadata">

**Author:** [@uma23](https://discourse.cmake.org/u/uma23)\
**Replies:** 1\
**Last updated:** [February 11, 2022, 10:16am UTC](https://discourse.cmake.org/t/from-cmakecache-txt-to-cmakelists-txt/4987 "2022-02-11T10:16:32Z")

</div>

Hi Team, I generated all the build files in the build directory and edited the options using ccmake gui on Ubuntu 20.04 system. How do I generate the CMakeLists file again from the build files in the build direcotry? c…

---

## [centos7.9, gcc/g++ 9.3.1, g++ main.cpp -o test ok, but cmake build faild, could anybody help me?](https://discourse.cmake.org/t/centos7-9-gcc-g-9-3-1-g-main-cpp-o-test-ok-but-cmake-build-faild-could-anybody-help-me/4975)

<div class="topic-metadata">

**Author:** [@chris-shenzhen-china](https://discourse.cmake.org/u/chris-shenzhen-china)\
**Replies:** 4\
**Last updated:** [February 8, 2022, 8:30am UTC](https://discourse.cmake.org/t/centos7-9-gcc-g-9-3-1-g-main-cpp-o-test-ok-but-cmake-build-faild-could-anybody-help-me/4975 "2022-02-08T08:30:03Z")

</div>

OS: centos7.9 gcc: 9.3.1 main.cpp: #include using namespace std; template \<typename KeyT, typename T\> class MyHash { public: MyHash() {} uint64\_t preHash(const KeyT& key) { return preHash(key, std::is\_integral\<K…

---

## [Cpack missing files, multiple target files](https://discourse.cmake.org/t/cpack-missing-files-multiple-target-files/4967)

<div class="topic-metadata">

**Author:** [@Pacific](https://discourse.cmake.org/u/Pacific)\
**Replies:** 4\
**Last updated:** [February 8, 2022, 7:49am UTC](https://discourse.cmake.org/t/cpack-missing-files-multiple-target-files/4967 "2022-02-08T07:49:31Z")

</div>

The project is built and installed to produce an api specific export target file which gets read in the exported config file. So to package multiple api support the project is built and installed multiple times with diff…

---

## [find\_package COMPONENTS with variable cmake list](https://discourse.cmake.org/t/find-package-components-with-variable-cmake-list/4971)

<div class="topic-metadata">

**Author:** [@rhodanos](https://discourse.cmake.org/u/rhodanos)\
**Replies:** 2\
**Last updated:** [February 7, 2022, 9:22pm UTC](https://discourse.cmake.org/t/find-package-components-with-variable-cmake-list/4971 "2022-02-07T21:22:47Z")

</div>

Hi everybody, I would like to define a basic find component system for all of my projects which has some default componet values set but may be edited by the user in cmake gui if the need arises. So far I thought I wou…

---

## [Installing CMake exports with CPack](https://discourse.cmake.org/t/installing-cmake-exports-with-cpack/4718)

<div class="topic-metadata">

**Author:** [@cerna](https://discourse.cmake.org/u/cerna)\
**Replies:** 1\
**Last updated:** [February 4, 2022, 8:59am UTC](https://discourse.cmake.org/t/installing-cmake-exports-with-cpack/4718 "2022-02-04T08:59:28Z")

</div>

Hello, I am facing a strange problem when trying to use CPack (dh\_cmake for Debian packaging) to install the CMake export scripts. I am not sure if I am doing something wrong or if this is bug or feature of CMake, but I…

---

## [Can CMake scripts run with -P return exit code other than zero?](https://discourse.cmake.org/t/can-cmake-scripts-run-with-p-return-exit-code-other-than-zero/4964)

<div class="topic-metadata">

**Author:** [@KentWilliams](https://discourse.cmake.org/u/KentWilliams)\
**Replies:** 1\
**Last updated:** [February 3, 2022, 9:08pm UTC](https://discourse.cmake.org/t/can-cmake-scripts-run-with-p-return-exit-code-other-than-zero/4964 "2022-02-03T21:08:40Z")

</div>

I use CMake scripting to accomplish various build tasks - the sort of things I’d use a shell script for in Unix. The problem is that sometimes running the script has an error, but as far as I can tell – and I’ve searche…

---

## [CMake FindPackage(Python) is not preferring Python3](https://discourse.cmake.org/t/cmake-findpackage-python-is-not-preferring-python3/4960)

<div class="topic-metadata">

**Author:** [@developer](https://discourse.cmake.org/u/developer)\
**Replies:** 2\
**Last updated:** [February 3, 2022, 7:35pm UTC](https://discourse.cmake.org/t/cmake-findpackage-python-is-not-preferring-python3/4960 "2022-02-03T19:35:59Z")

</div>

find\_package(Python3 COMPONENTS Interpreter REQUIRED) can find python3. However, when I used find\_package(Python COMPONENTS Interpreter REQUIRED), it defaults to use python2 instead of python3 like the documentation ind…

---

## [Using CMake to compile OCaml code](https://discourse.cmake.org/t/using-cmake-to-compile-ocaml-code/4955)

<div class="topic-metadata">

**Author:** [@prateek-khandelwal](https://discourse.cmake.org/u/prateek-khandelwal)\
**Replies:** 5\
**Last updated:** [February 3, 2022, 1:00pm UTC](https://discourse.cmake.org/t/using-cmake-to-compile-ocaml-code/4955 "2022-02-03T13:00:34Z")

</div>

BLOT: I would like to know how can I trigger generation / invocation of dynamic dependency extraction for Non-FORTRAN source projects ? I am interested in compiling OCaml sources using CMake + Ninja. I have come acro…

---

## [LibAtomic fails to safely land after failing to detect](https://discourse.cmake.org/t/libatomic-fails-to-safely-land-after-failing-to-detect/4927)

<div class="topic-metadata">

**Author:** [@SamuraiCrow](https://discourse.cmake.org/u/SamuraiCrow)\
**Replies:** 1\
**Last updated:** [February 3, 2022, 4:05am UTC](https://discourse.cmake.org/t/libatomic-fails-to-safely-land-after-failing-to-detect/4927 "2022-02-03T04:05:27Z")

</div>

I get cmake/modules/CheckAtomic.cmake:59 Host compiler appears to require libatomic, but cannot find it. I think this is either a bug in CMake or LLVM’s Linker. I’m using the WASI-SDK from here. This is while trying …

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

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