# Usage

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

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

**Page:** 86

---

## [Specifying compile language for \<stdint.h\> as C, not C++. Editing a MCU Project (coded using Keil) in VS](https://discourse.cmake.org/t/specifying-compile-language-for-stdint-h-as-c-not-c-editing-a-mcu-project-coded-using-keil-in-vs/1884)

<div class="topic-metadata">

**Author:** [@CharlvdM](https://discourse.cmake.org/u/CharlvdM)\
**Replies:** 1\
**Last updated:** [January 4, 2021, 3:34pm UTC](https://discourse.cmake.org/t/specifying-compile-language-for-stdint-h-as-c-not-c-editing-a-mcu-project-coded-using-keil-in-vs/1884 "2021-01-04T15:34:58Z")

</div>

I have a working project for a STM32F746 microcontroller (MCU) that was coded using the Keil IDE. The project makes use of many of STMicroelectronics’ HAL libraries. I would like to continue working on the project using …

---

## [wxWidgets 3.1 error finding two libraries with MinGW](https://discourse.cmake.org/t/wxwidgets-3-1-error-finding-two-libraries-with-mingw/1691)

<div class="topic-metadata">

**Author:** [@hobbes1069](https://discourse.cmake.org/u/hobbes1069)\
**Replies:** 4\
**Last updated:** [January 4, 2021, 3:33pm UTC](https://discourse.cmake.org/t/wxwidgets-3-1-error-finding-two-libraries-with-mingw/1691 "2021-01-04T15:33:15Z")

</div>

I’ve had this working before but… I’m building a cross platform project that uses wxWidgets. Currently I’m cross-compiling windows 64bit from Fedora linux. The project performs a bootstrap build of wxWidgets if required…

---

## [The findMPI in Cmake 3.18 can not find MSMPI for Fortran](https://discourse.cmake.org/t/the-findmpi-in-cmake-3-18-can-not-find-msmpi-for-fortran/1791)

<div class="topic-metadata">

**Author:** [@tmishima](https://discourse.cmake.org/u/tmishima)\
**Replies:** 2\
**Last updated:** [January 4, 2021, 3:26pm UTC](https://discourse.cmake.org/t/the-findmpi-in-cmake-3-18-can-not-find-msmpi-for-fortran/1791 "2021-01-04T15:26:19Z")

</div>

Hi folks, The findMPI in Cmake 3.18 cannot find MSMPI for Fortran, which set MPI\_Fortran\_WORKS=False. On the other hand, the findMPI in Cmake 3.16.2 does find MSMPI successfully. A workaround so far is: if(WIN32 AND …

---

## [Linking to a prebuilt library](https://discourse.cmake.org/t/linking-to-a-prebuilt-library/1733)

<div class="topic-metadata">

**Author:** [@developer](https://discourse.cmake.org/u/developer)\
**Replies:** 3\
**Last updated:** [January 4, 2021, 3:20pm UTC](https://discourse.cmake.org/t/linking-to-a-prebuilt-library/1733 "2021-01-04T15:20:18Z")

</div>

I am trying to link to a specific QNX library for the architecture I’m cross compiling for. Let’s call that library foo. I have a QNX toolchain file very similar to the example in the toolchains.cmake documentation. I w…

---

## [cmake imported library and precompiled headers](https://discourse.cmake.org/t/cmake-imported-library-and-precompiled-headers/2459)

<div class="topic-metadata">

**Author:** [@elpie89](https://discourse.cmake.org/u/elpie89)\
**Replies:** 5\
**Last updated:** [January 2, 2021, 7:23pm UTC](https://discourse.cmake.org/t/cmake-imported-library-and-precompiled-headers/2459 "2021-01-02T19:23:16Z")

</div>

I have a simple CMake project organized like this: ExternalDependencies -\>glm CMakeLists.txt MasterFolder CMakeLists.txt (A) -\>src CMakeLists.txt (B) -\>include precompiled\_header.h (A) looks like this: projec…

---

## [Would like to disable cmake dev warning](https://discourse.cmake.org/t/would-like-to-disable-cmake-dev-warning/2450)

<div class="topic-metadata">

**Author:** [@boxerab](https://discourse.cmake.org/u/boxerab)\
**Replies:** 5\
**Last updated:** [January 1, 2021, 8:23pm UTC](https://discourse.cmake.org/t/would-like-to-disable-cmake-dev-warning/2450 "2021-01-01T20:23:09Z")

</div>

My cmake script searches for Perl libs, but I get the following warning message: CMake Warning (dev) at cmake-install/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message): The package name passed…

---

## [Profiling build performance?](https://discourse.cmake.org/t/profiling-build-performance/2443)

<div class="topic-metadata">

**Author:** [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)\
**Replies:** 2\
**Last updated:** [December 31, 2020, 6:17pm UTC](https://discourse.cmake.org/t/profiling-build-performance/2443 "2020-12-31T18:17:52Z")

</div>

I’d like to profile the performance of my cmake ninja build. To see how I can improve my build/linker speed. Ideally I’d like to be able to distinguish compile vs linker time. Because my project is being bottlenecked at…

---

## [Referencing file in CMake function shipped via \*Config.cmake](https://discourse.cmake.org/t/referencing-file-in-cmake-function-shipped-via-config-cmake/2447)

<div class="topic-metadata">

**Author:** [@Nicholas\_Yue](https://discourse.cmake.org/u/Nicholas_Yue)\
**Replies:** 1\
**Last updated:** [December 30, 2020, 8:36pm UTC](https://discourse.cmake.org/t/referencing-file-in-cmake-function-shipped-via-config-cmake/2447 "2020-12-30T20:36:04Z")

</div>

Hi I am planning to ship a convenience CMake function for developers as part of the \*Config.cmake file. That function depends on a python script. function(myfunction) ... set(\_command Python::Interpreter "WHAT TO …

---

## [Help with component packaging](https://discourse.cmake.org/t/help-with-component-packaging/1510)

<div class="topic-metadata">

**Author:** [@lfcarreon1](https://discourse.cmake.org/u/lfcarreon1)\
**Replies:** 1\
**Last updated:** [December 30, 2020, 8:04pm UTC](https://discourse.cmake.org/t/help-with-component-packaging/1510 "2020-12-30T20:04:17Z")

</div>

Hi, I’m a beginner with CMake mainly learning by reading Craig Scott’s “Professional CMake: A Practical Guide”. I have successfully created a simple project and am now ready to move on to more complicated stuff. I have…

---

## [override discovered assember](https://discourse.cmake.org/t/override-discovered-assember/1448)

<div class="topic-metadata">

**Author:** [@melcher](https://discourse.cmake.org/u/melcher)\
**Replies:** 1\
**Last updated:** [December 30, 2020, 7:59pm UTC](https://discourse.cmake.org/t/override-discovered-assember/1448 "2020-12-30T19:59:30Z")

</div>

\_find\_compiler\_path() does not consider CMAKE\_PREFIX\_PATH. ok, so be it. However, it also ignores PATH in the environment. argh. I’m using the gnu toolchain (gcc+binutils) and gcc happily finds a different assembler if…

---

## [How to force CMake 3.17 to search for a new generator on Windows 10 when both Visual Studio 15 AND Visual Studio 17 are installed ?](https://discourse.cmake.org/t/how-to-force-cmake-3-17-to-search-for-a-new-generator-on-windows-10-when-both-visual-studio-15-and-visual-studio-17-are-installed/1397)

<div class="topic-metadata">

**Author:** [@Bruce\_McIntyre](https://discourse.cmake.org/u/Bruce_McIntyre)\
**Replies:** 1\
**Last updated:** [December 30, 2020, 7:59pm UTC](https://discourse.cmake.org/t/how-to-force-cmake-3-17-to-search-for-a-new-generator-on-windows-10-when-both-visual-studio-15-and-visual-studio-17-are-installed/1397 "2020-12-30T19:59:05Z")

</div>

I am trying to upgrade a large Visual Studio library project created using Visual Studio 15 to Visual Studio 17 and can’t get prebuilt CMake 3.17 binaries to search for a new generator. The problem is that the MSBuild d…

---

## [Can't force find\_library to find .dll suffix](https://discourse.cmake.org/t/cant-force-find-library-to-find-dll-suffix/1387)

<div class="topic-metadata">

**Author:** [@yisseamake](https://discourse.cmake.org/u/yisseamake)\
**Replies:** 4\
**Last updated:** [December 30, 2020, 7:55pm UTC](https://discourse.cmake.org/t/cant-force-find-library-to-find-dll-suffix/1387 "2020-12-30T19:55:33Z")

</div>

When executing find\_library in find\_library(PostgreSQL\_LIBRARIES NAMES libpq.dll pq PATHS “${PQ\_ROOT}/src/interfaces/libpq” NO\_DEFAULT\_PATH NO\_SYSTEM\_ENVIRONMENT\_PATH NO\_CMAKE\_FIND\_ROOT\_PATH ) it debug report indi…

---

## [MACOSX\_BUNDLE and dynlibs](https://discourse.cmake.org/t/macosx-bundle-and-dynlibs/1294)

<div class="topic-metadata">

**Author:** [@Gonzalo\_Garramuno](https://discourse.cmake.org/u/Gonzalo_Garramuno)\
**Replies:** 2\
**Last updated:** [December 30, 2020, 7:54pm UTC](https://discourse.cmake.org/t/macosx-bundle-and-dynlibs/1294 "2020-12-30T19:54:14Z")

</div>

Hi. I am new to MacOSX and I am pulling my hair. I am creating an application on MacOSX that relies on multiple dynlibs and frameworks that get pulled from FindXXX.cmake or from direct linking them. I am looking for…

---

## [Universal way of checking if Python3 is set regardless of module used to do so](https://discourse.cmake.org/t/universal-way-of-checking-if-python3-is-set-regardless-of-module-used-to-do-so/2444)

<div class="topic-metadata">

**Author:** [@eriols](https://discourse.cmake.org/u/eriols)\
**Replies:** 2\
**Last updated:** [December 30, 2020, 5:38pm UTC](https://discourse.cmake.org/t/universal-way-of-checking-if-python3-is-set-regardless-of-module-used-to-do-so/2444 "2020-12-30T17:38:13Z")

</div>

In the usecase where my repo is a subrepo of someone else they might have set Python3 upstream using FindPythonInterp, FindPython or FindPython3 (maybe there are more ways even?). In such cases I want to point that execu…

---

## [Path Quoting Issues on MSYS2 MinGW64 When Building OBS](https://discourse.cmake.org/t/path-quoting-issues-on-msys2-mingw64-when-building-obs/2445)

<div class="topic-metadata">

**Author:** [@R030t1](https://discourse.cmake.org/u/R030t1)\
**Replies:** 1\
**Last updated:** [December 30, 2020, 9:14am UTC](https://discourse.cmake.org/t/path-quoting-issues-on-msys2-mingw64-when-building-obs/2445 "2020-12-30T09:14:52Z")

</div>

CMake tries to run “C:msys64mingw64bincc.exe”. I’ve tried to set the compiler explicitly but no dice. Is that the solution and what is the proper way, or is there something else? $ /mingw64/bin/cmake .. -GNinja -DQTDIR=…

---

## [Needs endforeach() a lable with older cmake version?](https://discourse.cmake.org/t/needs-endforeach-a-lable-with-older-cmake-version/2442)

<div class="topic-metadata">

**Author:** [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Replies:** 1\
**Last updated:** [December 29, 2020, 4:05pm UTC](https://discourse.cmake.org/t/needs-endforeach-a-lable-with-older-cmake-version/2442 "2020-12-29T16:05:07Z")

</div>

Removing the arguments from endforeach() and endfunction() will not work with older versions of CMake, they were only made optional in CMake 3.14. Is that true?

---

## [install works only for RUNTIME](https://discourse.cmake.org/t/install-works-only-for-runtime/2438)

<div class="topic-metadata">

**Author:** [@aopaw](https://discourse.cmake.org/u/aopaw)\
**Replies:** 6\
**Last updated:** [December 29, 2020, 6:41am UTC](https://discourse.cmake.org/t/install-works-only-for-runtime/2438 "2020-12-29T06:41:13Z")

</div>

Hello, I try to solve generating 3rd-party .dll files to the executable folder or install folder with install(TARGETS). The install works only for RUNTIME but not for LIBRARY others. Here is my code: INSTALL(TARGETS ${…

---

## [Including functions/macros with target export ?](https://discourse.cmake.org/t/including-functions-macros-with-target-export/2440)

<div class="topic-metadata">

**Author:** [@Nicholas\_Yue](https://discourse.cmake.org/u/Nicholas_Yue)\
**Replies:** 2\
**Last updated:** [December 29, 2020, 5:29am UTC](https://discourse.cmake.org/t/including-functions-macros-with-target-export/2440 "2020-12-29T05:29:37Z")

</div>

Hi, I am able to get export(TARGET …) working and have generated working \*Config.cmake file There are some cmake macros and functions that I would like to include for the convenience of the developers using the package…

---

## [How to blacklist Qt AUTO\* files](https://discourse.cmake.org/t/how-to-blacklist-qt-auto-files/2433)

<div class="topic-metadata">

**Author:** [@Dakon](https://discourse.cmake.org/u/Dakon)\
**Replies:** 1\
**Last updated:** [December 28, 2020, 8:31pm UTC](https://discourse.cmake.org/t/how-to-blacklist-qt-auto-files/2433 "2020-12-28T20:31:56Z")

</div>

I use CMAKE\_AUTO\* for several of my Qt projects. However, the files generated by this cause some unneeded noise that I would like to avoid. -the files show up in coverage reports, where I don’t want them -if I set CLA…

---

## [Detect old/new GCC ABI](https://discourse.cmake.org/t/detect-old-new-gcc-abi/2431)

<div class="topic-metadata">

**Author:** [@mmoelle1](https://discourse.cmake.org/u/mmoelle1)\
**Replies:** 1\
**Last updated:** [December 28, 2020, 4:15pm UTC](https://discourse.cmake.org/t/detect-old-new-gcc-abi/2431 "2020-12-28T16:15:02Z")

</div>

Dear all, Is there an approved way to detect if the compiler uses the pre-cxx11 ABI or the cxx11 ABI? In one of my projects I let CMake download libtorch and link my c++ code to it. To the best of my knowledge checking …

---

## [Can't find docstring display in QT cmake-gui](https://discourse.cmake.org/t/cant-find-docstring-display-in-qt-cmake-gui/2410)

<div class="topic-metadata">

**Author:** [@sse](https://discourse.cmake.org/u/sse)\
**Replies:** 2\
**Last updated:** [December 27, 2020, 9:39pm UTC](https://discourse.cmake.org/t/cant-find-docstring-display-in-qt-cmake-gui/2410 "2020-12-27T21:39:41Z")

</div>

In curses ccmake it’s there in a kind of status bar at the bottom, but in the QT GUI I don’t see it. I also did not find a configuration option to enable it. Is it really missing, or didn’t I look at the right place? V…

---

## [VS generator add switch before /link switch](https://discourse.cmake.org/t/vs-generator-add-switch-before-link-switch/2425)

<div class="topic-metadata">

**Author:** [@amontse](https://discourse.cmake.org/u/amontse)\
**Replies:** 1\
**Last updated:** [December 24, 2020, 9:24am UTC](https://discourse.cmake.org/t/vs-generator-add-switch-before-link-switch/2425 "2020-12-24T09:24:19Z")

</div>

Hello, The following mimic command to be run during the Link stage is generated by CMake with VS generator: cl.exe /Fe"out.exe" main.obj /Zi /WX- /MDd /nologo /link /machine:x64 kernel32.lib user32.lib gdi32.lib winspo…

---

## [Kitware/CMake/Tests/VSWindowsFormsResx/CMakeLists.txt: Line 34. Purpose?](https://discourse.cmake.org/t/kitware-cmake-tests-vswindowsformsresx-cmakelists-txt-line-34-purpose/2412)

<div class="topic-metadata">

**Author:** [@Henripru](https://discourse.cmake.org/u/Henripru)\
**Replies:** 0\
**Last updated:** [December 22, 2020, 11:28pm UTC](https://discourse.cmake.org/t/kitware-cmake-tests-vswindowsformsresx-cmakelists-txt-line-34-purpose/2412 "2020-12-22T23:28:07Z")

</div>

Setting up a cmake build for a windows forms application for the first time. Kitware/CMake/Tests/VSWindowsFormsResx/CMakeLists.txt line 34: set(TARGET\_LIBRARIES ${SYSLIBS}). Can someone please explain what this does? M…

---

## [FetchContent path handling changed?](https://discourse.cmake.org/t/fetchcontent-path-handling-changed/2400)

<div class="topic-metadata">

**Author:** [@fry](https://discourse.cmake.org/u/fry)\
**Replies:** 8\
**Last updated:** [December 22, 2020, 2:07pm UTC](https://discourse.cmake.org/t/fetchcontent-path-handling-changed/2400 "2020-12-22T14:07:11Z")

</div>

I have a project that does this: set(JAMBA\_ROOT\_DIR "../../pongasoft/jamba") ... include(FetchContent) if(JAMBA\_ROOT\_DIR) # instructs FetchContent to not download or update but use the location instead set(FETCHCON…

---

## [How to delete or rename an imported target using cmake?](https://discourse.cmake.org/t/how-to-delete-or-rename-an-imported-target-using-cmake/2372)

<div class="topic-metadata">

**Author:** [@sunshine\_boycn](https://discourse.cmake.org/u/sunshine_boycn)\
**Replies:** 2\
**Last updated:** [December 21, 2020, 12:42am UTC](https://discourse.cmake.org/t/how-to-delete-or-rename-an-imported-target-using-cmake/2372 "2020-12-21T00:42:24Z")

</div>

Dear every one: When I was using CMake, I encounter a problem. I am trying to use ccd lib from github for my project. However, the ccd lib exports ccd-targets.cmake using the same name for different configurations suc…

---

## [CMake's add\_custom\_command doesnt trigger rebuild of library](https://discourse.cmake.org/t/cmakes-add-custom-command-doesnt-trigger-rebuild-of-library/2376)

<div class="topic-metadata">

**Author:** [@skreyer](https://discourse.cmake.org/u/skreyer)\
**Replies:** 2\
**Last updated:** [December 18, 2020, 12:00pm UTC](https://discourse.cmake.org/t/cmakes-add-custom-command-doesnt-trigger-rebuild-of-library/2376 "2020-12-18T12:00:18Z")

</div>

Hello, Iam using CMake together with ninja to build a library. The library is depending on some code which may be generated before-hand by a custom command. The source for this code is within the source-tree and it must…

---

## [How to use target\_compile\_options only for Debug build?](https://discourse.cmake.org/t/how-to-use-target-compile-options-only-for-debug-build/2388)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 4\
**Last updated:** [December 17, 2020, 3:53pm UTC](https://discourse.cmake.org/t/how-to-use-target-compile-options-only-for-debug-build/2388 "2020-12-17T15:53:31Z")

</div>

I want to add gcc compiler option -Og for Debug builds only. I have tried: add\_compile\_options("$\<$\<CONFIG:DEBUG\>:-Og\>") but that does not seem to work. I believe target\_compile\_options is preferred. How would I use …

---

## [cmake generates compiler options not supported](https://discourse.cmake.org/t/cmake-generates-compiler-options-not-supported/2391)

<div class="topic-metadata">

**Author:** [@jfavre](https://discourse.cmake.org/u/jfavre)\
**Replies:** 2\
**Last updated:** [December 17, 2020, 3:36pm UTC](https://discourse.cmake.org/t/cmake-generates-compiler-options-not-supported/2391 "2020-12-17T15:36:46Z")

</div>

While compiling ParaView 5.9, my cmake (v3.19.2) generates compilation options which my compiler does not support. How can I prevent that? cd /run/user/1100/ParaView/ParaViewBuild/VTK/Wrapping/Python && /scratch/e1000/…

---

## [Have a log file with a number increment every time ctest is run](https://discourse.cmake.org/t/have-a-log-file-with-a-number-increment-every-time-ctest-is-run/2325)

<div class="topic-metadata">

**Author:** [@jverdicchio](https://discourse.cmake.org/u/jverdicchio)\
**Replies:** 2\
**Last updated:** [December 17, 2020, 3:12pm UTC](https://discourse.cmake.org/t/have-a-log-file-with-a-number-increment-every-time-ctest-is-run/2325 "2020-12-17T15:12:13Z")

</div>

Our group’s BASH driven test suite automatically increments the results to a log file: run001.log and run001.sum next would be run002.log and run002.sum I’m looking at converting the suite to run under CTest. My ini…

---

## [add linker/archive options before and after a target](https://discourse.cmake.org/t/add-linker-archive-options-before-and-after-a-target/2373)

<div class="topic-metadata">

**Author:** [@gbug](https://discourse.cmake.org/u/gbug)\
**Replies:** 3\
**Last updated:** [December 15, 2020, 9:12pm UTC](https://discourse.cmake.org/t/add-linker-archive-options-before-and-after-a-target/2373 "2020-12-15T21:12:02Z")

</div>

I have a library which symbols should be imported to an app despite the fact they aren’t used explicitly there. The purpose of the library is to execute static constructors and thus make itself available to an app at run…

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

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