# Usage

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

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

**Page:** 36

---

## [How to avoid race for two \`cmake --build\` in parallel?](https://discourse.cmake.org/t/how-to-avoid-race-for-two-cmake-build-in-parallel/9431)

<div class="topic-metadata">

**Author:** [@hehaoqian1](https://discourse.cmake.org/u/hehaoqian1)\
**Replies:** 1\
**Last updated:** [November 19, 2023, 2:26am UTC](https://discourse.cmake.org/t/how-to-avoid-race-for-two-cmake-build-in-parallel/9431 "2023-11-19T02:26:06Z")

</div>

How to avoid race when two cmake --build are run in parallel, for the same cmake build directory? For example, if I want to have cmake --build . --target Alice and cmake --build . --target Bob in parallel, and both of …

---

## [FindOpenSSL.cmake does not search lib64 directory](https://discourse.cmake.org/t/findopenssl-cmake-does-not-search-lib64-directory/9429)

<div class="topic-metadata">

**Author:** [@jay](https://discourse.cmake.org/u/jay)\
**Replies:** 2\
**Last updated:** [November 18, 2023, 9:51pm UTC](https://discourse.cmake.org/t/findopenssl-cmake-does-not-search-lib64-directory/9429 "2023-11-18T21:51:41Z")

</div>

find\_package(OpenSSL) does not search \<OPENSSL\_ROOT\_DIR\>/lib64 for the OpenSSL libs. Is there a reason for that? OpenSSL 3 in Ubuntu 16 LTS has default lib directory name lib64. I know of two ways to get around this. T…

---

## [How to set different compiler options for different sets of source files?](https://discourse.cmake.org/t/how-to-set-different-compiler-options-for-different-sets-of-source-files/9342)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 3\
**Last updated:** [November 18, 2023, 8:16pm UTC](https://discourse.cmake.org/t/how-to-set-different-compiler-options-for-different-sets-of-source-files/9342 "2023-11-18T20:16:21Z")

</div>

For a C++ project, for a single library and CMakeLists.txt file, I would like to set compiler options differently for sets of files. For example, I might want to enable warning -Wunused-parameter for some files but not o…

---

## [CMake 3.28.0-rc5: xros is not an visionOS SDK](https://discourse.cmake.org/t/cmake-3-28-0-rc5-xros-is-not-an-visionos-sdk/9454)

<div class="topic-metadata">

**Author:** [@hyoklee](https://discourse.cmake.org/u/hyoklee)\
**Replies:** 0\
**Last updated:** [November 17, 2023, 6:36pm UTC](https://discourse.cmake.org/t/cmake-3-28-0-rc5-xros-is-not-an-visionos-sdk/9454 "2023-11-17T18:36:23Z")

</div>

Hi, I’m testing CMake for visionOS but I got the following error: CMake Error at /Users/runner/hostedtoolcache/cmake/3.28.0/x64/cmake-3.28.0-rc5-macos-universal/CMake.app/Contents/share/cmake-3.28/Modules/Platform/visi…

---

## [\`RegularExpression::compile(): Invalid range in \[\].\`](https://discourse.cmake.org/t/regularexpression-compile-invalid-range-in/3707)

<div class="topic-metadata">

**Author:** [@SamuelMarks](https://discourse.cmake.org/u/SamuelMarks)\
**Replies:** 4\
**Last updated:** [November 17, 2023, 3:27pm UTC](https://discourse.cmake.org/t/regularexpression-compile-invalid-range-in/3707 "2023-11-17T15:27:56Z")

</div>

from include\_directories("${CMAKE\_CURRENT\_BINARY\_DIR}") I was debugging why no directory I specify in target\_include\_directories allow me to access the header after generate\_export\_header, even when explicitly specifyi…

---

## [Reusing out of tree c++ module?](https://discourse.cmake.org/t/reusing-out-of-tree-c-module/9332)

<div class="topic-metadata">

**Author:** [@Glad](https://discourse.cmake.org/u/Glad)\
**Replies:** 5\
**Last updated:** [November 17, 2023, 2:02pm UTC](https://discourse.cmake.org/t/reusing-out-of-tree-c-module/9332 "2023-11-17T14:02:03Z")

</div>

Hi, Waiting for the 3.28 official release, what would importing a module from another directory look like ? The helloword example has foo.cxx in the same dir, but sooner or later we will end up with modules in some di…

---

## [C and CXX Compiler Unknown](https://discourse.cmake.org/t/c-and-cxx-compiler-unknown/9388)

<div class="topic-metadata">

**Author:** [@AlamoGrito](https://discourse.cmake.org/u/AlamoGrito)\
**Replies:** 2\
**Last updated:** [November 17, 2023, 1:47pm UTC](https://discourse.cmake.org/t/c-and-cxx-compiler-unknown/9388 "2023-11-17T13:47:59Z")

</div>

My general MO for setting up a new machine is to install git for windows, visual studio, python for windows, and then Cmake. Following this sequence I’ve never had a problem to get my build chain using CMake to work wit…

---

## [Xcode generator and conditional behaviour based on the SDK](https://discourse.cmake.org/t/xcode-generator-and-conditional-behaviour-based-on-the-sdk/9373)

<div class="topic-metadata">

**Author:** [@Emanuele\_Zattin](https://discourse.cmake.org/u/Emanuele_Zattin)\
**Replies:** 1\
**Last updated:** [November 17, 2023, 1:43pm UTC](https://discourse.cmake.org/t/xcode-generator-and-conditional-behaviour-based-on-the-sdk/9373 "2023-11-17T13:43:09Z")

</div>

Sometimes a precompiled dependency might come without support for one of the supported SDKs. For example… a dependency might come with support for iOS and simulator, but not for catalyst. Is it possible to manage condi…

---

## [CMakeDetermineRCCompiler can not set correct extension when cross compiling](https://discourse.cmake.org/t/cmakedeterminerccompiler-can-not-set-correct-extension-when-cross-compiling/9365)

<div class="topic-metadata">

**Author:** [@UrMyLacia](https://discourse.cmake.org/u/UrMyLacia)\
**Replies:** 1\
**Last updated:** [November 17, 2023, 1:40pm UTC](https://discourse.cmake.org/t/cmakedeterminerccompiler-can-not-set-correct-extension-when-cross-compiling/9365 "2023-11-17T13:40:25Z")

</div>

Environment OS: Debian 12.2.0 cmake: 3.25.1 compiler tools: x86\_64-w64-mingw32 issue I’m cross-compiling a desktop program for windows on a linux platform I want to add app icon using add\_executable like add\_executa…

---

## [CMAKE is unable to build RP-2040-HAT-FREERTS-C](https://discourse.cmake.org/t/cmake-is-unable-to-build-rp-2040-hat-freerts-c/9361)

<div class="topic-metadata">

**Author:** [@alphabeta](https://discourse.cmake.org/u/alphabeta)\
**Replies:** 1\
**Last updated:** [November 17, 2023, 1:31pm UTC](https://discourse.cmake.org/t/cmake-is-unable-to-build-rp-2040-hat-freerts-c/9361 "2023-11-17T13:31:06Z")

</div>

PICO is installed in C drive there examples are easily build but when I am trying to build RP2040-HAT- FREERTOS-C which is installed in D drive it shows this error. Please help me on this .

---

## [creating CMakeLists.txt](https://discourse.cmake.org/t/creating-cmakelists-txt/9339)

<div class="topic-metadata">

**Author:** [@ajo79](https://discourse.cmake.org/u/ajo79)\
**Replies:** 1\
**Last updated:** [November 17, 2023, 1:11pm UTC](https://discourse.cmake.org/t/creating-cmakelists-txt/9339 "2023-11-17T13:11:35Z")

</div>

I want to create creating CMakeLists.txt to create build system for vs2022. which include Qt5, some other sdks and library.

---

## [Targets not available in other CMakeLists.txt (ESP-IDF)](https://discourse.cmake.org/t/targets-not-available-in-other-cmakelists-txt-esp-idf/9439)

<div class="topic-metadata">

**Author:** [@itavero](https://discourse.cmake.org/u/itavero)\
**Replies:** 1\
**Last updated:** [November 16, 2023, 10:01am UTC](https://discourse.cmake.org/t/targets-not-available-in-other-cmakelists-txt-esp-idf/9439 "2023-11-16T10:01:47Z")

</div>

At work we are setting a single repository for all the embedded firmware for all our new platform products (targetting ARM Cortex-M33 MCUs as well as Espressifs ESP32-S3). I’m currently trying to integrate their ESP-IDF…

---

## [Multi-config generator with multiple toolchains?](https://discourse.cmake.org/t/multi-config-generator-with-multiple-toolchains/9187)

<div class="topic-metadata">

**Author:** [@itavero](https://discourse.cmake.org/u/itavero)\
**Replies:** 2\
**Last updated:** [November 16, 2023, 8:31am UTC](https://discourse.cmake.org/t/multi-config-generator-with-multiple-toolchains/9187 "2023-11-16T08:31:21Z")

</div>

We are currently working on some products that have multiple different microcontrollers (with different compilers as well). We always use CMake together with ninja, for which a multi-config generator exists. In our cur…

---

## [Optimizing CTest runners](https://discourse.cmake.org/t/optimizing-ctest-runners/9415)

<div class="topic-metadata">

**Author:** [@Lecris](https://discourse.cmake.org/u/Lecris)\
**Replies:** 3\
**Last updated:** [November 13, 2023, 3:41pm UTC](https://discourse.cmake.org/t/optimizing-ctest-runners/9415 "2023-11-13T15:41:05Z")

</div>

I have noticed that ctest is able to optimize the order of tests that are run in parallel based on the previous execution. My question around this, is what files are needed to be cached to take advantage of this outside …

---

## [Compile flags in the linking command for link time optimization](https://discourse.cmake.org/t/compile-flags-in-the-linking-command-for-link-time-optimization/9413)

<div class="topic-metadata">

**Author:** [@One\_Cable5781](https://discourse.cmake.org/u/One_Cable5781)\
**Replies:** 2\
**Last updated:** [November 11, 2023, 5:01pm UTC](https://discourse.cmake.org/t/compile-flags-in-the-linking-command-for-link-time-optimization/9413 "2023-11-11T17:01:23Z")

</div>

According to gcc documentation for link time optimization: It is recommended that you compile all the files participating in the same link with the same options and also specify those options at link time I specify i…

---

## [In Cmake post build , if i run output of same project build is failng in macos](https://discourse.cmake.org/t/in-cmake-post-build-if-i-run-output-of-same-project-build-is-failng-in-macos/9401)

<div class="topic-metadata">

**Author:** [@Ram](https://discourse.cmake.org/u/Ram)\
**Replies:** 1\
**Last updated:** [November 10, 2023, 1:19pm UTC](https://discourse.cmake.org/t/in-cmake-post-build-if-i-run-output-of-same-project-build-is-failng-in-macos/9401 "2023-11-10T13:19:30Z")

</div>

In Post build , if i execute/ run same project output getting no process exist error in macos using xcode Observation: Same is working in windows

---

## [How to install in multiple locations (prefixes) without building again?](https://discourse.cmake.org/t/how-to-install-in-multiple-locations-prefixes-without-building-again/9278)

<div class="topic-metadata">

**Author:** [@fferri](https://discourse.cmake.org/u/fferri)\
**Replies:** 3\
**Last updated:** [November 10, 2023, 1:31am UTC](https://discourse.cmake.org/t/how-to-install-in-multiple-locations-prefixes-without-building-again/9278 "2023-11-10T01:31:22Z")

</div>

I use a top-level CMake projects with ExternalProject to manage the build/assembling of a big software release consisting of many CMake subprojects (each one builds install with cmake --build / --install). e.g. an entry…

---

## [Error when crosscompiling with WHOLE\_ARCHIVE target link.](https://discourse.cmake.org/t/error-when-crosscompiling-with-whole-archive-target-link/9394)

<div class="topic-metadata">

**Author:** [@ciscoski](https://discourse.cmake.org/u/ciscoski)\
**Replies:** 4\
**Last updated:** [November 9, 2023, 9:27am UTC](https://discourse.cmake.org/t/error-when-crosscompiling-with-whole-archive-target-link/9394 "2023-11-09T09:27:50Z")

</div>

Hello all, I’ve a problem linking libraries using the WHOLE\_ARCHIVE generator feature when using cross compilation toolchains. Here is it my toolchain file # Toolchain File for the arm-none-eabi GCC Compiler set(TOOLC…

---

## [Incremental build not working for header files](https://discourse.cmake.org/t/incremental-build-not-working-for-header-files/9334)

<div class="topic-metadata">

**Author:** [@sip2wte](https://discourse.cmake.org/u/sip2wte)\
**Replies:** 3\
**Last updated:** [November 8, 2023, 11:11pm UTC](https://discourse.cmake.org/t/incremental-build-not-working-for-header-files/9334 "2023-11-08T23:11:37Z")

</div>

Hi there, I am using cmake with “Ninja Multi-Config” generator on Linux with Green hills compiler. The incremental build is not working i.e. If I make changes in the header files, it would not show me any compilation er…

---

## [Good practices for common ancestor target](https://discourse.cmake.org/t/good-practices-for-common-ancestor-target/9289)

<div class="topic-metadata">

**Author:** [@eriols](https://discourse.cmake.org/u/eriols)\
**Replies:** 2\
**Last updated:** [November 8, 2023, 2:56pm UTC](https://discourse.cmake.org/t/good-practices-for-common-ancestor-target/9289 "2023-11-08T14:56:31Z")

</div>

Sorry this is very basic and open-ended but I’d like to just have some up-to-date input. Provided I have several libraries that are variations of the same abstract base target if you will (eg building shared and static …

---

## [Libraries built outside the catkin workspace](https://discourse.cmake.org/t/libraries-built-outside-the-catkin-workspace/9375)

<div class="topic-metadata">

**Author:** [@tanmayd26](https://discourse.cmake.org/u/tanmayd26)\
**Replies:** 2\
**Last updated:** [November 8, 2023, 8:30am UTC](https://discourse.cmake.org/t/libraries-built-outside-the-catkin-workspace/9375 "2023-11-08T08:30:29Z")

</div>

I am facing error with the include directories in my cmake. I tried all the scopes possible but still get this error. The GTSAM library is in shared folder “/usr/local/include” but still I am facing error. CMake Error a…

---

## [execute\_process: how to pass argument to python script](https://discourse.cmake.org/t/execute-process-how-to-pass-argument-to-python-script/4999)

<div class="topic-metadata">

**Author:** [@jwuttke](https://discourse.cmake.org/u/jwuttke)\
**Replies:** 8\
**Last updated:** [November 6, 2023, 11:25pm UTC](https://discourse.cmake.org/t/execute-process-how-to-pass-argument-to-python-script/4999 "2023-11-06T23:25:49Z")

</div>

execute\_process(COMMAND ${Python3\_EXECUTABLE} my\_script.py my\_arg) doesn’t work as intended: my\_script.py is executed, but does not see the argument my\_arg. Whereas on the command line $ python3 my\_script.py my\_args d…

---

## [add\_library() for header-only c++ target... again](https://discourse.cmake.org/t/add-library-for-header-only-c-target-again/9363)

<div class="topic-metadata">

**Author:** [@DanilShe](https://discourse.cmake.org/u/DanilShe)\
**Replies:** 2\
**Last updated:** [November 5, 2023, 3:33pm UTC](https://discourse.cmake.org/t/add-library-for-header-only-c-target-again/9363 "2023-11-05T15:33:35Z")

</div>

Hello! I’m trying to make a header-only target in my c++ project. Environment: MSVC 2019, CMake 3.20 bundled with MSVC, c++ 20, WIndows 10 Here is a sample structure of my project: /proj/common/CMakeLists.txt /proj/c…

---

## [WHOLE\_ARCHIVE with transitive Dependencies](https://discourse.cmake.org/t/whole-archive-with-transitive-dependencies/9344)

<div class="topic-metadata">

**Author:** [@kolrami](https://discourse.cmake.org/u/kolrami)\
**Replies:** 3\
**Last updated:** [November 3, 2023, 8:21pm UTC](https://discourse.cmake.org/t/whole-archive-with-transitive-dependencies/9344 "2023-11-03T20:21:41Z")

</div>

After reading the discussion in https://gitlab.kitware.com/cmake/cmake/-/issues/24504 I decided to post some follow up question here. The mentioned discussion talks about cyclic dependencies but I actually have an issue…

---

## [Linking C shared library](https://discourse.cmake.org/t/linking-c-shared-library/9348)

<div class="topic-metadata">

**Author:** [@pritesh\_soni](https://discourse.cmake.org/u/pritesh_soni)\
**Replies:** 3\
**Last updated:** [November 3, 2023, 11:58am UTC](https://discourse.cmake.org/t/linking-c-shared-library/9348 "2023-11-03T11:58:46Z")

</div>

I was trying to build GMT (generic mapping tool) following this installation guide : gmt/BUILDING.md at master · GenericMappingTools/gmt · GitHub where using the command: “cmake --build . --config Release” starts to bui…

---

## [256 character limit on CACHE INTERNAL entries](https://discourse.cmake.org/t/256-character-limit-on-cache-internal-entries/9350)

<div class="topic-metadata">

**Author:** [@EosPengwern](https://discourse.cmake.org/u/EosPengwern)\
**Replies:** 2\
**Last updated:** [November 2, 2023, 10:03pm UTC](https://discourse.cmake.org/t/256-character-limit-on-cache-internal-entries/9350 "2023-11-02T22:03:59Z")

</div>

This is a comment rather than a question… I had a problem today where I was trying to store a long list of libraries, which were being found in a recursive search through many layers of function calls but needed to be a…

---

## [3.28RC3 and xcframeworks](https://discourse.cmake.org/t/3-28rc3-and-xcframeworks/9347)

<div class="topic-metadata">

**Author:** [@Emanuele\_Zattin](https://discourse.cmake.org/u/Emanuele_Zattin)\
**Replies:** 1\
**Last updated:** [November 2, 2023, 9:25pm UTC](https://discourse.cmake.org/t/3-28rc3-and-xcframeworks/9347 "2023-11-02T21:25:50Z")

</div>

I’ve been trying out the 3.28RC3 and to me it looks like building against xcframeworks is not really working yet. I built a minimal project using a prebuilt xcframework and I tried building against it both directly speci…

---

## [FindFLEX and CACHE INTERNAL](https://discourse.cmake.org/t/findflex-and-cache-internal/9310)

<div class="topic-metadata">

**Author:** [@EosPengwern](https://discourse.cmake.org/u/EosPengwern)\
**Replies:** 4\
**Last updated:** [November 2, 2023, 9:22pm UTC](https://discourse.cmake.org/t/findflex-and-cache-internal/9310 "2023-11-02T21:22:41Z")

</div>

I’m having trouble with setting CACHE INTERNAL variables, and must be getting the syntax wrong. The context, in case it’s relevant, is trying to work round a problem with FindFLEX. I have flex.exe installed in C:\\cygwin…

---

## [CTest: have a file to run a subset of tests ?](https://discourse.cmake.org/t/ctest-have-a-file-to-run-a-subset-of-tests/9341)

<div class="topic-metadata">

**Author:** [@neundorf](https://discourse.cmake.org/u/neundorf)\
**Replies:** 1\
**Last updated:** [November 2, 2023, 9:22pm UTC](https://discourse.cmake.org/t/ctest-have-a-file-to-run-a-subset-of-tests/9341 "2023-11-02T21:22:16Z")

</div>

Hi, ctest has several options to filter tests which will be executed, via regexp, via labels, by numbers. Is there a way to let’s say create a text file which contains per line the name of one test, and then have ctest…

---

## [CMake selects Visual Studio CL compiler for CUDA, despite finding nvcc?](https://discourse.cmake.org/t/cmake-selects-visual-studio-cl-compiler-for-cuda-despite-finding-nvcc/9330)

<div class="topic-metadata">

**Author:** [@errata-c](https://discourse.cmake.org/u/errata-c)\
**Replies:** 2\
**Last updated:** [November 2, 2023, 9:18pm UTC](https://discourse.cmake.org/t/cmake-selects-visual-studio-cl-compiler-for-cuda-despite-finding-nvcc/9330 "2023-11-02T21:18:29Z")

</div>

This issue is bizarre and I have no idea why it’s happening. I’m trying to compile ArrayFire from source, using vcpkg to find all the dependencies. I’ve installed all the required dependencies, and have a CUDA toolkit wi…

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

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