# Usage

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

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

**Page:** 69

---

## [CMake not being executed on first time make/ninja execution](https://discourse.cmake.org/t/cmake-not-being-executed-on-first-time-make-ninja-execution/4781)

<div class="topic-metadata">

**Author:** [@DKLind](https://discourse.cmake.org/u/DKLind)\
**Replies:** 1\
**Last updated:** [January 5, 2022, 8:24pm UTC](https://discourse.cmake.org/t/cmake-not-being-executed-on-first-time-make-ninja-execution/4781 "2022-01-05T20:24:08Z")

</div>

One thing I’ve taken for granted with using CMake is this. After cleaning a build directory and CMake is executed manually the first time, when make/ninja are executed, CMake is executed again automatically. This used to…

---

## [find\_library results in linker error](https://discourse.cmake.org/t/find-library-results-in-linker-error/4768)

<div class="topic-metadata">

**Author:** [@DjangoReinhard](https://discourse.cmake.org/u/DjangoReinhard)\
**Replies:** 4\
**Last updated:** [January 5, 2022, 4:02am UTC](https://discourse.cmake.org/t/find-library-results-in-linker-error/4768 "2022-01-05T04:02:30Z")

</div>

Hi, as a first step to use my external project I tried to do it manually like this: find\_library(LIB\_LC linuxcnc REQUIRED PATHS ${LinuxCNC\_DIR}/lib ) cmake-gui shows that the library was found (the expected absolute …

---

## [Custom Target Source Script](https://discourse.cmake.org/t/custom-target-source-script/4775)

<div class="topic-metadata">

**Author:** [@developer](https://discourse.cmake.org/u/developer)\
**Replies:** 1\
**Last updated:** [January 5, 2022, 2:22am UTC](https://discourse.cmake.org/t/custom-target-source-script/4775 "2022-01-05T02:22:19Z")

</div>

I would like to make a custom target which could build a local existing make based project. Something like find\_file(SetEnvFile NAME set-env.sh PATHS ${path-discovered-during-configuration}/\* REQUIRED ) add\_…

---

## [Linking using GCC goes wrong](https://discourse.cmake.org/t/linking-using-gcc-goes-wrong/4698)

<div class="topic-metadata">

**Author:** [@Olivier](https://discourse.cmake.org/u/Olivier)\
**Replies:** 3\
**Last updated:** [January 4, 2022, 9:52am UTC](https://discourse.cmake.org/t/linking-using-gcc-goes-wrong/4698 "2022-01-04T09:52:04Z")

</div>

Hello, I’m trying to cross compile a project from my windows machine to an ARM Linux one. This project already exists, I just set up a CMake structure in order to get the full control of my build system. The compilatio…

---

## [CMake linker show response files](https://discourse.cmake.org/t/cmake-linker-show-response-files/4411)

<div class="topic-metadata">

**Author:** [@KUGA2](https://discourse.cmake.org/u/KUGA2)\
**Replies:** 4\
**Last updated:** [January 3, 2022, 8:21pm UTC](https://discourse.cmake.org/t/cmake-linker-show-response-files/4411 "2022-01-03T20:21:45Z")

</div>

Hi, I have problems on my build, and I want to investigate the linker command. Sadly CMake automatically uses a temporary response file (\<target.rsp\>) for linking (at least on Windows VS2019). The file does not exist …

---

## [project setup with usage of external project](https://discourse.cmake.org/t/project-setup-with-usage-of-external-project/4766)

<div class="topic-metadata">

**Author:** [@Django1](https://discourse.cmake.org/u/Django1)\
**Replies:** 0\
**Last updated:** [January 3, 2022, 1:55pm UTC](https://discourse.cmake.org/t/project-setup-with-usage-of-external-project/4766 "2022-01-03T13:55:54Z")

</div>

Hi, my project consists of nearly 20 subprojects and all use the same Qt- and other packages and they use “that” external project. The external project is selfcompiled from github, but I don’t want to import build in…

---

## [find\_package does not find existing package](https://discourse.cmake.org/t/find-package-does-not-find-existing-package/4740)

<div class="topic-metadata">

**Author:** [@DjangoReinhard](https://discourse.cmake.org/u/DjangoReinhard)\
**Replies:** 13\
**Last updated:** [January 3, 2022, 7:41am UTC](https://discourse.cmake.org/t/find-package-does-not-find-existing-package/4740 "2022-01-03T07:41:17Z")

</div>

Hi, I wanted to migrate to cmake and I was very happy following successful the tutorial. But now with my project I’m in trouble. I wanted to manually write cmake files and not use generated stuff from qtcreator. I …

---

## [What is causing the error - Could NOT find HUNSPELL: Found unsuitable version ""](https://discourse.cmake.org/t/what-is-causing-the-error-could-not-find-hunspell-found-unsuitable-version/4646)

<div class="topic-metadata">

**Author:** [@decuser](https://discourse.cmake.org/u/decuser)\
**Replies:** 9\
**Last updated:** [January 2, 2022, 5:33pm UTC](https://discourse.cmake.org/t/what-is-causing-the-error-could-not-find-hunspell-found-unsuitable-version/4646 "2022-01-02T17:33:56Z")

</div>

The actual error message is: Could NOT find HUNSPELL: Found unsuitable version "", but required is at least "1.6" (found /usr/local/lib/libhunspell-1.6.dylib) From the message, it seems that the library is being foun…

---

## [CMake error at CMakeLists.txt:117(message): The C++ compiler does not support C++11(e.g.std:unique\_ptr)](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-117-message-the-c-compiler-does-not-support-c-11-e-g-std-unique-ptr/3774)

<div class="topic-metadata">

**Author:** [@Greenalien](https://discourse.cmake.org/u/Greenalien)\
**Replies:** 9\
**Last updated:** [December 24, 2021, 1:30pm UTC](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-117-message-the-c-compiler-does-not-support-c-11-e-g-std-unique-ptr/3774 "2021-12-24T13:30:17Z")

</div>

Ubuntu 18.04 LTS Cmake 3.19.4 Build failure - any help appreciated! Error log - Determining if compiler supports C++ make\_unique failed with the following output: Change Dir: /mnt/c/Users/john/pico/cmake-3.19.4/CMak…

---

## [Help needed with simple CMake project using GNU Arm Embedded Toolchain](https://discourse.cmake.org/t/help-needed-with-simple-cmake-project-using-gnu-arm-embedded-toolchain/4725)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 1\
**Last updated:** [December 21, 2021, 4:05pm UTC](https://discourse.cmake.org/t/help-needed-with-simple-cmake-project-using-gnu-arm-embedded-toolchain/4725 "2021-12-21T16:05:47Z")

</div>

Hi, I am using the GNU Arm Embedded Toolchain on Windows. I’m taking a simple gnu make project and converting it to CMake, but CMake fails at the ‘Check for working CXX compiler’ stage. The tools directory is: \>dir "C:…

---

## [use scp command send some file to another linux board](https://discourse.cmake.org/t/use-scp-command-send-some-file-to-another-linux-board/4703)

<div class="topic-metadata">

**Author:** [@lichunfei](https://discourse.cmake.org/u/lichunfei)\
**Replies:** 2\
**Last updated:** [December 22, 2021, 12:47am UTC](https://discourse.cmake.org/t/use-scp-command-send-some-file-to-another-linux-board/4703 "2021-12-22T00:47:14Z")

</div>

to generate makefile this function:make upload upload: scp filename orangepi@192.168.8.105:/home/orangepi/sgai how should I code my cmakefile? set(output “filename”) set(destination orangepi@192.168.8.105:/home/or…

---

## [How to extract library into its own CMake project](https://discourse.cmake.org/t/how-to-extract-library-into-its-own-cmake-project/4721)

<div class="topic-metadata">

**Author:** [@poseid](https://discourse.cmake.org/u/poseid)\
**Replies:** 1\
**Last updated:** [December 21, 2021, 12:28pm UTC](https://discourse.cmake.org/t/how-to-extract-library-into-its-own-cmake-project/4721 "2021-12-21T12:28:54Z")

</div>

Hello, i have a CMake project which builds among other things a shared library foo.so / foo.dll Where can I find an example how to extract a part of this projects into its own standalone CMake project? What would be t…

---

## [Plain and keyword signature](https://discourse.cmake.org/t/plain-and-keyword-signature/4720)

<div class="topic-metadata">

**Author:** [@s0n1c](https://discourse.cmake.org/u/s0n1c)\
**Replies:** 1\
**Last updated:** [December 20, 2021, 1:50pm UTC](https://discourse.cmake.org/t/plain-and-keyword-signature/4720 "2021-12-20T13:50:30Z")

</div>

Hello everyone, by now I thought to get along with CMake pretty good but there are still some things I am doing wrong. When using it in my current project it gives the error message: CMake Error at CMakeLists.txt:63 (t…

---

## [cmake how to use scp command to transport bin file to another linux board](https://discourse.cmake.org/t/cmake-how-to-use-scp-command-to-transport-bin-file-to-another-linux-board/4690)

<div class="topic-metadata">

**Author:** [@lichunfei](https://discourse.cmake.org/u/lichunfei)\
**Replies:** 9\
**Last updated:** [December 20, 2021, 1:33am UTC](https://discourse.cmake.org/t/cmake-how-to-use-scp-command-to-transport-bin-file-to-another-linux-board/4690 "2021-12-20T01:33:32Z")

</div>

how to use cmake file generated makefile scp conmand? makefile like this upload: scp $(TARGET) orangepi@192.168.8.105:/home/orangepi/sgai

---

## [CMake -C vs --preset](https://discourse.cmake.org/t/cmake-c-vs-preset/4616)

<div class="topic-metadata">

**Author:** [@developer](https://discourse.cmake.org/u/developer)\
**Replies:** 2\
**Last updated:** [December 17, 2021, 7:12pm UTC](https://discourse.cmake.org/t/cmake-c-vs-preset/4616 "2021-12-17T19:12:06Z")

</div>

What is the different between the -C (“Pre-load a script to populate the cache.”) and --preset (CMakePresets.json)? It looks like cmake-presets has more options beyond just adjusting the cache like the -C option. Shoul…

---

## [.so files in CMakeList](https://discourse.cmake.org/t/so-files-in-cmakelist/4695)

<div class="topic-metadata">

**Author:** [@s0n1c](https://discourse.cmake.org/u/s0n1c)\
**Replies:** 1\
**Last updated:** [December 17, 2021, 1:23pm UTC](https://discourse.cmake.org/t/so-files-in-cmakelist/4695 "2021-12-17T13:23:17Z")

</div>

Hello everyone, currently I am struggling with .so files. I have a file called folder/myLib.so and need to link it in the CMakeList.txt. Does anyone know how to do this? I am pretty new to this. Regards s0n1c

---

## [Calling conda from within CMake](https://discourse.cmake.org/t/calling-conda-from-within-cmake/4627)

<div class="topic-metadata">

**Author:** [@Nicholaswogan](https://discourse.cmake.org/u/Nicholaswogan)\
**Replies:** 2\
**Last updated:** [December 17, 2021, 7:50am UTC](https://discourse.cmake.org/t/calling-conda-from-within-cmake/4627 "2021-12-17T07:50:44Z")

</div>

I’m putting together a project with depends on pybind11, xtensor, and xtensor-python. The easiest way to download all these packages is with conda install xtensor-python. Would it be reasonable to call conda from cmake l…

---

## [How to limit depth of generated .dot files with --graphviz option](https://discourse.cmake.org/t/how-to-limit-depth-of-generated-dot-files-with-graphviz-option/4621)

<div class="topic-metadata">

**Author:** [@ian.gralinski.inv](https://discourse.cmake.org/u/ian.gralinski.inv)\
**Replies:** 2\
**Last updated:** [December 16, 2021, 2:53am UTC](https://discourse.cmake.org/t/how-to-limit-depth-of-generated-dot-files-with-graphviz-option/4621 "2021-12-16T02:53:47Z")

</div>

Is there a way to specify a maximum depth of graphs when creating graphviz output? Something like cmake --graphviz=graph.dot --max-depth=5 that would only output nodes that are a maximum of 5 edges away?

---

## [When running make I get an error](https://discourse.cmake.org/t/when-running-make-i-get-an-error/4673)

<div class="topic-metadata">

**Author:** [@greendragon](https://discourse.cmake.org/u/greendragon)\
**Replies:** 10\
**Last updated:** [December 15, 2021, 7:21pm UTC](https://discourse.cmake.org/t/when-running-make-i-get-an-error/4673 "2021-12-15T19:21:07Z")

</div>

No rule to make target ‘/usr/lib/x86\_64-linux-gnu/libSDL2\_image.so’, needed by ‘SDL2Test’. Stop. CMakeFiles/Makefile2:72: recipe for target ‘CMakeFiles/SDL2Test.dir/all’ failed make\[1\]: \*\*\* \[CMakeFiles/SDL2Test.dir/all…

---

## [How do I use the --prefix argument in cmake --install?](https://discourse.cmake.org/t/how-do-i-use-the-prefix-argument-in-cmake-install/4671)

<div class="topic-metadata">

**Author:** [@MrZoraman](https://discourse.cmake.org/u/MrZoraman)\
**Replies:** 6\
**Last updated:** [December 15, 2021, 5:46pm UTC](https://discourse.cmake.org/t/how-do-i-use-the-prefix-argument-in-cmake-install/4671 "2021-12-15T17:46:57Z")

</div>

My command is cmake --install . --prefix somewhereelse. I’m trying to get cmake to install a project in a custom directory instead of my program files folder. No matter what, though, it always puts it in my program files…

---

## [cmake project() requirement](https://discourse.cmake.org/t/cmake-project-requirement/4663)

<div class="topic-metadata">

**Author:** [@fry](https://discourse.cmake.org/u/fry)\
**Replies:** 8\
**Last updated:** [December 15, 2021, 3:07pm UTC](https://discourse.cmake.org/t/cmake-project-requirement/4663 "2021-12-15T15:07:52Z")

</div>

I created a framework to build audio plugins and in order for the build to work there are some variables that needs to be defined BEFORE calling project(). So right now, the users of my framework must write something lik…

---

## [add\_custom\_command with generator config commands](https://discourse.cmake.org/t/add-custom-command-with-generator-config-commands/4662)

<div class="topic-metadata">

**Author:** [@scottaronbloom](https://discourse.cmake.org/u/scottaronbloom)\
**Replies:** 15\
**Last updated:** [December 15, 2021, 2:26am UTC](https://discourse.cmake.org/t/add-custom-command-with-generator-config-commands/4662 "2021-12-15T02:26:19Z")

</div>

I am trying to copy a pdb file on windows as part of a add\_custom\_commad Since it only is generated in RelWithDebInfo and Debug my command looks like the following COMMAND $\<$\<OR:$\<CONFIG:Debug\>,$\<CONFIG:RelWithDebInfo\>…

---

## [CPack WIX generator does not create start menu shortcuts](https://discourse.cmake.org/t/cpack-wix-generator-does-not-create-start-menu-shortcuts/4656)

<div class="topic-metadata">

**Author:** [@hsattler](https://discourse.cmake.org/u/hsattler)\
**Replies:** 1\
**Last updated:** [December 14, 2021, 1:13pm UTC](https://discourse.cmake.org/t/cpack-wix-generator-does-not-create-start-menu-shortcuts/4656 "2021-12-14T13:13:43Z")

</div>

Hi, I tried for some time now but I simply cannot convince CPack’s WIX generator to add start menu shortcuts. According to documenation, all it should need is: set\_property ( INSTALL "$\<TARGET\_FILE\_NAME:MyExe\>" …

---

## [Generating Visual Studio Projects for previous VS versions](https://discourse.cmake.org/t/generating-visual-studio-projects-for-previous-vs-versions/4639)

<div class="topic-metadata">

**Author:** [@Steven\_White](https://discourse.cmake.org/u/Steven_White)\
**Replies:** 2\
**Last updated:** [December 13, 2021, 8:35pm UTC](https://discourse.cmake.org/t/generating-visual-studio-projects-for-previous-vs-versions/4639 "2021-12-13T20:35:32Z")

</div>

Is it possible to generate a msvc 16 or 15 project with only msvc 17 installed? So, when I installed 2022 I decided to remove my old IDE installs and just install the the compilers as packages to 2022 instead of having …

---

## [Can't link shared library in cmake due to image not found](https://discourse.cmake.org/t/cant-link-shared-library-in-cmake-due-to-image-not-found/4648)

<div class="topic-metadata">

**Author:** [@GatCode](https://discourse.cmake.org/u/GatCode)\
**Replies:** 1\
**Last updated:** [December 13, 2021, 1:23pm UTC](https://discourse.cmake.org/t/cant-link-shared-library-in-cmake-due-to-image-not-found/4648 "2021-12-13T13:23:50Z")

</div>

Hello, I’ve already posted my question on stackoverflow but it seems that it’s not getting a lot of attention. Nevertheless, I am trying to include a bazel built shared library in my cmake project. I was able to find th…

---

## [Generated Xcode project uses "-F" instead of "-iframework" for Qt](https://discourse.cmake.org/t/generated-xcode-project-uses-f-instead-of-iframework-for-qt/4635)

<div class="topic-metadata">

**Author:** [@dgermann](https://discourse.cmake.org/u/dgermann)\
**Replies:** 3\
**Last updated:** [December 13, 2021, 1:20pm UTC](https://discourse.cmake.org/t/generated-xcode-project-uses-f-instead-of-iframework-for-qt/4635 "2021-12-13T13:20:10Z")

</div>

Hello We have a C++ project that uses Qt and we are in the process of switching from make/qmake to CMake as our build tool. Development is on macOS. When we use CMake to generate an Xcode project and then build the proj…

---

## [Current directory during link step?](https://discourse.cmake.org/t/current-directory-during-link-step/4608)

<div class="topic-metadata">

**Author:** [@PlatonCM](https://discourse.cmake.org/u/PlatonCM)\
**Replies:** 2\
**Last updated:** [December 13, 2021, 5:44am UTC](https://discourse.cmake.org/t/current-directory-during-link-step/4608 "2021-12-13T05:44:24Z")

</div>

I’m having cross-crompiling issues with the armcc/armlink toolchain when I run armlink with our scatter file. The scatter file includes a header file from a relative path (has to work on developer machines and it works w…

---

## [Python3\_add\_library should get defined even if libpython not present](https://discourse.cmake.org/t/python3-add-library-should-get-defined-even-if-libpython-not-present/4640)

<div class="topic-metadata">

**Author:** [@Catherine\_Holloway](https://discourse.cmake.org/u/Catherine_Holloway)\
**Replies:** 5\
**Last updated:** [December 10, 2021, 6:33pm UTC](https://discourse.cmake.org/t/python3-add-library-should-get-defined-even-if-libpython-not-present/4640 "2021-12-10T18:33:00Z")

</div>

Python3\_add\_library doesn’t get defined unless the “Development” component is requested in find\_package, but “Development” will fail to be defined if libpython\*.so is not present. For example, the manylinux project docke…

---

## [find\_package() not working from a subdirectory](https://discourse.cmake.org/t/find-package-not-working-from-a-subdirectory/4632)

<div class="topic-metadata">

**Author:** [@mscofield0](https://discourse.cmake.org/u/mscofield0)\
**Replies:** 1\
**Last updated:** [December 10, 2021, 12:05am UTC](https://discourse.cmake.org/t/find-package-not-working-from-a-subdirectory/4632 "2021-12-10T00:05:08Z")

</div>

Why is that the case? Why does it need to be in the root CMakeLists.txt?

---

## [Shell compound commands in add\_custom\_command() possible?](https://discourse.cmake.org/t/shell-compound-commands-in-add-custom-command-possible/4623)

<div class="topic-metadata">

**Author:** [@ingolf](https://discourse.cmake.org/u/ingolf)\
**Replies:** 2\
**Last updated:** [December 8, 2021, 10:13am UTC](https://discourse.cmake.org/t/shell-compound-commands-in-add-custom-command-possible/4623 "2021-12-08T10:13:10Z")

</div>

Hi, is it possible to use shell compound commands as COMMAND in add\_custom\_command()? Stupid example (which does not work): add\_custom\_command( OUTPUT fobar.txt COMMAND ( echo "foo" ; echo "bar" ) \> foobar.txt…

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

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