# Usage

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

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

**Page:** 12

---

## [CMakeLists.txt and Code::Blocks](https://discourse.cmake.org/t/cmakelists-txt-and-code-blocks/14071)

<div class="topic-metadata">

**Author:** [@gtafan](https://discourse.cmake.org/u/gtafan)\
**Replies:** 1\
**Last updated:** [May 16, 2025, 6:37pm UTC](https://discourse.cmake.org/t/cmakelists-txt-and-code-blocks/14071 "2025-05-16T18:37:49Z")

</div>

Some C++ project are using CMakeLists.txt, to be honest I am not a fan of it, but how to compile such project with Code::Blocks? I tried cmake-gui and was able to get as far, as this: I have selected “Specify native…

---

## [The CXX compiler identification is unknown building cross compile for Arm processor](https://discourse.cmake.org/t/the-cxx-compiler-identification-is-unknown-building-cross-compile-for-arm-processor/14109)

<div class="topic-metadata">

**Author:** [@mogu](https://discourse.cmake.org/u/mogu)\
**Replies:** 0\
**Last updated:** [May 16, 2025, 6:33pm UTC](https://discourse.cmake.org/t/the-cxx-compiler-identification-is-unknown-building-cross-compile-for-arm-processor/14109 "2025-05-16T18:33:25Z")

</div>

Hi, I am trying to cross compile code for ARM processor on Linux. Downloaded GNU Arm toolchain from Arm and able to build a sample C , C++ code directly. But when I am trying to cross compile for ARM using Cmake, runn…

---

## [Correct usage of FindSQLite3 module in Windows](https://discourse.cmake.org/t/correct-usage-of-findsqlite3-module-in-windows/174)

<div class="topic-metadata">

**Author:** [@arcesino](https://discourse.cmake.org/u/arcesino)\
**Replies:** 4\
**Last updated:** [May 14, 2025, 3:24pm UTC](https://discourse.cmake.org/t/correct-usage-of-findsqlite3-module-in-windows/174 "2025-05-14T15:24:06Z")

</div>

Hi all, I’ve been using module FindSQLite3.cmake that comes bundled into CMake’s installation for finding SQLite3’s include dir and library under Linux and macOS. Recently, I’m working on porting one of those projects t…

---

## [Debugging RUNTIME\_DEPENDENCY\_SET](https://discourse.cmake.org/t/debugging-runtime-dependency-set/14089)

<div class="topic-metadata">

**Author:** [@KUGA2](https://discourse.cmake.org/u/KUGA2)\
**Replies:** 0\
**Last updated:** [May 14, 2025, 9:08am UTC](https://discourse.cmake.org/t/debugging-runtime-dependency-set/14089 "2025-05-14T09:08:03Z")

</div>

Is there a flag (similar to CMAKE\_FIND\_DEBUG\_MODE) to enable logging of RUNTIME\_DEPENDENCY\_SET? Especially the resolution of dependencies? I got a case, where I think it goes wrong: State: executable \<-lib1.so ← lib2…

---

## [Running a batch script before object files are compiled](https://discourse.cmake.org/t/running-a-batch-script-before-object-files-are-compiled/14069)

<div class="topic-metadata">

**Author:** [@LarryOates](https://discourse.cmake.org/u/LarryOates)\
**Replies:** 3\
**Last updated:** [May 12, 2025, 5:11am UTC](https://discourse.cmake.org/t/running-a-batch-script-before-object-files-are-compiled/14069 "2025-05-12T05:11:46Z")

</div>

I have a batch script which generates a .c file (fsdata\_custom.c) I need to run this script every time I build my aplication but before the application object files are built. So far I have: Build FS data for display …

---

## [Question about \*.d dependency file when CMake working with IAR compiler](https://discourse.cmake.org/t/question-about-d-dependency-file-when-cmake-working-with-iar-compiler/14066)

<div class="topic-metadata">

**Author:** [@neuq\_jerry](https://discourse.cmake.org/u/neuq_jerry)\
**Replies:** 5\
**Last updated:** [May 12, 2025, 2:49am UTC](https://discourse.cmake.org/t/question-about-d-dependency-file-when-cmake-working-with-iar-compiler/14066 "2025-05-12T02:49:28Z")

</div>

The project we managed has too many include folders which exceed the maximum allowed command length. In order to avoid this issue, I use an IAR feature which move “-I directory” to a file and pass the file as a compile…

---

## [cmake 4.0.2 gives warning for DEPENDS keyword in add\_custom\_command](https://discourse.cmake.org/t/cmake-4-0-2-gives-warning-for-depends-keyword-in-add-custom-command/14077)

<div class="topic-metadata">

**Author:** [@Wim\_Delvaux](https://discourse.cmake.org/u/Wim_Delvaux)\
**Replies:** 1\
**Last updated:** [May 11, 2025, 7:04am UTC](https://discourse.cmake.org/t/cmake-4-0-2-gives-warning-for-depends-keyword-in-add-custom-command/14077 "2025-05-11T07:04:47Z")

</div>

I get this warning CMake Warning (dev) at C:/Data/Projects/QtBuildTools/utils.cmake:670 (add\_custom\_command): + CategoryInfo : NotSpecified: (CMake Warning (…ustom\_command)::String) , RemoteException + FullyQ…

---

## [PCH unable to get precompiled headers working](https://discourse.cmake.org/t/pch-unable-to-get-precompiled-headers-working/14075)

<div class="topic-metadata">

**Author:** [@tksuoran](https://discourse.cmake.org/u/tksuoran)\
**Replies:** 0\
**Last updated:** [May 10, 2025, 1:17pm UTC](https://discourse.cmake.org/t/pch-unable-to-get-precompiled-headers-working/14075 "2025-05-10T13:17:11Z")

</div>

I am trying to use precompiled headers. One library target (erhe\_pch ) is used for creating PCH to be shared with other targets, with REUSE\_FROM. When I build erhe\_pch target in VS, the pch file (cmake\_pch.pch ) is cre…

---

## [Cmake 4.0.0 is being slower than previous versions](https://discourse.cmake.org/t/cmake-4-0-0-is-being-slower-than-previous-versions/13854)

<div class="topic-metadata">

**Author:** [@CalmBox](https://discourse.cmake.org/u/CalmBox)\
**Replies:** 2\
**Last updated:** [March 31, 2025, 7:05pm UTC](https://discourse.cmake.org/t/cmake-4-0-0-is-being-slower-than-previous-versions/13854 "2025-03-31T19:05:08Z")

</div>

I’m running CMake 4.0.0 on identical settings as I was doing with CMake 3.31.6 and all the configure times in my projects are equal or worse than before. After doing some profiling, most of it looks identical except some…

---

## [How to use multiple cores with cmake + visual studio](https://discourse.cmake.org/t/how-to-use-multiple-cores-with-cmake-visual-studio/14033)

<div class="topic-metadata">

**Author:** [@Finglor](https://discourse.cmake.org/u/Finglor)\
**Replies:** 2\
**Last updated:** [May 2, 2025, 10:56pm UTC](https://discourse.cmake.org/t/how-to-use-multiple-cores-with-cmake-visual-studio/14033 "2025-05-02T22:56:46Z")

</div>

For reference: https://gitlab.kitware.com/cmake/cmake/-/issues/20564 I am running cmake with cmake --build build --verbose -- /p:CL\_MPCount=8 and it still uses only 1 core. Here is my output from the above command. D:\\…

---

## [Generator Deprecation](https://discourse.cmake.org/t/generator-deprecation/14038)

<div class="topic-metadata">

**Author:** [@fmuir](https://discourse.cmake.org/u/fmuir)\
**Replies:** 0\
**Last updated:** [May 2, 2025, 7:23pm UTC](https://discourse.cmake.org/t/generator-deprecation/14038 "2025-05-02T19:23:22Z")

</div>

Hello, Codeblock generators were deprecated in 3.27. Do they still work in 4.01? What do they produce, if anything? The 4.01 reference manual has a note saying those generators were deprecated in 3.27 but are still lis…

---

## [Is it possible to force an executable target to pre-req another one](https://discourse.cmake.org/t/is-it-possible-to-force-an-executable-target-to-pre-req-another-one/14009)

<div class="topic-metadata">

**Author:** [@perdrix](https://discourse.cmake.org/u/perdrix)\
**Replies:** 2\
**Last updated:** [April 28, 2025, 6:46pm UTC](https://discourse.cmake.org/t/is-it-possible-to-force-an-executable-target-to-pre-req-another-one/14009 "2025-04-28T18:46:06Z")

</div>

I have two projects for executables: DeepSkyStacker (DSS for short) and DeepSkyStackerCL (DSSCL for short). The top level CMakelists.txt does this add\_subdirectory(DeepSkyStackerKernel) add\_subdirectory(ZClass) add\_s…

---

## [TARGET\_RUNTIME\_DLLS for SHARED IMPORTED with no .lib](https://discourse.cmake.org/t/target-runtime-dlls-for-shared-imported-with-no-lib/13968)

<div class="topic-metadata">

**Author:** [@externl](https://discourse.cmake.org/u/externl)\
**Replies:** 3\
**Last updated:** [April 28, 2025, 3:22pm UTC](https://discourse.cmake.org/t/target-runtime-dlls-for-shared-imported-with-no-lib/13968 "2025-04-28T15:22:28Z")

</div>

Hello, I’m trying to achieve the following: I have an imported shared library, A, which has several dependencies. I would like all of these dependencies to be listed correctly so that other executables/libraries which l…

---

## [Install custom library in CopperSpice](https://discourse.cmake.org/t/install-custom-library-in-copperspice/13880)

<div class="topic-metadata">

**Author:** [@Navadvipa-Chandra-d](https://discourse.cmake.org/u/Navadvipa-Chandra-d)\
**Replies:** 1\
**Last updated:** [April 28, 2025, 10:18am UTC](https://discourse.cmake.org/t/install-custom-library-in-copperspice/13880 "2025-04-28T10:18:03Z")

</div>

Hello, All! My name is Navadvipa Chandra das. My language is Russian. I use translate dot yandex dot ru. Windows 11 64-bit operating system CMake - cmake-3.31.4-windows-x86\_64 There is a CopperSpice library. I’m add…

---

## [CMake Path Length on Linux](https://discourse.cmake.org/t/cmake-path-length-on-linux/13993)

<div class="topic-metadata">

**Author:** [@bslack](https://discourse.cmake.org/u/bslack)\
**Replies:** 0\
**Last updated:** [April 27, 2025, 2:04am UTC](https://discourse.cmake.org/t/cmake-path-length-on-linux/13993 "2025-04-27T02:04:57Z")

</div>

Hello, Very new to using CMake. Would appreciate any pointers. I have stumbled upon an issue where I cannot seem to include a path over 148 characters long. For example with the following: set(AA\_PUBLIC\_HEADERS …

---

## [Specifying full CN for macdeployqt -codesign](https://discourse.cmake.org/t/specifying-full-cn-for-macdeployqt-codesign/13970)

<div class="topic-metadata">

**Author:** [@perdrix](https://discourse.cmake.org/u/perdrix)\
**Replies:** 2\
**Last updated:** [April 27, 2025, 1:14am UTC](https://discourse.cmake.org/t/specifying-full-cn-for-macdeployqt-codesign/13970 "2025-04-27T01:14:09Z")

</div>

My Apple Developer ID certificate has: CN=Developer ID Application: David Partridge (VH8AYT3C7Y) If the CMakeLists for my Qt project reads like this: if(NOT LINUX) set (deploy\_tool\_options\_arg "") if(APPLE) …

---

## [How to compile -DCMAKE\_USE\_OPENSSL=OFF](https://discourse.cmake.org/t/how-to-compile-dcmake-use-openssl-off/1271)

<div class="topic-metadata">

**Author:** [@machiel](https://discourse.cmake.org/u/machiel)\
**Replies:** 5\
**Last updated:** [April 26, 2025, 4:06pm UTC](https://discourse.cmake.org/t/how-to-compile-dcmake-use-openssl-off/1271 "2025-04-26T16:06:45Z")

</div>

Hi, I tried installing cmake with the command “./bootstrap”. I get this error message: CMake Error at Utilities/cmcurl/CMakeLists.txt:454 (message): Could not find OpenSSL. Install an OpenSSL development package or …

---

## [Not understanding why an if statement isn't working](https://discourse.cmake.org/t/not-understanding-why-an-if-statement-isnt-working/13983)

<div class="topic-metadata">

**Author:** [@perdrix](https://discourse.cmake.org/u/perdrix)\
**Replies:** 5\
**Last updated:** [April 26, 2025, 8:04am UTC](https://discourse.cmake.org/t/not-understanding-why-an-if-statement-isnt-working/13983 "2025-04-26T08:04:33Z")

</div>

message("LINUX: " ${LINUX}) message("APPLE: " ${APPLE}) message("CMAKE\_SYSTEM\_NAME: " ${CMAKE\_SYSTEM\_NAME}) if (LINUX OR (APPLE AND ${CMAKE\_OSX\_ARCHITECTURES} EQUAL "x86\_64")) message("Setting AVX compile options") : …

---

## [CMAKE\_OSX\_DEPLOYMENT\_TARGET not working as expected](https://discourse.cmake.org/t/cmake-osx-deployment-target-not-working-as-expected/13985)

<div class="topic-metadata">

**Author:** [@perdrix](https://discourse.cmake.org/u/perdrix)\
**Replies:** 1\
**Last updated:** [April 25, 2025, 2:41pm UTC](https://discourse.cmake.org/t/cmake-osx-deployment-target-not-working-as-expected/13985 "2025-04-25T14:41:38Z")

</div>

My top level CMake file says: set(CMAKE\_OSX\_DEPLOYMENT\_TARGET 13.0 CACHE STRING "Minimum operating system version for deployment") and I am building on an ARM system running Sequoia (15.4.1) with XCode 16.3 with the t…

---

## [How can I control from inside my top-level CMakeLists.txt what gets installed with \`cmake --install\`?](https://discourse.cmake.org/t/how-can-i-control-from-inside-my-top-level-cmakelists-txt-what-gets-installed-with-cmake-install/13984)

<div class="topic-metadata">

**Author:** [@exoosh](https://discourse.cmake.org/u/exoosh)\
**Replies:** 0\
**Last updated:** [April 25, 2025, 12:05pm UTC](https://discourse.cmake.org/t/how-can-i-control-from-inside-my-top-level-cmakelists-txt-what-gets-installed-with-cmake-install/13984 "2025-04-25T12:05:19Z")

</div>

I know in theory I can pick the --component to install with cmake --install; although I don’t know how to know the component names to pass. But is there a way to rein in the installation of items from within the top-lev…

---

## [Old visual studio generators in recent cmake](https://discourse.cmake.org/t/old-visual-studio-generators-in-recent-cmake/13934)

<div class="topic-metadata">

**Author:** [@GiovaBx](https://discourse.cmake.org/u/GiovaBx)\
**Replies:** 7\
**Last updated:** [April 25, 2025, 10:34am UTC](https://discourse.cmake.org/t/old-visual-studio-generators-in-recent-cmake/13934 "2025-04-25T10:34:01Z")

</div>

Hi, I use cmake with conan to generate prebuild version of libraries for different Visual Studio version and architecture. We mostly use Visual Studio 2022 and 2019, but we still need to support new library version (bu…

---

## [set\_source\_file\_properties COMPILE\_DEFINITIONS issue](https://discourse.cmake.org/t/set-source-file-properties-compile-definitions-issue/13981)

<div class="topic-metadata">

**Author:** [@perdrix](https://discourse.cmake.org/u/perdrix)\
**Replies:** 0\
**Last updated:** [April 25, 2025, 8:20am UTC](https://discourse.cmake.org/t/set-source-file-properties-compile-definitions-issue/13981 "2025-04-25T08:20:43Z")

</div>

cmake version 3.31.4 My CMakelists.txt file defines a number of files that need “special” treatement: set(AVX\_Files "avx.cpp" "avx\_avg.cpp" "avx\_bitmap\_filler.cpp" "avx\_cfa.cpp" "avx\_entropy.cpp" …

---

## [VS2022 Remote CMake on MacOS needs to unlock keychain](https://discourse.cmake.org/t/vs2022-remote-cmake-on-macos-needs-to-unlock-keychain/13965)

<div class="topic-metadata">

**Author:** [@perdrix](https://discourse.cmake.org/u/perdrix)\
**Replies:** 2\
**Last updated:** [April 23, 2025, 7:31am UTC](https://discourse.cmake.org/t/vs2022-remote-cmake-on-macos-needs-to-unlock-keychain/13965 "2025-04-23T07:31:36Z")

</div>

I have a Developer ID certificate and related private key. But I cannot use them from the VS2022 CMake SSH session because the login keychain is not unlocked automatically for SSH sessions. To unlock it I need to issu…

---

## [VS 2022 configuration build preset selector missing](https://discourse.cmake.org/t/vs-2022-configuration-build-preset-selector-missing/13960)

<div class="topic-metadata">

**Author:** [@mandrews](https://discourse.cmake.org/u/mandrews)\
**Replies:** 4\
**Last updated:** [April 20, 2025, 1:26am UTC](https://discourse.cmake.org/t/vs-2022-configuration-build-preset-selector-missing/13960 "2025-04-20T01:26:53Z")

</div>

Just starting to use the cmake tools built into VS 2022 and i built a quick windows test program based off of the CMakeLists.txt and CMakePresets.json which are generated when i create a new project using the ‘CMake Proj…

---

## [Moving from CMake 3.21.2 to 4.0.1 and now CXX\_STANDARD only seems to partially work?](https://discourse.cmake.org/t/moving-from-cmake-3-21-2-to-4-0-1-and-now-cxx-standard-only-seems-to-partially-work/13930)

<div class="topic-metadata">

**Author:** [@Gazoo101](https://discourse.cmake.org/u/Gazoo101)\
**Replies:** 2\
**Last updated:** [April 18, 2025, 2:55pm UTC](https://discourse.cmake.org/t/moving-from-cmake-3-21-2-to-4-0-1-and-now-cxx-standard-only-seems-to-partially-work/13930 "2025-04-18T14:55:11Z")

</div>

Hello Y’all, I’m moving my MSVC based project from my old PC to a new one. In the process I’m upgrading some build software alongside it, such as CMake which on my old machine is 3.21.2 and on the new one 4.0.1. I used…

---

## [Overriding Source File Properties Precedense Clarity](https://discourse.cmake.org/t/overriding-source-file-properties-precedense-clarity/13955)

<div class="topic-metadata">

**Author:** [@Drue\_Peters](https://discourse.cmake.org/u/Drue_Peters)\
**Replies:** 0\
**Last updated:** [April 17, 2025, 11:32pm UTC](https://discourse.cmake.org/t/overriding-source-file-properties-precedense-clarity/13955 "2025-04-17T23:32:06Z")

</div>

There are a few sections across our code base where it would be nice to always optimize specific files. I’m currently using set\_source\_files\_properties(src.cpp PROPERTIES COMPILE\_FLAGS "-O3") to enforce this. The ninja …

---

## [Add Build Dependency for Configuration Files Consumed by Code Generation Script](https://discourse.cmake.org/t/add-build-dependency-for-configuration-files-consumed-by-code-generation-script/10668)

<div class="topic-metadata">

**Author:** [@Drue\_Peters](https://discourse.cmake.org/u/Drue_Peters)\
**Replies:** 6\
**Last updated:** [April 17, 2025, 11:26pm UTC](https://discourse.cmake.org/t/add-build-dependency-for-configuration-files-consumed-by-code-generation-script/10668 "2025-04-17T23:26:25Z")

</div>

Hey, I’ve tried searching the forums and internet for this, but solutions I’ve tried haven’t worked. Our codebase uses a Python script that generates some final stages of C++. This Python script is called by using add…

---

## [How to pass target\_compile\_options to target\_precompile\_headers](https://discourse.cmake.org/t/how-to-pass-target-compile-options-to-target-precompile-headers/13947)

<div class="topic-metadata">

**Author:** [@Marcel\_Behlau](https://discourse.cmake.org/u/Marcel_Behlau)\
**Replies:** 0\
**Last updated:** [April 17, 2025, 7:58am UTC](https://discourse.cmake.org/t/how-to-pass-target-compile-options-to-target-precompile-headers/13947 "2025-04-17T07:58:45Z")

</div>

Hi, i observed the problem, that set target\_compile\_options are not used within target\_precompile\_headers. My expectation is, that the set target\_compile\_options also used within the target\_precompile\_headers, since bo…

---

## [Automoc always runs moc](https://discourse.cmake.org/t/automoc-always-runs-moc/11660)

<div class="topic-metadata">

**Author:** [@Andreas](https://discourse.cmake.org/u/Andreas)\
**Replies:** 2\
**Last updated:** [April 16, 2025, 3:05pm UTC](https://discourse.cmake.org/t/automoc-always-runs-moc/11660 "2025-04-16T15:05:28Z")

</div>

I would expect automoc to only run moc if the input files have changed. In the documentation https://cmake.org/cmake/help/latest/prop\_tgt/AUTOMOC.html it says “The header will be moc compiled again if a file from the ad…

---

## [file(DOWNLOAD ....) Error message question.](https://discourse.cmake.org/t/file-download-error-message-question/13935)

<div class="topic-metadata">

**Author:** [@imikejackson](https://discourse.cmake.org/u/imikejackson)\
**Replies:** 0\
**Last updated:** [April 15, 2025, 4:38pm UTC](https://discourse.cmake.org/t/file-download-error-message-question/13935 "2025-04-15T16:38:46Z")

</div>

In our project we generate CMake code such as the following: file(DOWNLOAD https://www.dream3d.io/Data\_Archive/7\_0\_abaqus\_hexahedron\_writer\_test.tar.gz "/Users/mjackson/Workspace1/DREAM3DNX/../DREAM3D\_Data…

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

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