# Usage

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

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

**Page:** 56

---

## [Header generated with configure\_file not being generated due to dependency](https://discourse.cmake.org/t/header-generated-with-configure-file-not-being-generated-due-to-dependency/6663)

<div class="topic-metadata">

**Author:** [@mbratch](https://discourse.cmake.org/u/mbratch)\
**Replies:** 6\
**Last updated:** [October 17, 2022, 7:57am UTC](https://discourse.cmake.org/t/header-generated-with-configure-file-not-being-generated-due-to-dependency/6663 "2022-10-17T07:57:38Z")

</div>

I am currently using cmake version 3.23.1. I am using the Eclipse environment with esp-idf plugin for ESP32 development. I am using configure\_file to generate a simple header file containing the current project name and…

---

## [How to run ctest on non-build machine?](https://discourse.cmake.org/t/how-to-run-ctest-on-non-build-machine/6658)

<div class="topic-metadata">

**Author:** [@SteveRobbins](https://discourse.cmake.org/u/SteveRobbins)\
**Replies:** 7\
**Last updated:** [October 17, 2022, 6:00am UTC](https://discourse.cmake.org/t/how-to-run-ctest-on-non-build-machine/6658 "2022-10-17T06:00:51Z")

</div>

Hello, We run the VTK build on one machine but would like to run the tests on different machines. First attempt is to do an out-of-source build, zip the build directory, copy to the test machine, and run ctest from wit…

---

## [ARCHIVE\_CREATE with password](https://discourse.cmake.org/t/archive-create-with-password/6665)

<div class="topic-metadata">

**Author:** [@Suthambhara\_N](https://discourse.cmake.org/u/Suthambhara_N)\
**Replies:** 2\
**Last updated:** [October 16, 2022, 2:25am UTC](https://discourse.cmake.org/t/archive-create-with-password/6665 "2022-10-16T02:25:40Z")

</div>

Hi Is it possible to zip either using cmake -E tar or file(ARCHIVE\_CREATE) but with encryption. I couldn’t find such a support after searching. Any suggestions would be helpful Thanks

---

## [using cross emulator with custom target and ctest](https://discourse.cmake.org/t/using-cross-emulator-with-custom-target-and-ctest/4076)

<div class="topic-metadata">

**Author:** [@sera](https://discourse.cmake.org/u/sera)\
**Replies:** 15\
**Last updated:** [October 15, 2022, 5:27pm UTC](https://discourse.cmake.org/t/using-cross-emulator-with-custom-target-and-ctest/4076 "2022-10-15T17:27:17Z")

</div>

First some info dump in case it may matter: cmake: 3.21.1 generator: Unix Makefiles host: linux toolchain: mingw-w64 toolchain file contains: set(CMAKE\_CROSSCOMPILING\_EMULATOR "WINEPATH=Z:\\\\usr\\\\x86\_64-w64-mingw32\\\\usr…

---

## [The Fortran and C compiler identification is unknown and Detecting Fortran compiler ABI info - failed](https://discourse.cmake.org/t/the-fortran-and-c-compiler-identification-is-unknown-and-detecting-fortran-compiler-abi-info-failed/6654)

<div class="topic-metadata">

**Author:** [@edobune](https://discourse.cmake.org/u/edobune)\
**Replies:** 1\
**Last updated:** [October 14, 2022, 5:04pm UTC](https://discourse.cmake.org/t/the-fortran-and-c-compiler-identification-is-unknown-and-detecting-fortran-compiler-abi-info-failed/6654 "2022-10-14T17:04:16Z")

</div>

cmake -D CMAKE\_TOOLCHAIN\_FILE=intel-avx2 -D CMAKE\_INSTALL\_PREFIX=…/ -D CMAKE\_BUILD\_TYPE=Release -D CMAKE\_VERBOSE\_MAKEFILE=off /home/edwinobune/SALMON-v.2.1.0/build/… – The Fortran compiler identification is unknown /o…

---

## [FetchContent with poco](https://discourse.cmake.org/t/fetchcontent-with-poco/6659)

<div class="topic-metadata">

**Author:** [@sampsont](https://discourse.cmake.org/u/sampsont)\
**Replies:** 2\
**Last updated:** [October 13, 2022, 5:25pm UTC](https://discourse.cmake.org/t/fetchcontent-with-poco/6659 "2022-10-13T17:25:42Z")

</div>

I’m trying to use FetchContent to use poco library. It complains about the version tag. include(FetchContent) FetchContent\_Declare( poco GIT\_REPOSITORY GitHub - pocoproject/poco: The POCO C++ Libraries are powerful …

---

## [Intel oneApi C++ Compiler with Visual Studio 2022](https://discourse.cmake.org/t/intel-oneapi-c-compiler-with-visual-studio-2022/6634)

<div class="topic-metadata">

**Author:** [@EagleDad](https://discourse.cmake.org/u/EagleDad)\
**Replies:** 7\
**Last updated:** [October 11, 2022, 5:55am UTC](https://discourse.cmake.org/t/intel-oneapi-c-compiler-with-visual-studio-2022/6634 "2022-10-11T05:55:43Z")

</div>

Hello, I’m using CMake 3.23.1 with Visual Studio 2022 and the Intel oneApi C++ Compiler 2022. Everything works fine, but I have some trouble with changing some compiler flags for individual projects. I want to change t…

---

## [Visual Studio does not show the pathes in INCLUDE\_DIRECTORIES](https://discourse.cmake.org/t/visual-studio-does-not-show-the-pathes-in-include-directories/6635)

<div class="topic-metadata">

**Author:** [@Pei\_Wang](https://discourse.cmake.org/u/Pei_Wang)\
**Replies:** 2\
**Last updated:** [October 11, 2022, 3:41am UTC](https://discourse.cmake.org/t/visual-studio-does-not-show-the-pathes-in-include-directories/6635 "2022-10-11T03:41:10Z")

</div>

I’m wondering it is a regression: I have a series of cmake scripts like this: add\_library(Protobuf INTERFACE) target\_include\_directories(Protobuf INTERFACE ${ProtobufInclude}) // something else... add\_library(MyLib) t…

---

## [build parallelism?](https://discourse.cmake.org/t/build-parallelism/6606)

<div class="topic-metadata">

**Author:** [@Mikael\_Persson](https://discourse.cmake.org/u/Mikael_Persson)\
**Replies:** 5\
**Last updated:** [October 10, 2022, 10:23pm UTC](https://discourse.cmake.org/t/build-parallelism/6606 "2022-10-10T22:23:44Z")

</div>

Consider the example: CASE1) add\_library(liba ...) #nothing exotic, no generated, etc add\_library(libb ...) # only includes headers from liba, but the functions have to be there linktime target\_link\_library(libb liba) #…

---

## [Setting toolchain on command line and compiler in file, causes loop and failure?](https://discourse.cmake.org/t/setting-toolchain-on-command-line-and-compiler-in-file-causes-loop-and-failure/6582)

<div class="topic-metadata">

**Author:** [@RobN](https://discourse.cmake.org/u/RobN)\
**Replies:** 1\
**Last updated:** [October 7, 2022, 6:09pm UTC](https://discourse.cmake.org/t/setting-toolchain-on-command-line-and-compiler-in-file-causes-loop-and-failure/6582 "2022-10-07T18:09:50Z")

</div>

I think I’ve found a way around this for now, but I’m curious why this happens. Maybe it’s a bug? I tried to use vcpkg, and their docs say to invoke cmake like this, specifying the toolchain file: cmake -B build-debug …

---

## [How can I enable "Build in Parallel" on VS for a cutom build tool?](https://discourse.cmake.org/t/how-can-i-enable-build-in-parallel-on-vs-for-a-cutom-build-tool/6533)

<div class="topic-metadata">

**Author:** [@clearissimple](https://discourse.cmake.org/u/clearissimple)\
**Replies:** 6\
**Last updated:** [October 7, 2022, 6:08pm UTC](https://discourse.cmake.org/t/how-can-i-enable-build-in-parallel-on-vs-for-a-cutom-build-tool/6533 "2022-10-07T18:08:15Z")

</div>

Is there a way to set the “Build In Parallel” property to Yes during cmake configuration of a visual studio project? The build steps are added with add\_custom\_command.

---

## [Library not found for -l... Generating xCode project with M1](https://discourse.cmake.org/t/library-not-found-for-l-generating-xcode-project-with-m1/6626)

<div class="topic-metadata">

**Author:** [@ilgemello74](https://discourse.cmake.org/u/ilgemello74)\
**Replies:** 1\
**Last updated:** [October 7, 2022, 5:51pm UTC](https://discourse.cmake.org/t/library-not-found-for-l-generating-xcode-project-with-m1/6626 "2022-10-07T17:51:57Z")

</div>

Hi everyone, I came across some strange cmake behavior. My project imports a series of static libraries always generated with in the cmakelist stack. When I run the command to generate the xCode project file with an x86 …

---

## [Cannot determine link language for target](https://discourse.cmake.org/t/cannot-determine-link-language-for-target/6587)

<div class="topic-metadata">

**Author:** [@bytecounter](https://discourse.cmake.org/u/bytecounter)\
**Replies:** 5\
**Last updated:** [October 7, 2022, 5:36pm UTC](https://discourse.cmake.org/t/cannot-determine-link-language-for-target/6587 "2022-10-07T17:36:57Z")

</div>

Hi everyone, i try to compile a target and as a result i get the error message “Cannot determine link language for target”. my code looks as following: set(CMAKE\_C\_COMPILER gcc) set(CMAKE\_C\_LINKER\_FLAGS “-g -Wall -We…

---

## [Can not link \`yaml-cpp\` with \`libtorch\`](https://discourse.cmake.org/t/can-not-link-yaml-cpp-with-libtorch/6601)

<div class="topic-metadata">

**Author:** [@Master\_Andreas](https://discourse.cmake.org/u/Master_Andreas)\
**Replies:** 6\
**Last updated:** [October 7, 2022, 3:09pm UTC](https://discourse.cmake.org/t/can-not-link-yaml-cpp-with-libtorch/6601 "2022-10-07T15:09:22Z")

</div>

$ cmake --version cmake version 3.24.2 CMakeList.txt cmake\_minimum\_required(VERSION 3.0 FATAL\_ERROR) project(test\_project) set(Torch\_DIR "${CMAKE\_CURRENT\_SOURCE\_DIR}/libtorch/share/cmake/To…

---

## [How to change clang toolset root directory](https://discourse.cmake.org/t/how-to-change-clang-toolset-root-directory/6550)

<div class="topic-metadata">

**Author:** [@serge](https://discourse.cmake.org/u/serge)\
**Replies:** 2\
**Last updated:** [September 29, 2022, 9:11pm UTC](https://discourse.cmake.org/t/how-to-change-clang-toolset-root-directory/6550 "2022-09-29T21:11:52Z")

</div>

Hi everyone, We are using cmake 3.22 with vs2022 generator and clang toolset: -G “Visual Studio…” -T ClangCL In VS there is a way to install clang tools: two check boxes, such that when cmake is invoked it finds automa…

---

## [Clang-tidy issues warning -fno-fat-lto-objects](https://discourse.cmake.org/t/clang-tidy-issues-warning-fno-fat-lto-objects/6501)

<div class="topic-metadata">

**Author:** [@hsattler](https://discourse.cmake.org/u/hsattler)\
**Replies:** 3\
**Last updated:** [September 29, 2022, 7:33pm UTC](https://discourse.cmake.org/t/clang-tidy-issues-warning-fno-fat-lto-objects/6501 "2022-09-29T19:33:29Z")

</div>

Hi, I use clang-tidy and gcc (on Windows with cross-compilation but that shouldn’t matter). Later clang versions now warn about warning: optimization flag ‘-fno-fat-lto-objects’ is not supported \[clang-diagnostic-igno…

---

## [No rule to make target for Shared Imported library](https://discourse.cmake.org/t/no-rule-to-make-target-for-shared-imported-library/6572)

<div class="topic-metadata">

**Author:** [@arkaragian](https://discourse.cmake.org/u/arkaragian)\
**Replies:** 1\
**Last updated:** [September 27, 2022, 11:56am UTC](https://discourse.cmake.org/t/no-rule-to-make-target-for-shared-imported-library/6572 "2022-09-27T11:56:33Z")

</div>

Hello I am using the following cmake file. message(STATUS "Linking to x64 openssl folder") #link\_directories(${CMAKE\_SOURCE\_DIR}/source/openssl/lib/x64) add\_library(libcrypto SHARED IMPORTED GLOBAL) #set\_propert…

---

## [External project using makefile](https://discourse.cmake.org/t/external-project-using-makefile/2692)

<div class="topic-metadata">

**Author:** [@Desmond](https://discourse.cmake.org/u/Desmond)\
**Replies:** 4\
**Last updated:** [September 26, 2022, 2:50am UTC](https://discourse.cmake.org/t/external-project-using-makefile/2692 "2022-09-26T02:50:32Z")

</div>

Hi all, I’m incorporating lua-jit into a larger cross-compilation project, I’d like to invoke the Makefile of lua-jit using some cross platform environment variables. The lua-jit source code is already present in my re…

---

## [CMake Preset Best Practices for Build Types](https://discourse.cmake.org/t/cmake-preset-best-practices-for-build-types/6554)

<div class="topic-metadata">

**Author:** [@developer](https://discourse.cmake.org/u/developer)\
**Replies:** 1\
**Last updated:** [September 23, 2022, 8:11pm UTC](https://discourse.cmake.org/t/cmake-preset-best-practices-for-build-types/6554 "2022-09-23T20:11:11Z")

</div>

I am trying to convert my project from using Visual Studio Code Extension specific cmake-kits.json to leveraging the CMake supported, CMakePresets. My project builds for a couple different toolchains, but shares some com…

---

## [Problem with .so linking](https://discourse.cmake.org/t/problem-with-so-linking/6497)

<div class="topic-metadata">

**Author:** [@skgoswami](https://discourse.cmake.org/u/skgoswami)\
**Replies:** 5\
**Last updated:** [September 23, 2022, 12:52pm UTC](https://discourse.cmake.org/t/problem-with-so-linking/6497 "2022-09-23T12:52:35Z")

</div>

My application building with .so file is failing in the linking stage. When I make the file name as MySecond\_digital.so it is reporting not able to find the file and when I am naming it libMySecond\_digital.so all the cal…

---

## [CMakePresets: Joining a substring to an inherited env variable](https://discourse.cmake.org/t/cmakepresets-joining-a-substring-to-an-inherited-env-variable/6543)

<div class="topic-metadata">

**Author:** [@pbouda95](https://discourse.cmake.org/u/pbouda95)\
**Replies:** 2\
**Last updated:** [September 21, 2022, 3:23pm UTC](https://discourse.cmake.org/t/cmakepresets-joining-a-substring-to-an-inherited-env-variable/6543 "2022-09-21T15:23:32Z")

</div>

Hello all, Does CMakePresets enable to update a parent enviromment string variable while inheriting ? In my case I would like to append a substring to the SAME variable, like: "environment": { …

---

## [How to handle different CXX standards in the same project](https://discourse.cmake.org/t/how-to-handle-different-cxx-standards-in-the-same-project/6510)

<div class="topic-metadata">

**Author:** [@JuliusCaesar](https://discourse.cmake.org/u/JuliusCaesar)\
**Replies:** 6\
**Last updated:** [September 21, 2022, 3:12pm UTC](https://discourse.cmake.org/t/how-to-handle-different-cxx-standards-in-the-same-project/6510 "2022-09-21T15:12:09Z")

</div>

Hey guys, in our project we want to use the newest available CXX Standard. (We do not want some beta like std:c++latest but an official released standard.) At the moment this is C++20. Our project is build with differ…

---

## [(hear me out) FetchContent or ExternalProject\_Add without a download?](https://discourse.cmake.org/t/hear-me-out-fetchcontent-or-externalproject-add-without-a-download/6536)

<div class="topic-metadata">

**Author:** [@Rich\_von\_Lehe](https://discourse.cmake.org/u/Rich_von_Lehe)\
**Replies:** 8\
**Last updated:** [September 21, 2022, 2:29pm UTC](https://discourse.cmake.org/t/hear-me-out-fetchcontent-or-externalproject-add-without-a-download/6536 "2022-09-21T14:29:13Z")

</div>

I have to preface my question with a brief explanation of why I’d even ask this because I know what I’m asking about is far from idiomatic use of CMake. I am limited to a single repository for a work project. This repos…

---

## [Obtain compile and link flags for a package](https://discourse.cmake.org/t/obtain-compile-and-link-flags-for-a-package/6538)

<div class="topic-metadata">

**Author:** [@szhorvat](https://discourse.cmake.org/u/szhorvat)\
**Replies:** 2\
**Last updated:** [September 21, 2022, 1:18pm UTC](https://discourse.cmake.org/t/obtain-compile-and-link-flags-for-a-package/6538 "2022-09-21T13:18:04Z")

</div>

I am looking for a way to get the compilation and linking flags for an installed CMake package (that can be found with find\_package), and use them in a non-CMake project. Does CMake provide a reasonably simple way to do …

---

## [Can I specify -S via CMakePresets.json?](https://discourse.cmake.org/t/can-i-specify-s-via-cmakepresets-json/6522)

<div class="topic-metadata">

**Author:** [@dwarwick](https://discourse.cmake.org/u/dwarwick)\
**Replies:** 2\
**Last updated:** [September 21, 2022, 5:48am UTC](https://discourse.cmake.org/t/can-i-specify-s-via-cmakepresets-json/6522 "2022-09-21T05:48:57Z")

</div>

Our homebrew scripts to build our project look like cmake -S path/to/project\_dir -G Ninja -etc We are trying to convert to CMakePresets.json, but the only thing preventing that is the first argument above – the -S argu…

---

## [Capture custom step output ExternalProject\_Add](https://discourse.cmake.org/t/capture-custom-step-output-externalproject-add/6512)

<div class="topic-metadata">

**Author:** [@Pavel](https://discourse.cmake.org/u/Pavel)\
**Replies:** 1\
**Last updated:** [September 20, 2022, 11:08pm UTC](https://discourse.cmake.org/t/capture-custom-step-output-externalproject-add/6512 "2022-09-20T23:08:48Z")

</div>

Hello everyone, What would be a sane way to capture custom step output ExternalProject\_Add in some cmake variable ? For example: ... ExternalProject\_Add(some\_autotools\_dep GIT\_REPOSITORY some\_dep\_url GIT\_TAG some\_ta…

---

## [\`CTest --preset\` doesn't appear to allow for out-of-tree builds](https://discourse.cmake.org/t/ctest-preset-doesnt-appear-to-allow-for-out-of-tree-builds/6275)

<div class="topic-metadata">

**Author:** [@steven-johnson](https://discourse.cmake.org/u/steven-johnson)\
**Replies:** 3\
**Last updated:** [September 20, 2022, 11:05pm UTC](https://discourse.cmake.org/t/ctest-preset-doesnt-appear-to-allow-for-out-of-tree-builds/6275 "2022-09-20T23:05:40Z")

</div>

When I configure a build in CMake using a build-preset, I can have a handy default for the build dir (e.g. --preset=release can default to build/Release)… but I can always use -B build\_dir to override this if I want (e.g…

---

## [Mac Installer made with CPack won't install anything](https://discourse.cmake.org/t/mac-installer-made-with-cpack-wont-install-anything/6517)

<div class="topic-metadata">

**Author:** [@datalogics-robl](https://discourse.cmake.org/u/datalogics-robl)\
**Replies:** 1\
**Last updated:** [September 20, 2022, 10:56pm UTC](https://discourse.cmake.org/t/mac-installer-made-with-cpack-wont-install-anything/6517 "2022-09-20T22:56:27Z")

</div>

I’m trying out CPack with the ProductBuild generator to decide if my company can use it to ship one of our products on macOS. To experiment, I tried making an installer for a simple “hello, world” program. At this point…

---

## [cmake\_path(ABSOLUTE\_PATH ...) vs. get\_filename\_component(... ABSOLUTE)](https://discourse.cmake.org/t/cmake-path-absolute-path-vs-get-filename-component-absolute/5549)

<div class="topic-metadata">

**Author:** [@johan556](https://discourse.cmake.org/u/johan556)\
**Replies:** 9\
**Last updated:** [September 19, 2022, 9:29pm UTC](https://discourse.cmake.org/t/cmake-path-absolute-path-vs-get-filename-component-absolute/5549 "2022-09-19T21:29:18Z")

</div>

I tried to use cmake\_path() instead of get\_filename\_component() to “normalize” a path. But when I start with "/x/y/z/w/../.." I get these results: -- cmake\_path: /x/y/ -- get\_filename\_component: /x/y Is the…

---

## [CMake Error at CMakeLists.txt:22 (project): CMAKE\_C\_COMPILER: CMAKE\_Fortran\_COMPILER:](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-22-project-cmake-c-compiler-cmake-fortran-compiler/6516)

<div class="topic-metadata">

**Author:** [@edobune](https://discourse.cmake.org/u/edobune)\
**Replies:** 0\
**Last updated:** [September 19, 2022, 7:14pm UTC](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-22-project-cmake-c-compiler-cmake-fortran-compiler/6516 "2022-09-19T19:14:10Z")

</div>

python …/configure.py --arch=intel-avx2 --prefix=…/ $ cmake -D CMAKE\_TOOLCHAIN\_FILE=intel-avx2 -D CMAKE\_INSTALL\_PREFIX=…/ -D CMAKE\_BUILD\_TYPE=Release -D CMAKE\_VERBOSE\_MAKEFILE=off /home/edwinobune/SALMON-v.2.1.0/build…

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

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