# Code

**URL:** https://discourse.cmake.org/c/code/11.md?page=64

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

**Page:** 65

---

## [Difference between linking external built and installed library](https://discourse.cmake.org/t/difference-between-linking-external-built-and-installed-library/2369)

<div class="topic-metadata">

**Author:** [@kerim](https://discourse.cmake.org/u/kerim)\
**Replies:** 3\
**Last updated:** [December 15, 2020, 11:01pm UTC](https://discourse.cmake.org/t/difference-between-linking-external-built-and-installed-library/2369 "2020-12-15T23:01:42Z")

</div>

Hi, In my project A I use ExternalProject\_Add function to build some third party library B and then I’m going to use this library inside my project A. I guess there two options are available: build B lib build and in…

---

## [ctest with LABELS to classify tests](https://discourse.cmake.org/t/ctest-with-labels-to-classify-tests/2375)

<div class="topic-metadata">

**Author:** [@jverdicchio](https://discourse.cmake.org/u/jverdicchio)\
**Replies:** 1\
**Last updated:** [December 15, 2020, 4:14pm UTC](https://discourse.cmake.org/t/ctest-with-labels-to-classify-tests/2375 "2020-12-15T16:14:51Z")

</div>

In my software group we have a test suite that is controlled and run using bash scripts. I’m proposing using CTest and some python to replace these scripts. The test suite contains around 50 cases but we are planning on…

---

## [parralelise ExternalProject](https://discourse.cmake.org/t/parralelise-externalproject/2321)

<div class="topic-metadata">

**Author:** [@grimgort](https://discourse.cmake.org/u/grimgort)\
**Replies:** 4\
**Last updated:** [December 15, 2020, 2:58pm UTC](https://discourse.cmake.org/t/parralelise-externalproject/2321 "2020-12-15T14:58:29Z")

</div>

Hello, I would like to parallel compile with ExternalProject\_add. I use MSVC to compile (VSCODE) the -J N option doesn’t compile in parallel inside externalProject.I tried to switch -jN to the CMAKE\_ARGS option, but it…

---

## [Get the final install prefix at install-time](https://discourse.cmake.org/t/get-the-final-install-prefix-at-install-time/2357)

<div class="topic-metadata">

**Author:** [@Artemis](https://discourse.cmake.org/u/Artemis)\
**Replies:** 7\
**Last updated:** [December 15, 2020, 2:00pm UTC](https://discourse.cmake.org/t/get-the-final-install-prefix-at-install-time/2357 "2020-12-15T14:00:57Z")

</div>

Hi, I’m working on a C library project that provides some examples. The examples are contained in a self contained subproject, and can be built from both the top library project (as normal executable targets) or instal…

---

## [CMAKE\_INSTALL\_PREFIX in Spanish on Windows](https://discourse.cmake.org/t/cmake-install-prefix-in-spanish-on-windows/2361)

<div class="topic-metadata">

**Author:** [@MelvinG24](https://discourse.cmake.org/u/MelvinG24)\
**Replies:** 6\
**Last updated:** [December 15, 2020, 3:59am UTC](https://discourse.cmake.org/t/cmake-install-prefix-in-spanish-on-windows/2361 "2020-12-15T03:59:43Z")

</div>

How can I define CMAKE\_INSTALL\_PREFIX if Windows is in English to go to C:\\program file\\ and if Windows is in Spanish to go to C:\\Archivos de Programas\\

---

## [A question about cmake-gui](https://discourse.cmake.org/t/a-question-about-cmake-gui/2362)

<div class="topic-metadata">

**Author:** [@Coderx7](https://discourse.cmake.org/u/Coderx7)\
**Replies:** 1\
**Last updated:** [December 13, 2020, 7:10pm UTC](https://discourse.cmake.org/t/a-question-about-cmake-gui/2362 "2020-12-13T19:10:23Z")

</div>

Hello everyone, hope you are having a great day. I’m pretty new to CMake and I have some questions that I’d greatly appreciate if you could lend me a helping hand. Basically, I’m trying to build Pytorch from source on …

---

## [Pull in CMake Files via FetchContent](https://discourse.cmake.org/t/pull-in-cmake-files-via-fetchcontent/2315)

<div class="topic-metadata">

**Author:** [@Leon0402](https://discourse.cmake.org/u/Leon0402)\
**Replies:** 5\
**Last updated:** [December 12, 2020, 9:24pm UTC](https://discourse.cmake.org/t/pull-in-cmake-files-via-fetchcontent/2315 "2020-12-12T21:24:00Z")

</div>

Hi, I wanted to use cmake scripts provided by Catch2 and used the following code: FetchContent\_GetProperties(Catch2) if(NOT catch2\_POPULATED) FetchContent\_Populate(Catch2) add\_subdirectory(${catch2\_SOURCE\_DIR} …

---

## [Checking if specific boost headers are available](https://discourse.cmake.org/t/checking-if-specific-boost-headers-are-available/2352)

<div class="topic-metadata">

**Author:** [@javierelpianista](https://discourse.cmake.org/u/javierelpianista)\
**Replies:** 2\
**Last updated:** [December 12, 2020, 3:24pm UTC](https://discourse.cmake.org/t/checking-if-specific-boost-headers-are-available/2352 "2020-12-12T15:24:28Z")

</div>

Is there a way to check if specific boost header-only libraries are installed? I am aware of the COMPONENTS option in the find\_package(Boost ...) command, but it only works for compiled libraries. I am particularly inte…

---

## [Clarification of 'backtrace' from file-api](https://discourse.cmake.org/t/clarification-of-backtrace-from-file-api/2295)

<div class="topic-metadata">

**Author:** [@mbee](https://discourse.cmake.org/u/mbee)\
**Replies:** 3\
**Last updated:** [December 11, 2020, 7:58pm UTC](https://discourse.cmake.org/t/clarification-of-backtrace-from-file-api/2295 "2020-12-11T19:58:47Z")

</div>

I’m not a beginner in cmake, but up to now have never used the file api or its predecessor, the server mode. Currently, I am trying to exploit the api and stumbled into the term ‘backtrace’. The documentation states for…

---

## [Suggested way to add mapfile output to a project with multiple target toolchains?](https://discourse.cmake.org/t/suggested-way-to-add-mapfile-output-to-a-project-with-multiple-target-toolchains/2342)

<div class="topic-metadata">

**Author:** [@Russell\_Schultz](https://discourse.cmake.org/u/Russell_Schultz)\
**Replies:** 2\
**Last updated:** [December 11, 2020, 2:59pm UTC](https://discourse.cmake.org/t/suggested-way-to-add-mapfile-output-to-a-project-with-multiple-target-toolchains/2342 "2020-12-11T14:59:47Z")

</div>

I have a multi-toolchain development environment (IAR-ARM, MSVC, and Tensilica-Clang) and mapfile are invaluable to embedded development. In each toolchain file, I’m able to set default linker flags, etc, but in general…

---

## [Patch source with instrumentation without altering original code](https://discourse.cmake.org/t/patch-source-with-instrumentation-without-altering-original-code/2338)

<div class="topic-metadata">

**Author:** [@StefanSchmelz](https://discourse.cmake.org/u/StefanSchmelz)\
**Replies:** 1\
**Last updated:** [December 10, 2020, 6:45pm UTC](https://discourse.cmake.org/t/patch-source-with-instrumentation-without-altering-original-code/2338 "2020-12-10T18:45:06Z")

</div>

I want to use libtooling to generate instrumentattion code for debug builds. I will manage to run my generator from cmake, but i don’t really know how i could patch my Instrumentation into the source without altering the…

---

## [print all fatal error of compilation to end of stdout](https://discourse.cmake.org/t/print-all-fatal-error-of-compilation-to-end-of-stdout/2320)

<div class="topic-metadata">

**Author:** [@grimgort](https://discourse.cmake.org/u/grimgort)\
**Replies:** 2\
**Last updated:** [December 10, 2020, 3:24pm UTC](https://discourse.cmake.org/t/print-all-fatal-error-of-compilation-to-end-of-stdout/2320 "2020-12-10T15:24:20Z")

</div>

Hello, I would like to have all fatal compilation errors at the end of the standard output or in a log file. Also, is the standard output also redirected to a cmake log file? If you don’t forget to rewrite it manually,…

---

## [evaluating cmake](https://discourse.cmake.org/t/evaluating-cmake/2322)

<div class="topic-metadata">

**Author:** [@Massimiliano\_Cialdi](https://discourse.cmake.org/u/Massimiliano_Cialdi)\
**Replies:** 2\
**Last updated:** [December 9, 2020, 9:27pm UTC](https://discourse.cmake.org/t/evaluating-cmake/2322 "2020-12-09T21:27:27Z")

</div>

I am evaluating if cmake can help me in my projects. First of all I should make a premise about the constraints we have in the build processes. We build products based on microcontrollers running baremetal or RTOS (Fre…

---

## [Build for 32 and 64 bit](https://discourse.cmake.org/t/build-for-32-and-64-bit/2329)

<div class="topic-metadata">

**Author:** [@R030t1](https://discourse.cmake.org/u/R030t1)\
**Replies:** 3\
**Last updated:** [December 9, 2020, 7:32pm UTC](https://discourse.cmake.org/t/build-for-32-and-64-bit/2329 "2020-12-09T19:32:24Z")

</div>

Due to targeting certain features of Windows the 32 bit binaries must be generated even on a 64 bit system. What is the best way to do this? I’d like to have it happen with one build system invocation, but am unsure of w…

---

## [Unable build dll](https://discourse.cmake.org/t/unable-build-dll/2327)

<div class="topic-metadata">

**Author:** [@Andry](https://discourse.cmake.org/u/Andry)\
**Replies:** 1\
**Last updated:** [December 9, 2020, 5:00pm UTC](https://discourse.cmake.org/t/unable-build-dll/2327 "2020-12-09T17:00:29Z")

</div>

LINK : error LNK2001: unresolved external symbol \_DllMainCRTStartup cmake version 3.18.20081302-MSVC\_2 and cmake version 3.16.5 CMakeLists.txt cmake\_minimum\_required(VERSION 3.16) project(testttttt) include(Generat…

---

## [Subdirectory that is just header files](https://discourse.cmake.org/t/subdirectory-that-is-just-header-files/2316)

<div class="topic-metadata">

**Author:** [@scottaronbloom](https://discourse.cmake.org/u/scottaronbloom)\
**Replies:** 3\
**Last updated:** [December 9, 2020, 4:10pm UTC](https://discourse.cmake.org/t/subdirectory-that-is-just-header-files/2316 "2020-12-09T16:10:55Z")

</div>

I have a pain in the butt situation. I am stuck working with a very old makefile based make system (about 200 directories). Moving it to CMake is not a short term option. Building is “fine” but debugging is really horri…

---

## [Qt and cpprestsdk](https://discourse.cmake.org/t/qt-and-cpprestsdk/2310)

<div class="topic-metadata">

**Author:** [@zombieanfuehrer](https://discourse.cmake.org/u/zombieanfuehrer)\
**Replies:** 8\
**Last updated:** [December 7, 2020, 10:39pm UTC](https://discourse.cmake.org/t/qt-and-cpprestsdk/2310 "2020-12-07T22:39:27Z")

</div>

Good evening folks, i am quite a beginner and am just struggling through the correct configuration of CMakeLists.txt files. I have created a project based on my own file, Qt framework files and cpprestsdk (casablanca) …

---

## [Get INSTALL\_INTERFACE in \`install(CODE)\`.](https://discourse.cmake.org/t/get-install-interface-in-install-code/2308)

<div class="topic-metadata">

**Author:** [@alex](https://discourse.cmake.org/u/alex)\
**Replies:** 1\
**Last updated:** [December 7, 2020, 3:04pm UTC](https://discourse.cmake.org/t/get-install-interface-in-install-code/2308 "2020-12-07T15:04:07Z")

</div>

I think I have found a bug, or at the very least a vexing behavior. Here’s my minimal example: cmake\_minimum\_required(VERSION 3.16) project(example) add\_library(example INTERFACE) target\_compile\_definitions(example INT…

---

## [How to deal with code generators?](https://discourse.cmake.org/t/how-to-deal-with-code-generators/2301)

<div class="topic-metadata">

**Author:** [@Massimiliano\_Cialdi](https://discourse.cmake.org/u/Massimiliano_Cialdi)\
**Replies:** 1\
**Last updated:** [December 6, 2020, 6:35pm UTC](https://discourse.cmake.org/t/how-to-deal-with-code-generators/2301 "2020-12-06T18:35:59Z")

</div>

In the past I have dealt with code generators such as flex, bison, protobuf, etc… In an old project, using makefiles, it was the same make that wrote a header file containing the semantic version string, and a couple of…

---

## [CMake doesn't run code from CMakeLists.txt via add\_subdirectory](https://discourse.cmake.org/t/cmake-doesnt-run-code-from-cmakelists-txt-via-add-subdirectory/2304)

<div class="topic-metadata">

**Author:** [@kerim](https://discourse.cmake.org/u/kerim)\
**Replies:** 1\
**Last updated:** [December 6, 2020, 3:08am UTC](https://discourse.cmake.org/t/cmake-doesnt-run-code-from-cmakelists-txt-via-add-subdirectory/2304 "2020-12-06T03:08:09Z")

</div>

Hi, I have a project named Project and a subfolder KKK I write in KKK/CMakeLists.txt the command message("RUNNING KKK") but when I launch CMake for Project I can’t see this message RUNNING KKK P.S. in realworld I have…

---

## [What happens when vs\_link\_exe copies dependent exes?](https://discourse.cmake.org/t/what-happens-when-vs-link-exe-copies-dependent-exes/2290)

<div class="topic-metadata">

**Author:** [@alex](https://discourse.cmake.org/u/alex)\
**Replies:** 1\
**Last updated:** [December 3, 2020, 11:45pm UTC](https://discourse.cmake.org/t/what-happens-when-vs-link-exe-copies-dependent-exes/2290 "2020-12-03T23:45:55Z")

</div>

I’m getting loader errors from a CMake project I work on (Halide). Here’s what I observe: I have Halide.dll in my installed directory. It has md5sum 8676341266e7f5ceb450b98df32f00ab and size 87210496 bytes. When I try …

---

## [output of cmake command to a file](https://discourse.cmake.org/t/output-of-cmake-command-to-a-file/2287)

<div class="topic-metadata">

**Author:** [@Tzlil\_Gavra](https://discourse.cmake.org/u/Tzlil_Gavra)\
**Replies:** 1\
**Last updated:** [December 3, 2020, 3:37pm UTC](https://discourse.cmake.org/t/output-of-cmake-command-to-a-file/2287 "2020-12-03T15:37:17Z")

</div>

I’m trying to get the output of my compiler while building a project (with the command cmake --build build\_dir --target all -- -j 3) Because I want every target to be printed in a separate file, I can’t use simple pipin…

---

## [Use external libraries that are already linked to a subproject](https://discourse.cmake.org/t/use-external-libraries-that-are-already-linked-to-a-subproject/2269)

<div class="topic-metadata">

**Author:** [@kerim](https://discourse.cmake.org/u/kerim)\
**Replies:** 4\
**Last updated:** [December 1, 2020, 5:00pm UTC](https://discourse.cmake.org/t/use-external-libraries-that-are-already-linked-to-a-subproject/2269 "2020-12-01T17:00:21Z")

</div>

Hi, Let’s suppose I have a project with two subfolders and subPrj1 links libhdf5\_D.lib: Now I want to link subPrj1 to subPrj2 and use the same libhdf5\_D.lib in subPrj2. What is the “cleanest” way to do that? Do I ha…

---

## [How to check variables specified with -D command line option?](https://discourse.cmake.org/t/how-to-check-variables-specified-with-d-command-line-option/2270)

<div class="topic-metadata">

**Author:** [@tomoreilly](https://discourse.cmake.org/u/tomoreilly)\
**Replies:** 2\
**Last updated:** [December 1, 2020, 9:55am UTC](https://discourse.cmake.org/t/how-to-check-variables-specified-with-d-command-line-option/2270 "2020-12-01T09:55:02Z")

</div>

I’d like my users to be able to set various variable values on the command line. So the cmake ‘-D’ option does this. But how can I insure that the user has spelled the variable correctly on the command line? E.g. suppose…

---

## [How to pass compiler and options to external project configure script?](https://discourse.cmake.org/t/how-to-pass-compiler-and-options-to-external-project-configure-script/2261)

<div class="topic-metadata">

**Author:** [@penguin359](https://discourse.cmake.org/u/penguin359)\
**Replies:** 1\
**Last updated:** [November 30, 2020, 2:14pm UTC](https://discourse.cmake.org/t/how-to-pass-compiler-and-options-to-external-project-configure-script/2261 "2020-11-30T14:14:47Z")

</div>

I am using CMake to compile some native code for Android which relies on a third-party library that uses the autoconf/automake build system. I having trouble trying to figure out how to pass in all the appropriate variab…

---

## [How to download ancillary files during build with wget from Google Drive](https://discourse.cmake.org/t/how-to-download-ancillary-files-during-build-with-wget-from-google-drive/652)

<div class="topic-metadata">

**Author:** [@heather999](https://discourse.cmake.org/u/heather999)\
**Replies:** 2\
**Last updated:** [November 30, 2020, 4:51am UTC](https://discourse.cmake.org/t/how-to-download-ancillary-files-during-build-with-wget-from-google-drive/652 "2020-11-30T04:51:40Z")

</div>

Hi, I’m rather new to cmake and am trying to add a step to an existing cmake project to download 2 ancillary files available on Google Drive using wget. The format for the download command line is a little complicated, …

---

## [No QT5 found on iOS install](https://discourse.cmake.org/t/no-qt5-found-on-ios-install/2148)

<div class="topic-metadata">

**Author:** [@mlander](https://discourse.cmake.org/u/mlander)\
**Replies:** 3\
**Last updated:** [November 29, 2020, 5:48pm UTC](https://discourse.cmake.org/t/no-qt5-found-on-ios-install/2148 "2020-11-29T17:48:05Z")

</div>

I’ve updated the necessary downloads for QT5.15 with with Xcode and Python for a Mantaflow app and am stumped troubleshooting. I’m not too well versed with the coding world! "No Qt5 found (recommended!), trying to use Q…

---

## [How to generate depends.make file for custom language](https://discourse.cmake.org/t/how-to-generate-depends-make-file-for-custom-language/2173)

<div class="topic-metadata">

**Author:** [@rjenkins](https://discourse.cmake.org/u/rjenkins)\
**Replies:** 2\
**Last updated:** [November 29, 2020, 6:02am UTC](https://discourse.cmake.org/t/how-to-generate-depends-make-file-for-custom-language/2173 "2020-11-29T06:02:00Z")

</div>

Hello, I am trying to make a custom language option for building cmake, but my compilation does not correctly update when I do a touch on a header file. In older versions of cmake I remember using (with c++ compilers) …

---

## [Add bin folder of external shared lib to run environment var](https://discourse.cmake.org/t/add-bin-folder-of-external-shared-lib-to-run-environment-var/2257)

<div class="topic-metadata">

**Author:** [@kerim](https://discourse.cmake.org/u/kerim)\
**Replies:** 5\
**Last updated:** [November 28, 2020, 12:31pm UTC](https://discourse.cmake.org/t/add-bin-folder-of-external-shared-lib-to-run-environment-var/2257 "2020-11-28T12:31:07Z")

</div>

Hi, I’m learning the basics of CMake. The task is to link external shared library and launch in debug/release mode. I’m able to successfully link this library and build the project but I’m unable to launch the app bec…

---

## [Testing client cmake usage](https://discourse.cmake.org/t/testing-client-cmake-usage/643)

<div class="topic-metadata">

**Author:** [@alex](https://discourse.cmake.org/u/alex)\
**Replies:** 7\
**Last updated:** [November 28, 2020, 1:48am UTC](https://discourse.cmake.org/t/testing-client-cmake-usage/643 "2020-11-28T01:48:22Z")

</div>

We want our clients to be able to find\_package our package, and we supply a number of sample applications in our repository. We would like to be able to test that these build and run correctly from the perspective of a c…

[Previous page](https://discourse.cmake.org/c/code/11.md?page=63)

[Next page](https://discourse.cmake.org/c/code/11.md?page=65)
