# Code

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

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

**Page:** 41

---

## [CPack+NSIS adding version/product name/product name/copyright to the "Details Tab"](https://discourse.cmake.org/t/cpack-nsis-adding-version-product-name-product-name-copyright-to-the-details-tab/6775)

<div class="topic-metadata">

**Author:** [@scottaronbloom](https://discourse.cmake.org/u/scottaronbloom)\
**Replies:** 1\
**Last updated:** [November 3, 2022, 5:07pm UTC](https://discourse.cmake.org/t/cpack-nsis-adding-version-product-name-product-name-copyright-to-the-details-tab/6775 "2022-11-03T17:07:33Z")

</div>

When using the NSIS CPack, is there any way to have it set the executable Properties? Usually you add a RC file to a home grown EXE/DLL to do this, or run rcedit after it exists. I have the version and appname etc set …

---

## [How to make a subproject export a link directory of a library dependency](https://discourse.cmake.org/t/how-to-make-a-subproject-export-a-link-directory-of-a-library-dependency/6111)

<div class="topic-metadata">

**Author:** [@rturrado](https://discourse.cmake.org/u/rturrado)\
**Replies:** 10\
**Last updated:** [November 2, 2022, 11:10pm UTC](https://discourse.cmake.org/t/how-to-make-a-subproject-export-a-link-directory-of-a-library-dependency/6111 "2022-11-02T23:10:17Z")

</div>

I have this dependency graph: my\_project |—\> static linking perceptualdiff |—\> (static linking with dynamic loading) FreeImage (built as a shared library) I can correctly build perceptualdiff on its own. …

---

## ["fconstexpr-steps" compiler flag](https://discourse.cmake.org/t/fconstexpr-steps-compiler-flag/6748)

<div class="topic-metadata">

**Author:** [@Margulus](https://discourse.cmake.org/u/Margulus)\
**Replies:** 6\
**Last updated:** [October 28, 2022, 2:45pm UTC](https://discourse.cmake.org/t/fconstexpr-steps-compiler-flag/6748 "2022-10-28T14:45:23Z")

</div>

So I have a single cuda file with a c++ dependency (e.g. #include \<ecc/curves/grumpkin/grumpkin.hpp\>). Nvcc is compiling the cuda file with a dependency that relies on the compiler flag “fconstexpr-steps=100000000” being…

---

## [Question about \`block\` command with PROPAGATE option](https://discourse.cmake.org/t/question-about-block-command-with-propagate-option/6744)

<div class="topic-metadata">

**Author:** [@jbadwaik](https://discourse.cmake.org/u/jbadwaik)\
**Replies:** 2\
**Last updated:** [October 28, 2022, 6:33am UTC](https://discourse.cmake.org/t/question-about-block-command-with-propagate-option/6744 "2022-10-28T06:33:08Z")

</div>

Does block(PROPAGATE) feature work for cache entries? If not, is there a way to set cache variables in parent scope?

---

## [FetchContent - Automatically packaging needed files](https://discourse.cmake.org/t/fetchcontent-automatically-packaging-needed-files/6741)

<div class="topic-metadata">

**Author:** [@Clement-Jean](https://discourse.cmake.org/u/Clement-Jean)\
**Replies:** 4\
**Last updated:** [October 28, 2022, 4:35am UTC](https://discourse.cmake.org/t/fetchcontent-automatically-packaging-needed-files/6741 "2022-10-28T04:35:06Z")

</div>

I’m tring to package files needed to compile a sub library in my project. The project is a collection of multiple libraries and i would like to let users use all of them or pick only the one they need through FetchConten…

---

## [RPATH incorrect when clang links a library compiled with gfortran](https://discourse.cmake.org/t/rpath-incorrect-when-clang-links-a-library-compiled-with-gfortran/6720)

<div class="topic-metadata">

**Author:** [@cianciosa](https://discourse.cmake.org/u/cianciosa)\
**Replies:** 1\
**Last updated:** [October 25, 2022, 9:54pm UTC](https://discourse.cmake.org/t/rpath-incorrect-when-clang-links-a-library-compiled-with-gfortran/6720 "2022-10-25T21:54:35Z")

</div>

I’m running into a runtime problem that I have never had before. I have a bunch of projects spread out across multiple GitHub repositories. A parent repository collects coordinates all this using a bunch of FetchContent …

---

## [FetchContent with mariadb-connector-cpp](https://discourse.cmake.org/t/fetchcontent-with-mariadb-connector-cpp/6712)

<div class="topic-metadata">

**Author:** [@sampsont](https://discourse.cmake.org/u/sampsont)\
**Replies:** 3\
**Last updated:** [October 25, 2022, 3:49pm UTC](https://discourse.cmake.org/t/fetchcontent-with-mariadb-connector-cpp/6712 "2022-10-25T15:49:58Z")

</div>

I’m using FetchContent to satisfy the mariadb-connector-cpp dependency for poco. I’m cross-compiling, so I don’t want the library to be installed on my normal system place. include(FetchContent) FetchContent\_Declare( …

---

## [Quiet Make Output for Normal Builds](https://discourse.cmake.org/t/quiet-make-output-for-normal-builds/6716)

<div class="topic-metadata">

**Author:** [@Drue\_Peters](https://discourse.cmake.org/u/Drue_Peters)\
**Replies:** 3\
**Last updated:** [October 25, 2022, 3:27pm UTC](https://discourse.cmake.org/t/quiet-make-output-for-normal-builds/6716 "2022-10-25T15:27:59Z")

</div>

Hello, I’ve Googled and can’t find any answers on this. How do I keep Make, when generated from CMake, from outputing text like: Consolidate compiler generated dependencies of target \[ 29%\] Built target Target Buildin…

---

## [Undefined reference to function defined in another HPP file](https://discourse.cmake.org/t/undefined-reference-to-function-defined-in-another-hpp-file/6710)

<div class="topic-metadata">

**Author:** [@AD2605](https://discourse.cmake.org/u/AD2605)\
**Replies:** 3\
**Last updated:** [October 24, 2022, 10:00am UTC](https://discourse.cmake.org/t/undefined-reference-to-function-defined-in-another-hpp-file/6710 "2022-10-24T10:00:00Z")

</div>

Hello All, My project directory is as follows - DIR \* main.cpp \* test.hpp \* test.cpp And code in the above mentioned files is as follows - main.cpp - #include \<opencv2/opencv.hpp\> #include "test.hpp" in…

---

## [How to generate FAT STATIC lib with CMake Preset](https://discourse.cmake.org/t/how-to-generate-fat-static-lib-with-cmake-preset/6655)

<div class="topic-metadata">

**Author:** [@DrAuraHxC](https://discourse.cmake.org/u/DrAuraHxC)\
**Replies:** 8\
**Last updated:** [October 21, 2022, 2:16pm UTC](https://discourse.cmake.org/t/how-to-generate-fat-static-lib-with-cmake-preset/6655 "2022-10-21T14:16:08Z")

</div>

Hi, I would like to be able to compile some libraries in “fat” mode, i.e. to have a library that combines the arm64 and x86\_64 version in one file. I can do it very well for macOS by only setting CMAKE\_OSX\_ARCHITECTURE…

---

## [How to remove compile flags](https://discourse.cmake.org/t/how-to-remove-compile-flags/6693)

<div class="topic-metadata">

**Author:** [@tom](https://discourse.cmake.org/u/tom)\
**Replies:** 3\
**Last updated:** [October 21, 2022, 11:42am UTC](https://discourse.cmake.org/t/how-to-remove-compile-flags/6693 "2022-10-21T11:42:44Z")

</div>

Hi all, In the codebase in which I’m currently working, there are two scenarios where I might want to remove compile flags from a target: Some targets want almost all the compile flags given by CMAKE\_CXX\_FLAGS and fri…

---

## [socket\_select\_interrupter exception](https://discourse.cmake.org/t/socket-select-interrupter-exception/6660)

<div class="topic-metadata">

**Author:** [@msilvestre](https://discourse.cmake.org/u/msilvestre)\
**Replies:** 2\
**Last updated:** [October 21, 2022, 9:00am UTC](https://discourse.cmake.org/t/socket-select-interrupter-exception/6660 "2022-10-21T09:00:44Z")

</div>

Hello there, I have a project on CMake but when running it on windows it has different behaviours if I use CLion or Visual Studio. When running on CLion I got this exception: socket\_select\_interrupter But when using …

---

## [Referencing an undefined option() is different between first & subsequent CMake runs](https://discourse.cmake.org/t/referencing-an-undefined-option-is-different-between-first-subsequent-cmake-runs/6696)

<div class="topic-metadata">

**Author:** [@steven-johnson](https://discourse.cmake.org/u/steven-johnson)\
**Replies:** 3\
**Last updated:** [October 20, 2022, 5:21pm UTC](https://discourse.cmake.org/t/referencing-an-undefined-option-is-different-between-first-subsequent-cmake-runs/6696 "2022-10-20T17:21:54Z")

</div>

Consider a CMake script something like: cmake\_dependent\_option( MYPROJECT\_ENABLE\_COOL\_FEATURE "Enable cool feature (requires MYPROJECT\_ENABLES\_EXCEPTIONS=ON)" ON "MYPROJECT\_ENABLE\_EXCEPTIONS" OFF ) ... op…

---

## [Help with using Release/Debug for external dependency (Visual Studio CMAKE)](https://discourse.cmake.org/t/help-with-using-release-debug-for-external-dependency-visual-studio-cmake/6689)

<div class="topic-metadata">

**Author:** [@JaybeeAB](https://discourse.cmake.org/u/JaybeeAB)\
**Replies:** 3\
**Last updated:** [October 19, 2022, 11:36am UTC](https://discourse.cmake.org/t/help-with-using-release-debug-for-external-dependency-visual-studio-cmake/6689 "2022-10-19T11:36:52Z")

</div>

Hi there, Apologies up front, I’m still learning CMake and using Visual Studio probably isn’t helping learn the basics (using it as its so good at debugging code). I have a CMake project in Visual Studio and I’m linkin…

---

## [Help with integrating an external dependency that does not use CMake](https://discourse.cmake.org/t/help-with-integrating-an-external-dependency-that-does-not-use-cmake/6685)

<div class="topic-metadata">

**Author:** [@Chris\_Apple](https://discourse.cmake.org/u/Chris_Apple)\
**Replies:** 8\
**Last updated:** [October 18, 2022, 8:50pm UTC](https://discourse.cmake.org/t/help-with-integrating-an-external-dependency-that-does-not-use-cmake/6685 "2022-10-18T20:50:33Z")

</div>

Hi, I’m trying to integrate a number of dependencies into my project. Many of these are cmake based, so integration is quick and easy. Unfortunately I’m having a heck of a time getting the non-cmake ones to play ball. H…

---

## [How to use \`export\` command together with \`target\_include\_directories\`?](https://discourse.cmake.org/t/how-to-use-export-command-together-with-target-include-directories/6024)

<div class="topic-metadata">

**Author:** [@dbahadir](https://discourse.cmake.org/u/dbahadir)\
**Replies:** 1\
**Last updated:** [October 17, 2022, 9:00pm UTC](https://discourse.cmake.org/t/how-to-use-export-command-together-with-target-include-directories/6024 "2022-10-17T21:00:30Z")

</div>

tl;dr: How am I supposed to export the include search-path containing a target’s public headers when using the export command? I thought about trying to use the export command for a library target mylib in order to not…

---

## [Passing basic basic compiler settings to a used library](https://discourse.cmake.org/t/passing-basic-basic-compiler-settings-to-a-used-library/6421)

<div class="topic-metadata">

**Author:** [@TorstenRobitzki](https://discourse.cmake.org/u/TorstenRobitzki)\
**Replies:** 1\
**Last updated:** [October 17, 2022, 8:52pm UTC](https://discourse.cmake.org/t/passing-basic-basic-compiler-settings-to-a-used-library/6421 "2022-10-17T20:52:31Z")

</div>

I work on an open source library: GitHub - TorstenRobitzki/bluetoe: C++ Framework to build Bluetooth LE Server (GATT) The library is a mostly header only, with a few separate C++ (.cpp) files. The design of the library t…

---

## [Using boost in a modern way static AND shared](https://discourse.cmake.org/t/using-boost-in-a-modern-way-static-and-shared/6680)

<div class="topic-metadata">

**Author:** [@jshanab](https://discourse.cmake.org/u/jshanab)\
**Replies:** 1\
**Last updated:** [October 17, 2022, 6:29pm UTC](https://discourse.cmake.org/t/using-boost-in-a-modern-way-static-and-shared/6680 "2022-10-17T18:29:30Z")

</div>

I have an existing project that uses boost heavily and am converting to CMake. As a hand crafted project it uses nuget and I just cannot figure out how to make that work and I really do not want to as the linux build do…

---

## [FindPackage for using both static and shared.](https://discourse.cmake.org/t/findpackage-for-using-both-static-and-shared/6681)

<div class="topic-metadata">

**Author:** [@jshanab](https://discourse.cmake.org/u/jshanab)\
**Replies:** 0\
**Last updated:** [October 17, 2022, 3:17pm UTC](https://discourse.cmake.org/t/findpackage-for-using-both-static-and-shared/6681 "2022-10-17T15:17:10Z")

</div>

If I have 23 projects all using dynamic libs and 1 using static libs from the same provider (boost) Do I need to call Find in each project so that 22 of them can use shared and 1 of them can USE\_STATIC ON ? Is there a …

---

## [macOS: LC\_RPATH not set anymore](https://discourse.cmake.org/t/macos-lc-rpath-not-set-anymore/6648)

<div class="topic-metadata">

**Author:** [@ocroquette](https://discourse.cmake.org/u/ocroquette)\
**Replies:** 2\
**Last updated:** [October 17, 2022, 2:47pm UTC](https://discourse.cmake.org/t/macos-lc-rpath-not-set-anymore/6648 "2022-10-17T14:47:31Z")

</div>

Hi, I have a pretty complex project built on macOS. It uses IMPORTED shared libraries, as well as internal ones. The dependency graph is pretty big, but basically, the internal dylibs are depending on the imported ones …

---

## [CMAKE\_STAGING\_PREFIX can find packages in /opt in Linux Os ?](https://discourse.cmake.org/t/cmake-staging-prefix-can-find-packages-in-opt-in-linux-os/6676)

<div class="topic-metadata">

**Author:** [@dglz.hyj](https://discourse.cmake.org/u/dglz.hyj)\
**Replies:** 1\
**Last updated:** [October 17, 2022, 12:06pm UTC](https://discourse.cmake.org/t/cmake-staging-prefix-can-find-packages-in-opt-in-linux-os/6676 "2022-10-17T12:06:26Z")

</div>

I hava a project named SRVL .I build and install the project’s librart in opt/srvl and the directory structure show below: /opt/srvl/lib/cmake/ tree . └── srvl ├── SRVLConfig.cmake ├── SRVLTargets.cmake └── SRVLT…

---

## [Creating a PackageConfig for a comlicated package with components](https://discourse.cmake.org/t/creating-a-packageconfig-for-a-comlicated-package-with-components/6609)

<div class="topic-metadata">

**Author:** [@jshanab](https://discourse.cmake.org/u/jshanab)\
**Replies:** 2\
**Last updated:** [October 16, 2022, 2:28pm UTC](https://discourse.cmake.org/t/creating-a-packageconfig-for-a-comlicated-package-with-components/6609 "2022-10-16T14:28:53Z")

</div>

I am trying to use a CMake based set of libraries or framework that does not provide a PackageConfig or Find file. Because it has multiple libraries and executables, i would like to create a single PackageConfig that can…

---

## [IMPORTED\_RUNTIME\_ARTIFACTS with and without RUNTIME\_DEPENDENCY\_SET](https://discourse.cmake.org/t/imported-runtime-artifacts-with-and-without-runtime-dependency-set/6661)

<div class="topic-metadata">

**Author:** [@wuziq](https://discourse.cmake.org/u/wuziq)\
**Replies:** 8\
**Last updated:** [October 14, 2022, 9:06pm UTC](https://discourse.cmake.org/t/imported-runtime-artifacts-with-and-without-runtime-dependency-set/6661 "2022-10-14T21:06:20Z")

</div>

myLib: add\_library(myLib SHARED lib.cpp lib.h) target\_include\_directories(myLib PUBLIC ${CMAKE\_CURRENT\_LIST\_DIR}) main: add\_executable(main main.cpp) target\_link\_libraries(main PRIVATE myLib) install(TARGETS main …

---

## [INTERFACE\_SOURCES not "triggering" dependent files](https://discourse.cmake.org/t/interface-sources-not-triggering-dependent-files/6650)

<div class="topic-metadata">

**Author:** [@marstaik](https://discourse.cmake.org/u/marstaik)\
**Replies:** 1\
**Last updated:** [October 12, 2022, 7:13pm UTC](https://discourse.cmake.org/t/interface-sources-not-triggering-dependent-files/6650 "2022-10-12T19:13:41Z")

</div>

Im having an issue where I have an interface library refl, which has a bunch of header files such as foo.h, which have a custom command that produces foo.h.refl.in and foo.h.refl.init.cpp. Example of the generation rule…

---

## [CMAKE\_FIND\_LIBRARY\_PREFIXES on older CMake versions](https://discourse.cmake.org/t/cmake-find-library-prefixes-on-older-cmake-versions/6649)

<div class="topic-metadata">

**Author:** [@Scott\_Michel](https://discourse.cmake.org/u/Scott_Michel)\
**Replies:** 1\
**Last updated:** [October 12, 2022, 5:50pm UTC](https://discourse.cmake.org/t/cmake-find-library-prefixes-on-older-cmake-versions/6649 "2022-10-12T17:50:47Z")

</div>

I ran into the following while trying to configure a project on appveyor, which has CMake 3.16.2 installed, and independently with CMake 3.18.5: -- Could NOT find PNG (missing: PNG\_LIBRARY PNG\_PNG\_INCLUDE\_DIR) CMake Err…

---

## [Failed to configure preset with Clang/LLVM compilers when using CMake Tools.](https://discourse.cmake.org/t/failed-to-configure-preset-with-clang-llvm-compilers-when-using-cmake-tools/6637)

<div class="topic-metadata">

**Author:** [@hwhsu1231](https://discourse.cmake.org/u/hwhsu1231)\
**Replies:** 8\
**Last updated:** [October 12, 2022, 2:33pm UTC](https://discourse.cmake.org/t/failed-to-configure-preset-with-clang-llvm-compilers-when-using-cmake-tools/6637 "2022-10-12T14:33:05Z")

</div>

Problem Description First of all, I already installed Clang/LLVM by running the following winget command: winget install LLVM.LLVM And I tried with the following example of CMakePresets.json: ▶ Click to expand The stran…

---

## [Transitive Dependencies](https://discourse.cmake.org/t/transitive-dependencies/6645)

<div class="topic-metadata">

**Author:** [@DaAwesomeP](https://discourse.cmake.org/u/DaAwesomeP)\
**Replies:** 1\
**Last updated:** [October 12, 2022, 7:17am UTC](https://discourse.cmake.org/t/transitive-dependencies/6645 "2022-10-12T07:17:31Z")

</div>

Hello! I have two projects. projectA and projectB. Project A depends on projectB. projectB depends on system dependencies. When I build project A, I get a bunch of linker errors. projectB: cmake\_minimum\_required(VERSI…

---

## [How to specify GNU-like Clang for \`Visual Studio 16 2019\` generator?](https://discourse.cmake.org/t/how-to-specify-gnu-like-clang-for-visual-studio-16-2019-generator/6639)

<div class="topic-metadata">

**Author:** [@hwhsu1231](https://discourse.cmake.org/u/hwhsu1231)\
**Replies:** 1\
**Last updated:** [October 11, 2022, 4:49pm UTC](https://discourse.cmake.org/t/how-to-specify-gnu-like-clang-for-visual-studio-16-2019-generator/6639 "2022-10-11T16:49:06Z")

</div>

Problem Descriptions There are two types of Clang compilers after I install Clang/LLVM: clang.exe/clang++.exe: GNU-like Clang compiler clang-cl.exe: MSVC-like Clang compiler According to this issue, we can specify …

---

## [add\_custom\_command with multiple commands on windows](https://discourse.cmake.org/t/add-custom-command-with-multiple-commands-on-windows/6604)

<div class="topic-metadata">

**Author:** [@codeling](https://discourse.cmake.org/u/codeling)\
**Replies:** 2\
**Last updated:** [October 11, 2022, 3:04pm UTC](https://discourse.cmake.org/t/add-custom-command-with-multiple-commands-on-windows/6604 "2022-10-11T15:04:25Z")

</div>

I just noticed that when I do an add\_custom\_command on Windows (Visual Studio Generator, tested with 2019 and 2022), and I want to execute multiple commands for a “build step” (e.g. POST\_BUILD) (or if there is another co…

---

## [Trying to generate header file using add\_custom\_command, resulted limping build](https://discourse.cmake.org/t/trying-to-generate-header-file-using-add-custom-command-resulted-limping-build/6621)

<div class="topic-metadata">

**Author:** [@hihig2001](https://discourse.cmake.org/u/hihig2001)\
**Replies:** 6\
**Last updated:** [October 11, 2022, 7:15am UTC](https://discourse.cmake.org/t/trying-to-generate-header-file-using-add-custom-command-resulted-limping-build/6621 "2022-10-11T07:15:34Z")

</div>

Hi, I’m trying to generate a header file during build. When I changed the template file(DataTableSchema.h) and try build, ninja only executes custom command and not build a library. and next time I command build with n…

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

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