# Usage

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

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

**Page:** 17

---

## [Multiple compiler link problems](https://discourse.cmake.org/t/multiple-compiler-link-problems/13346)

<div class="topic-metadata">

**Author:** [@ramcdona](https://discourse.cmake.org/u/ramcdona)\
**Replies:** 1\
**Last updated:** [January 11, 2025, 6:57pm UTC](https://discourse.cmake.org/t/multiple-compiler-link-problems/13346 "2025-01-11T18:57:01Z")

</div>

For $reasons$, I need to build my project as libraries using different compilers and then link them together. I am on MacOS and am trying to blend XCode and GCC. I’ve set up a MWE on GitHub here with a longer explanati…

---

## [Customize the behavior of "ctest -T test" and "ctest -T coverage"](https://discourse.cmake.org/t/customize-the-behavior-of-ctest-t-test-and-ctest-t-coverage/13369)

<div class="topic-metadata">

**Author:** [@RichS](https://discourse.cmake.org/u/RichS)\
**Replies:** 0\
**Last updated:** [January 10, 2025, 5:33pm UTC](https://discourse.cmake.org/t/customize-the-behavior-of-ctest-t-test-and-ctest-t-coverage/13369 "2025-01-10T17:33:23Z")

</div>

Is there a way to customize what ctest does when using the “-T test” and “-T coverage” arguments? I have a project where I would like to easily limit which tests run and normally I use labels for that as in “ctest -L ni…

---

## [Issue rebuilding main application after separate library build](https://discourse.cmake.org/t/issue-rebuilding-main-application-after-separate-library-build/13363)

<div class="topic-metadata">

**Author:** [@Murillo\_Teixeira](https://discourse.cmake.org/u/Murillo_Teixeira)\
**Replies:** 0\
**Last updated:** [January 9, 2025, 8:13pm UTC](https://discourse.cmake.org/t/issue-rebuilding-main-application-after-separate-library-build/13363 "2025-01-09T20:13:12Z")

</div>

I’m facing a problem with my CMake project involvind a shared library and a main application, where building the library separetly breaks the build process for the main application. This is a simplified version of the p…

---

## [A library in multiple directories](https://discourse.cmake.org/t/a-library-in-multiple-directories/13360)

<div class="topic-metadata">

**Author:** [@rsalz](https://discourse.cmake.org/u/rsalz)\
**Replies:** 1\
**Last updated:** [January 9, 2025, 7:37pm UTC](https://discourse.cmake.org/t/a-library-in-multiple-directories/13360 "2025-01-09T19:37:15Z")

</div>

I’m building two libraries and bunch of programs. Assume I have one of each since I can copy the recipe. Call them libssl and openssl. Do I build them in the toplevel CMakeList file? I prefer to define and build them i…

---

## [Cpack multi config packaging overwrites the binaries](https://discourse.cmake.org/t/cpack-multi-config-packaging-overwrites-the-binaries/13344)

<div class="topic-metadata">

**Author:** [@Alaa\_Mahran](https://discourse.cmake.org/u/Alaa_Mahran)\
**Replies:** 2\
**Last updated:** [January 9, 2025, 11:08am UTC](https://discourse.cmake.org/t/cpack-multi-config-packaging-overwrites-the-binaries/13344 "2025-01-09T11:08:25Z")

</div>

I’m using ninja multi configuration to configure my project and building both debug and release versions of the embedded software When using Cpack to package both configurations, I end up with only one set of binaries, …

---

## [About \_GLIBCXX\_USE\_CXX11\_ABI](https://discourse.cmake.org/t/about-glibcxx-use-cxx11-abi/10833)

<div class="topic-metadata">

**Author:** [@Marc\_Salvati](https://discourse.cmake.org/u/Marc_Salvati)\
**Replies:** 2\
**Last updated:** [January 8, 2025, 4:44pm UTC](https://discourse.cmake.org/t/about-glibcxx-use-cxx11-abi/10833 "2025-01-08T16:44:37Z")

</div>

We are developping plugins for applications that just recently switch to the new C++ ABI on linux (Dual ABI) So here is my problem. I need to compile my plugins with –for the new ABI target\_compile\_definitions(${targe…

---

## [Tried to set CUDACXX/CUDA\_PATH etc., but failed to find nvcc](https://discourse.cmake.org/t/tried-to-set-cudacxx-cuda-path-etc-but-failed-to-find-nvcc/13352)

<div class="topic-metadata">

**Author:** [@workitmakeitdoit](https://discourse.cmake.org/u/workitmakeitdoit)\
**Replies:** 0\
**Last updated:** [January 8, 2025, 3:04pm UTC](https://discourse.cmake.org/t/tried-to-set-cudacxx-cuda-path-etc-but-failed-to-find-nvcc/13352 "2025-01-08T15:04:22Z")

</div>

I can’t seem to install tensorrt on Manjaro, and it seems to come down to a CMake issue. I have nvcc installed at /opt/cuda/bin/nvcc and during tensorrt’s build, I get: CMake Error at /usr/share/cmake/Modules/Internal/…

---

## [installing CTest files alongside the installed test binary](https://discourse.cmake.org/t/installing-ctest-files-alongside-the-installed-test-binary/13350)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 0\
**Last updated:** [January 8, 2025, 10:17am UTC](https://discourse.cmake.org/t/installing-ctest-files-alongside-the-installed-test-binary/13350 "2025-01-08T10:17:13Z")

</div>

Among other things, CTest offers a way to standardize test result outputs. By default, it cmake testing framework issues cmake test files inside the build true. To keep benefits of CTest outside of the build/install pro…

---

## [How to set dyld path via FindPackage(Boost)?](https://discourse.cmake.org/t/how-to-set-dyld-path-via-findpackage-boost/13323)

<div class="topic-metadata">

**Author:** [@Vdaleke](https://discourse.cmake.org/u/Vdaleke)\
**Replies:** 1\
**Last updated:** [January 8, 2025, 10:10am UTC](https://discourse.cmake.org/t/how-to-set-dyld-path-via-findpackage-boost/13323 "2025-01-08T10:10:07Z")

</div>

I encountered a problem: I have myself-built boost libraries which FindBoost module finds perfectly, but when I look built binary with otool -L I see not full paths of boost libraries, but only their names: (venv) ➜ t…

---

## [Do INTERFACE FILE\_SETs not propagate along target dependencies?](https://discourse.cmake.org/t/do-interface-file-sets-not-propagate-along-target-dependencies/13336)

<div class="topic-metadata">

**Author:** [@marco1475](https://discourse.cmake.org/u/marco1475)\
**Replies:** 0\
**Last updated:** [January 6, 2025, 10:34pm UTC](https://discourse.cmake.org/t/do-interface-file-sets-not-propagate-along-target-dependencies/13336 "2025-01-06T22:34:10Z")

</div>

I have a header-only library: add\_library( "Lib" INTERFACE ) target\_sources( "Lib" INTERFACE FILE\_SET myHeader TYPE HEADERS FILES "${CMAKE\_CURRENT\_SOURCE\_DIR}/myHeader.h" ) and an…

---

## [Generated Makefile build command gives errors as it has quotes in the build command](https://discourse.cmake.org/t/generated-makefile-build-command-gives-errors-as-it-has-quotes-in-the-build-command/13331)

<div class="topic-metadata">

**Author:** [@pj0585](https://discourse.cmake.org/u/pj0585)\
**Replies:** 9\
**Last updated:** [January 6, 2025, 8:50pm UTC](https://discourse.cmake.org/t/generated-makefile-build-command-gives-errors-as-it-has-quotes-in-the-build-command/13331 "2025-01-06T20:50:40Z")

</div>

Hi, I have created a CMakeLists.txt for cross compiling my C project. I have enabled many warning options and need many -D options as well. While adding these to target\_compile\_options() I have added quotes to make it l…

---

## [Help with cmake for mongoose web](https://discourse.cmake.org/t/help-with-cmake-for-mongoose-web/13311)

<div class="topic-metadata">

**Author:** [@klaarnou](https://discourse.cmake.org/u/klaarnou)\
**Replies:** 7\
**Last updated:** [January 6, 2025, 5:17pm UTC](https://discourse.cmake.org/t/help-with-cmake-for-mongoose-web/13311 "2025-01-06T17:17:13Z")

</div>

Hello. I am new to CMake. I want to use CMake to build mongoose web lib into my project. I use VSCode on Windows 11. CMakeLists.txt and Web.cpp are listed below. The dir structure : CMakeLists.txt and Web.ccp are in r…

---

## [Use MS cl.exe as compiler with MSYS Makefiles.](https://discourse.cmake.org/t/use-ms-cl-exe-as-compiler-with-msys-makefiles/13329)

<div class="topic-metadata">

**Author:** [@leso](https://discourse.cmake.org/u/leso)\
**Replies:** 0\
**Last updated:** [January 3, 2025, 4:13pm UTC](https://discourse.cmake.org/t/use-ms-cl-exe-as-compiler-with-msys-makefiles/13329 "2025-01-03T16:13:56Z")

</div>

Is the combination to use Microsoft’s compiler cl.exe and MSYS Makefiles possible at all? I have been struggling many hours but don’t get it right.

---

## [check\_ipo\_supported taking a long time](https://discourse.cmake.org/t/check-ipo-supported-taking-a-long-time/10755)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 7\
**Last updated:** [January 2, 2025, 2:24pm UTC](https://discourse.cmake.org/t/check-ipo-supported-taking-a-long-time/10755 "2025-01-02T14:24:13Z")

</div>

Hi, I usually configurate and generate batch of projects with mostly all the same options. I observed that my configuration time was very long (several seconds) for each project. Doing some profiling, I observed that a…

---

## [How to set\_source\_files\_properties on top and use in sub?](https://discourse.cmake.org/t/how-to-set-source-files-properties-on-top-and-use-in-sub/13104)

<div class="topic-metadata">

**Author:** [@sdking](https://discourse.cmake.org/u/sdking)\
**Replies:** 0\
**Last updated:** [December 2, 2024, 9:25am UTC](https://discourse.cmake.org/t/how-to-set-source-files-properties-on-top-and-use-in-sub/13104 "2024-12-02T09:25:28Z")

</div>

Here is my project structure: ├── build ├── CMakeLists.txt ├── foo.cmake ├── src1.c ├── src2.c ├── sub1 │ ├── CMakeLists.txt │ └── module\_foo │ └── CMakeLists.txt └── sub2 ├── CMakeLists.txt └── module…

---

## [Installing a dependent program created by custom command with EXCLUDE\_FROM\_ALL active](https://discourse.cmake.org/t/installing-a-dependent-program-created-by-custom-command-with-exclude-from-all-active/10826)

<div class="topic-metadata">

**Author:** [@Chardrazle](https://discourse.cmake.org/u/Chardrazle)\
**Replies:** 1\
**Last updated:** [January 1, 2025, 10:41pm UTC](https://discourse.cmake.org/t/installing-a-dependent-program-created-by-custom-command-with-exclude-from-all-active/10826 "2025-01-01T22:41:16Z")

</div>

This scenario has a target (static lib in the example) that acquires a dependent file via a custom command. The lib is not required by the “all” target, so that part of the source tree is brought in with EXCLUDE\_FROM\_AL…

---

## [Supporting CMake in kondo](https://discourse.cmake.org/t/supporting-cmake-in-kondo/10776)

<div class="topic-metadata">

**Author:** [@tbillington](https://discourse.cmake.org/u/tbillington)\
**Replies:** 1\
**Last updated:** [January 1, 2025, 9:28pm UTC](https://discourse.cmake.org/t/supporting-cmake-in-kondo/10776 "2025-01-01T21:28:47Z")

</div>

Hey! I maintain an open source polyglot project cleaning tool called kondo. Picture attached for clarity kondo has had very basic support for cmake projects for a while, however with v2 of the project underway I’m lo…

---

## [Calling CMake "default" Find\<Module\> from a user defined one](https://discourse.cmake.org/t/calling-cmake-default-find-module-from-a-user-defined-one/10723)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 2\
**Last updated:** [January 1, 2025, 9:16pm UTC](https://discourse.cmake.org/t/calling-cmake-default-find-module-from-a-user-defined-one/10723 "2025-01-01T21:16:58Z")

</div>

Hi, Due to some peculiar setup, I need to add a bit of custom logic to the behavior of CMake provided Find. The expected behavior for my projects would be: when calling find\_package(\<Module\> ... it should call my versi…

---

## [Struggling with generated headers](https://discourse.cmake.org/t/struggling-with-generated-headers/10437)

<div class="topic-metadata">

**Author:** [@Ecologist0045](https://discourse.cmake.org/u/Ecologist0045)\
**Replies:** 3\
**Last updated:** [January 1, 2025, 9:05pm UTC](https://discourse.cmake.org/t/struggling-with-generated-headers/10437 "2025-01-01T21:05:05Z")

</div>

I’m using SBE, which generates headers based on a schema (à la something like protobuf). I can run it by hand like: $ mkdir build/generated $ java -Dsbe.target.language=CPP -Dsbe.output.dir=build/generated -jar ../simp…

---

## [cmake does not create rules to create .lib target.](https://discourse.cmake.org/t/cmake-does-not-create-rules-to-create-lib-target/13211)

<div class="topic-metadata">

**Author:** [@Marco\_Antoniotti](https://discourse.cmake.org/u/Marco_Antoniotti)\
**Replies:** 10\
**Last updated:** [December 31, 2024, 3:05pm UTC](https://discourse.cmake.org/t/cmake-does-not-create-rules-to-create-lib-target/13211 "2024-12-31T15:05:43Z")

</div>

Hi I have a build that is very simple and essentially creates a shared library (an Emacs module). The subdirectory CMakeLists.txt file just contains the following. The top CMakeLists.txt just contains, essentially, the…

---

## [FortranCInterface\_VERIFY and FPIC](https://discourse.cmake.org/t/fortrancinterface-verify-and-fpic/13294)

<div class="topic-metadata">

**Author:** [@KTRR](https://discourse.cmake.org/u/KTRR)\
**Replies:** 0\
**Last updated:** [December 31, 2024, 12:15am UTC](https://discourse.cmake.org/t/fortrancinterface-verify-and-fpic/13294 "2024-12-31T00:15:18Z")

</div>

Is there a correct way to have the FortranCInterface\_VERIFY function use “-fpic”? Setting CMAKE\_POSITION\_INDEPENDENT\_CODE has no effect. Temporarily appending -fpic to CMAKE\_Fortran\_FLAGS works but feels hacky.

---

## [opencv2/opencv.hpp' file not found](https://discourse.cmake.org/t/opencv2-opencv-hpp-file-not-found/13274)

<div class="topic-metadata">

**Author:** [@omersmsr](https://discourse.cmake.org/u/omersmsr)\
**Replies:** 2\
**Last updated:** [December 29, 2024, 8:59pm UTC](https://discourse.cmake.org/t/opencv2-opencv-hpp-file-not-found/13274 "2024-12-29T20:59:36Z")

</div>

I have been trying to solve this problem for hours. How do ı solve the problem?

---

## [Sarif viewer for cdash](https://discourse.cmake.org/t/sarif-viewer-for-cdash/13282)

<div class="topic-metadata">

**Author:** [@pkiran](https://discourse.cmake.org/u/pkiran)\
**Replies:** 0\
**Last updated:** [December 29, 2024, 9:14am UTC](https://discourse.cmake.org/t/sarif-viewer-for-cdash/13282 "2024-12-29T09:14:05Z")

</div>

Hello, Just wondering if sarif integration is possible in cdash, even for just viewing. This would increase the tools supported by a considerable amount and cover a wide variety of use cases - static analysis, linters, …

---

## [Use CMake without compiling in VS2022?](https://discourse.cmake.org/t/use-cmake-without-compiling-in-vs2022/13278)

<div class="topic-metadata">

**Author:** [@Markus\_Wagner](https://discourse.cmake.org/u/Markus_Wagner)\
**Replies:** 1\
**Last updated:** [December 28, 2024, 10:01pm UTC](https://discourse.cmake.org/t/use-cmake-without-compiling-in-vs2022/13278 "2024-12-28T22:01:43Z")

</div>

Hello! I am a absolute CMake Newbie. So please excuse a maybe dumb question. Is it possible to use CMake only for collecting files, zip them and install them in a predefined folder? Why?: I have a VS2022 Project for c…

---

## [file(GET\_RUNTIME\_DEPENDENCIES) gives error "Resolved path is not absolute" on OS X](https://discourse.cmake.org/t/file-get-runtime-dependencies-gives-error-resolved-path-is-not-absolute-on-os-x/13242)

<div class="topic-metadata">

**Author:** [@KKhanhH](https://discourse.cmake.org/u/KKhanhH)\
**Replies:** 7\
**Last updated:** [December 27, 2024, 10:28am UTC](https://discourse.cmake.org/t/file-get-runtime-dependencies-gives-error-resolved-path-is-not-absolute-on-os-x/13242 "2024-12-27T10:28:21Z")

</div>

I’m using CMake on OS X and I’m trying to build an executable with linked shared libraries. I’d like to have the install step copy the shared libraries next to the executable file, so I’m using the RUNTIME\_DEPENDENCIES o…

---

## [changing visual studio cmake internal generator](https://discourse.cmake.org/t/changing-visual-studio-cmake-internal-generator/8139)

<div class="topic-metadata">

**Author:** [@Robert180](https://discourse.cmake.org/u/Robert180)\
**Replies:** 6\
**Last updated:** [December 23, 2024, 6:13pm UTC](https://discourse.cmake.org/t/changing-visual-studio-cmake-internal-generator/8139 "2024-12-23T18:13:36Z")

</div>

I download Visual Studio 2022 . Inside Visual studio folders , there is CMake folder . The CMake package is installed with Visual Studio 2022 . When I create a new CMake project in Visual Studio 2022 , The Generator is N…

---

## [Use case for the "const" condition type](https://discourse.cmake.org/t/use-case-for-the-const-condition-type/3856)

<div class="topic-metadata">

**Author:** [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Replies:** 2\
**Last updated:** [December 21, 2024, 1:24pm UTC](https://discourse.cmake.org/t/use-case-for-the-const-condition-type/3856 "2024-12-21T13:24:17Z")

</div>

Just curious if there was a particular use case in mind for the "const" type in a condition object? I’m struggling to see how it serves any useful purpose, especially given that it does not even support macro evaluation.…

---

## [configuring link time optimization options](https://discourse.cmake.org/t/configuring-link-time-optimization-options/13210)

<div class="topic-metadata">

**Author:** [@adaldev](https://discourse.cmake.org/u/adaldev)\
**Replies:** 0\
**Last updated:** [December 16, 2024, 2:52pm UTC](https://discourse.cmake.org/t/configuring-link-time-optimization-options/13210 "2024-12-16T14:52:37Z")

</div>

I found many issues on gitlab.kitware regarding this feature (https://gitlab.kitware.com/cmake/cmake/-/issues/26353 for instance). What is the current status, is there ways to fine tune a bit LTO. At least I would like …

---

## [XCODE\_EMBED\_FRAMEWORKS\_CODE\_SIGN\_ON\_COPY issue](https://discourse.cmake.org/t/xcode-embed-frameworks-code-sign-on-copy-issue/13214)

<div class="topic-metadata">

**Author:** [@etjernlund](https://discourse.cmake.org/u/etjernlund)\
**Replies:** 2\
**Last updated:** [December 18, 2024, 8:40am UTC](https://discourse.cmake.org/t/xcode-embed-frameworks-code-sign-on-copy-issue/13214 "2024-12-18T08:40:12Z")

</div>

I have two iOS apps, both depending on the same framework. set\_target\_properties(FooApp PROPERTIES XCODE\_EMBED\_FRAMEWORKS MyFramework XCODE\_EMBED\_FRAMEWORKS\_CODE\_SIGN\_ON\_COPY ON) set\_target\_properties(BarApp PROPE…

---

## [CMake Tutorial Step 2 Exercise 1 build failed](https://discourse.cmake.org/t/cmake-tutorial-step-2-exercise-1-build-failed/13209)

<div class="topic-metadata">

**Author:** [@Travert](https://discourse.cmake.org/u/Travert)\
**Replies:** 2\
**Last updated:** [December 16, 2024, 5:58pm UTC](https://discourse.cmake.org/t/cmake-tutorial-step-2-exercise-1-build-failed/13209 "2024-12-16T17:58:27Z")

</div>

Hello, just started working with CMake and was going through the tutorial fine until step 2 exercise 1, Creating a library. I completed all the TODOs but when I go to build the solution, I get an error: \[project path\]St…

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

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