# Usage

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

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

**Page:** 57

---

## [CPACK third party libraries](https://discourse.cmake.org/t/cpack-third-party-libraries/6489)

<div class="topic-metadata">

**Author:** [@msj242](https://discourse.cmake.org/u/msj242)\
**Replies:** 4\
**Last updated:** [September 19, 2022, 2:04pm UTC](https://discourse.cmake.org/t/cpack-third-party-libraries/6489 "2022-09-19T14:04:03Z")

</div>

I have worked out how to make my cmake compile, but now deploying with libraries is confusing me greatly. As you can see below “target\_link\_libraries(my\_project ${libavcodec\_LIBRARIES})” allows me to use this code, but …

---

## [Propagating DOWNLOAD\_EXTRACT\_TIMESTAMP or CMP0135 settings to dependencies?](https://discourse.cmake.org/t/propagating-download-extract-timestamp-or-cmp0135-settings-to-dependencies/6464)

<div class="topic-metadata">

**Author:** [@kisielk](https://discourse.cmake.org/u/kisielk)\
**Replies:** 6\
**Last updated:** [September 16, 2022, 9:32pm UTC](https://discourse.cmake.org/t/propagating-download-extract-timestamp-or-cmp0135-settings-to-dependencies/6464 "2022-09-16T21:32:08Z")

</div>

I’m running into a bit of an issue with the new DOWNLOAD\_EXTRACT\_TIMESTAMP option for ExternalProject. I’ve set if(POLICY CMP0135) cmake\_policy(SET CMP0135 NEW) set(CMAKE\_POLICY\_DEFAULT\_CMP0135 NEW) endif() in our to…

---

## [Spurious dumpbin crashes (race-conflicts?) in \`file(GET\_RUNTIME\_DEPENDENCIES\`](https://discourse.cmake.org/t/spurious-dumpbin-crashes-race-conflicts-in-file-get-runtime-dependencies/6491)

<div class="topic-metadata">

**Author:** [@gabyx](https://discourse.cmake.org/u/gabyx)\
**Replies:** 2\
**Last updated:** [September 16, 2022, 4:21pm UTC](https://discourse.cmake.org/t/spurious-dumpbin-crashes-race-conflicts-in-file-get-runtime-dependencies/6491 "2022-09-16T16:21:15Z")

</div>

We are using file(GET\_RUNTIME\_DEPENDENCIES as a POST\_BUILD step in many targets on Windows to copy DLLs next to the executable for debugging purposes (also .pdbs etc…). So far this procedure is exactly the same on all p…

---

## [CMake toolchain file for ARM Compiler 6 ?](https://discourse.cmake.org/t/cmake-toolchain-file-for-arm-compiler-6/4221)

<div class="topic-metadata">

**Author:** [@DavidA](https://discourse.cmake.org/u/DavidA)\
**Replies:** 9\
**Last updated:** [September 16, 2022, 3:03pm UTC](https://discourse.cmake.org/t/cmake-toolchain-file-for-arm-compiler-6/4221 "2022-09-16T15:03:38Z")

</div>

Does anyone have an example CMake toolchain file for ARM Cortex M4 using ARM compiler 6 (armclang) for Windows please?

---

## [Conditionally install file depending on CPack generator](https://discourse.cmake.org/t/conditionally-install-file-depending-on-cpack-generator/6482)

<div class="topic-metadata">

**Author:** [@mrjoel](https://discourse.cmake.org/u/mrjoel)\
**Replies:** 3\
**Last updated:** [September 16, 2022, 1:04pm UTC](https://discourse.cmake.org/t/conditionally-install-file-depending-on-cpack-generator/6482 "2022-09-16T13:04:24Z")

</div>

I am seeking to generate Linux packages (DEB;RPM) with integration into distribution specific locations via custom file installation. I would prefer to only include the integration file for certain CPack generator types,…

---

## [How do I get \`string(REGEXP REPLACE ...)\` to replace all instances](https://discourse.cmake.org/t/how-do-i-get-string-regexp-replace-to-replace-all-instances/6492)

<div class="topic-metadata">

**Author:** [@JRR](https://discourse.cmake.org/u/JRR)\
**Replies:** 2\
**Last updated:** [September 15, 2022, 9:32pm UTC](https://discourse.cmake.org/t/how-do-i-get-string-regexp-replace-to-replace-all-instances/6492 "2022-09-15T21:32:03Z")

</div>

The documentation for string(REGEXP REPLACE ...) says Match the \<regular\_expression\> as many times as possible and substitute the \<replacement\_expression\> for the match in the output. All \<input\> arguments are concaten…

---

## [How to use FindICU, tell it where to search?](https://discourse.cmake.org/t/how-to-use-findicu-tell-it-where-to-search/6461)

<div class="topic-metadata">

**Author:** [@RobN](https://discourse.cmake.org/u/RobN)\
**Replies:** 4\
**Last updated:** [September 14, 2022, 11:39pm UTC](https://discourse.cmake.org/t/how-to-use-findicu-tell-it-where-to-search/6461 "2022-09-14T23:39:48Z")

</div>

I’m trying to link my C++ project with ICU. I found this documentation: FindICU. I used brew to install icu4c on my macOS system. It put it in /usr/local/opt/icu4c. In my CMakeLists.txt, I try: set(ICU\_DEBUG ON) # set…

---

## [Can't find wxWidgets 3.1 with cmake](https://discourse.cmake.org/t/cant-find-wxwidgets-3-1-with-cmake/3983)

<div class="topic-metadata">

**Author:** [@BosenSwe](https://discourse.cmake.org/u/BosenSwe)\
**Replies:** 1\
**Last updated:** [September 13, 2022, 12:19am UTC](https://discourse.cmake.org/t/cant-find-wxwidgets-3-1-with-cmake/3983 "2022-09-13T00:19:07Z")

</div>

I’m trying to build SuperSlicer in Fedora 34, but cmake can not find wxWidgets 3.1. I have tried “everything” and now I have even built and installed the latest wxWidgets from github. My wx-config is placed in /usr/loc…

---

## [Problems building project command line with Intel compiler and ninja generator](https://discourse.cmake.org/t/problems-building-project-command-line-with-intel-compiler-and-ninja-generator/6244)

<div class="topic-metadata">

**Author:** [@Hanslow](https://discourse.cmake.org/u/Hanslow)\
**Replies:** 5\
**Last updated:** [September 12, 2022, 8:15am UTC](https://discourse.cmake.org/t/problems-building-project-command-line-with-intel-compiler-and-ninja-generator/6244 "2022-09-12T08:15:46Z")

</div>

I work on a cross platform (Linux and Windows) project where we use the Intel compiler on both platforms along with Visual Studio 2019. We’ve almost finished migrating over to CMake (from QMake) and have run into an issu…

---

## [Errors during compilation](https://discourse.cmake.org/t/errors-during-compilation/6450)

<div class="topic-metadata">

**Author:** [@bambo09](https://discourse.cmake.org/u/bambo09)\
**Replies:** 7\
**Last updated:** [September 12, 2022, 3:33am UTC](https://discourse.cmake.org/t/errors-during-compilation/6450 "2022-09-12T03:33:25Z")

</div>

I get errors during compilation time, both libraries i am trying to compile are unluckly configurated with cmake, and i need to pass somehow the path to the static .a lib for mingw, in Qt i simply specify the path, but…

---

## [MSBUILD : error MSB1009: Project file does not exist. How to finally install this project?](https://discourse.cmake.org/t/msbuild-error-msb1009-project-file-does-not-exist-how-to-finally-install-this-project/6458)

<div class="topic-metadata">

**Author:** [@irimitladder](https://discourse.cmake.org/u/irimitladder)\
**Replies:** 1\
**Last updated:** [September 11, 2022, 9:34pm UTC](https://discourse.cmake.org/t/msbuild-error-msb1009-project-file-does-not-exist-how-to-finally-install-this-project/6458 "2022-09-11T21:34:00Z")

</div>

Hello, I’m trying to install OpenCL-SDK (the one made by Khronos) under Windows 11 x64. CMake’s successfully built the cloned repo (from https://github.com/KhronosGroup/OpenCL-SDK), but suddenly it doesn’t install it. Th…

---

## [Update PROJECT VERSION during build generation time](https://discourse.cmake.org/t/update-project-version-during-build-generation-time/6462)

<div class="topic-metadata">

**Author:** [@hinell](https://discourse.cmake.org/u/hinell)\
**Replies:** 0\
**Last updated:** [September 11, 2022, 4:26pm UTC](https://discourse.cmake.org/t/update-project-version-during-build-generation-time/6462 "2022-09-11T16:26:13Z")

</div>

I’m using write\_basic\_package\_version\_file to generate a version file for a package. Further, I’m using project version to specify a path (/lib/myProject-${PROJECT\_VERSION\_MAJOR}) to a package folder where I’m going to i…

---

## [How to convert json array to cmake list variable](https://discourse.cmake.org/t/how-to-convert-json-array-to-cmake-list-variable/6446)

<div class="topic-metadata">

**Author:** [@baiwfg2](https://discourse.cmake.org/u/baiwfg2)\
**Replies:** 1\
**Last updated:** [September 9, 2022, 5:33pm UTC](https://discourse.cmake.org/t/how-to-convert-json-array-to-cmake-list-variable/6446 "2022-09-09T17:33:31Z")

</div>

Suppose I have part of a json: "dir": \["a/b", "c/d" \] , how should I get a cmake list variable like: set(var "a/b" "c/d") via string(JSON If json is {"name":"foo"}, I can get foo from string(JSON cur\_name GET ${MY\_JSON…

---

## [Randomness with errors](https://discourse.cmake.org/t/randomness-with-errors/6438)

<div class="topic-metadata">

**Author:** [@bambo09](https://discourse.cmake.org/u/bambo09)\
**Replies:** 4\
**Last updated:** [September 9, 2022, 1:09pm UTC](https://discourse.cmake.org/t/randomness-with-errors/6438 "2022-09-09T13:09:11Z")

</div>

The C++ compiler "C:/Programy/Programming/Qt/Qt\_5\_14\_1/Tools/mingw730\_64/bin/mingw32-make.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/Users/abcd1/Documents/Qt…

---

## [Cmake Error](https://discourse.cmake.org/t/cmake-error/6345)

<div class="topic-metadata">

**Author:** [@Yugoo](https://discourse.cmake.org/u/Yugoo)\
**Replies:** 6\
**Last updated:** [September 8, 2022, 6:39pm UTC](https://discourse.cmake.org/t/cmake-error/6345 "2022-09-08T18:39:00Z")

</div>

Hi, I am using Windows Subsystem for Linux (WSL), to run a project. I am encountering some errors when I try to build my project. \[cmake\] Not searching for unused variables given on the command line. \[cmake\] – The C c…

---

## [Is it possible to use CMake with and without a compile value?](https://discourse.cmake.org/t/is-it-possible-to-use-cmake-with-and-without-a-compile-value/6433)

<div class="topic-metadata">

**Author:** [@JRR](https://discourse.cmake.org/u/JRR)\
**Replies:** 1\
**Last updated:** [September 8, 2022, 2:33pm UTC](https://discourse.cmake.org/t/is-it-possible-to-use-cmake-with-and-without-a-compile-value/6433 "2022-09-08T14:33:13Z")

</div>

I don’t know how to title this… We have a C code base foo that defaults to creating foo with networking but if the preprocessor flag NO\_NETWORKING is defined it creates foo no networking. We use Visual Studio. What th…

---

## [Compiler randomness](https://discourse.cmake.org/t/compiler-randomness/6436)

<div class="topic-metadata">

**Author:** [@bambo09](https://discourse.cmake.org/u/bambo09)\
**Replies:** 0\
**Last updated:** [September 8, 2022, 9:25am UTC](https://discourse.cmake.org/t/compiler-randomness/6436 "2022-09-08T09:25:52Z")

</div>

The C++ compiler "C:/Programy/Programming/Qt/Qt\_5\_14\_1/Tools/mingw730\_64/bin/mingw32-make.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/Users/abcd1/Documents/Qt…

---

## [Usage of TARGET\_RUNTIME\_DLLS generator expression](https://discourse.cmake.org/t/usage-of-target-runtime-dlls-generator-expression/6355)

<div class="topic-metadata">

**Author:** [@ottmar-zittlau](https://discourse.cmake.org/u/ottmar-zittlau)\
**Replies:** 2\
**Last updated:** [September 7, 2022, 8:45pm UTC](https://discourse.cmake.org/t/usage-of-target-runtime-dlls-generator-expression/6355 "2022-09-07T20:45:48Z")

</div>

Hi, I’d like to copy all the dlls that are required for running a target to the output directory. In particular, I want to use the locally built optimization library ipopt, which depends on Intel’s MKL library. My CMa…

---

## [XCTest Swift, since XCode 12.5 not usable, error: cannot find 'XCTAssertEqual' in scope](https://discourse.cmake.org/t/xctest-swift-since-xcode-12-5-not-usable-error-cannot-find-xctassertequal-in-scope/6432)

<div class="topic-metadata">

**Author:** [@a4z](https://discourse.cmake.org/u/a4z)\
**Replies:** 0\
**Last updated:** [September 7, 2022, 8:06pm UTC](https://discourse.cmake.org/t/xctest-swift-since-xcode-12-5-not-usable-error-cannot-find-xctassertequal-in-scope/6432 "2022-09-07T20:06:39Z")

</div>

Hi, I have some Sift code that I build and test with CMake Since XCode 12.5, there has been an issue that the compilation of my XCTest does not work anymore. The build stops with error: cannot find 'XCTAssertEqual' in…

---

## [configure\_file(): cmakedefine default value](https://discourse.cmake.org/t/configure-file-cmakedefine-default-value/6427)

<div class="topic-metadata">

**Author:** [@Achpile](https://discourse.cmake.org/u/Achpile)\
**Replies:** 2\
**Last updated:** [September 6, 2022, 8:40pm UTC](https://discourse.cmake.org/t/configure-file-cmakedefine-default-value/6427 "2022-09-06T20:40:50Z")

</div>

Good day! Could you help me please? Is there any way to use ‘default’ values in .in files or some other logic? For example #cmakedefine TIME\_FORMAT @TIME\_FORMAT@ “%b %e %T” So if TIME\_FORMAT is set - it uses its valu…

---

## [RegExp semver fails to compile](https://discourse.cmake.org/t/regexp-semver-fails-to-compile/6424)

<div class="topic-metadata">

**Author:** [@hinell](https://discourse.cmake.org/u/hinell)\
**Replies:** 1\
**Last updated:** [September 6, 2022, 5:30pm UTC](https://discourse.cmake.org/t/regexp-semver-fails-to-compile/6424 "2022-09-06T17:30:48Z")

</div>

Any idea why the following RegExp matching fails? tee regexFailure.cmake \<\<EOL string(REGEX MATCH "^(\[0-9\]\[0-9\]\*)\\\\.(\[0-9\]\[0-9\]\*)\\\\.(\[0-9\]\[0-9\]\*)(-((\[0-9\]\[0-9\]|\[0-9\]\*\[a-zA-Z-\]\[0-9a-zA-Z-\]\*)(\\\\.(\[0-9\]\[0-9\]\*|\[0-9\]\*\[a-zA-Z…

---

## [Right way to look for include files in standard system directories?](https://discourse.cmake.org/t/right-way-to-look-for-include-files-in-standard-system-directories/2071)

<div class="topic-metadata">

**Author:** [@tomoreilly](https://discourse.cmake.org/u/tomoreilly)\
**Replies:** 4\
**Last updated:** [September 6, 2022, 9:29am UTC](https://discourse.cmake.org/t/right-way-to-look-for-include-files-in-standard-system-directories/2071 "2022-09-06T09:29:22Z")

</div>

Pardon my very newbie question - I want cmake to look in “standard” system locations for installed third-party headers - how to do that in a portable way? The variable CMAKE\_SYSTEM\_INCLUDE\_PATH looks promising, e.g. as …

---

## [building macOS CMake based project lacks backward compatibility](https://discourse.cmake.org/t/building-macos-cmake-based-project-lacks-backward-compatibility/6381)

<div class="topic-metadata">

**Author:** [@zohar81](https://discourse.cmake.org/u/zohar81)\
**Replies:** 1\
**Last updated:** [September 5, 2022, 12:54pm UTC](https://discourse.cmake.org/t/building-macos-cmake-based-project-lacks-backward-compatibility/6381 "2022-09-05T12:54:37Z")

</div>

I’ve got a CMake based project (called myLib.dylib) that that compiles in MacOS Monterey and produces an application and its dependency dynamic library (dylib file) since the project include some swift file, I generate …

---

## [FetchContent\_MakeAvailable: invalid reference master](https://discourse.cmake.org/t/fetchcontent-makeavailable-invalid-reference-master/6386)

<div class="topic-metadata">

**Author:** [@zhang-qiang-github](https://discourse.cmake.org/u/zhang-qiang-github)\
**Replies:** 2\
**Last updated:** [September 5, 2022, 5:52am UTC](https://discourse.cmake.org/t/fetchcontent-makeavailable-invalid-reference-master/6386 "2022-09-05T05:52:01Z")

</div>

I am using CMake in my project, and a bug is reported. My CMakeLists.txt is: ... include(FetchContent) FetchContent\_Declare(SUTK GIT\_REPOSITORY "xxx" SOURCE\_DIR "${CMAKE\_CURRENT\_SOURCE\_DIR}/SUTK" ) FetchContent…

---

## [cmake-gui doesn't implicilty use current working directory as source directory](https://discourse.cmake.org/t/cmake-gui-doesnt-implicilty-use-current-working-directory-as-source-directory/6407)

<div class="topic-metadata">

**Author:** [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)\
**Replies:** 1\
**Last updated:** [September 4, 2022, 11:02pm UTC](https://discourse.cmake.org/t/cmake-gui-doesnt-implicilty-use-current-working-directory-as-source-directory/6407 "2022-09-04T23:02:56Z")

</div>

See the following usage of CMake: $ cd binary\_search $ cmake --version cmake version 3.24.0 CMake suite maintained and supported by Kitware (kitware.com/cmake). $ cmake -B build -- The CXX compiler identification is GN…

---

## [First Time Compiling with MYSYS64](https://discourse.cmake.org/t/first-time-compiling-with-mysys64/6400)

<div class="topic-metadata">

**Author:** [@Davide](https://discourse.cmake.org/u/Davide)\
**Replies:** 3\
**Last updated:** [September 4, 2022, 10:38pm UTC](https://discourse.cmake.org/t/first-time-compiling-with-mysys64/6400 "2022-09-04T22:38:39Z")

</div>

I’m trying to create a C++ project. I would like to use CMake, but when I create a directory and CMakeLists.txt file and I try to run: \*\*C:\\Prog\> cmake -G “MSYS Makefiles” I doesn’t able to finish the buliding and the …

---

## [Subdirectories dependent on each other?](https://discourse.cmake.org/t/subdirectories-dependent-on-each-other/6402)

<div class="topic-metadata">

**Author:** [@RobN](https://discourse.cmake.org/u/RobN)\
**Replies:** 1\
**Last updated:** [September 3, 2022, 11:04pm UTC](https://discourse.cmake.org/t/subdirectories-dependent-on-each-other/6402 "2022-09-03T23:04:42Z")

</div>

Hi, I’m just starting to use CMake, and I’m following the tutorial. In steps 2 and 3, it shows you how to use add\_subdirectory(...) to add a library. I tried to apply this to my project, which has a structure like this: …

---

## [What does the install keyword do exactly ?](https://discourse.cmake.org/t/what-does-the-install-keyword-do-exactly/6394)

<div class="topic-metadata">

**Author:** [@AvanteElectro](https://discourse.cmake.org/u/AvanteElectro)\
**Replies:** 1\
**Last updated:** [September 3, 2022, 1:42am UTC](https://discourse.cmake.org/t/what-does-the-install-keyword-do-exactly/6394 "2022-09-03T01:42:02Z")

</div>

Hi ! I’ve read the install keyword page https://cmake.org/cmake/help/latest/command/install.html but I don’t understand what this keyword actually does. I know 2 use cases of this keyword from the Step 4 of the Cmake T…

---

## [How to get all the properties of a target](https://discourse.cmake.org/t/how-to-get-all-the-properties-of-a-target/6391)

<div class="topic-metadata">

**Author:** [@Juddd](https://discourse.cmake.org/u/Juddd)\
**Replies:** 1\
**Last updated:** [September 2, 2022, 12:25pm UTC](https://discourse.cmake.org/t/how-to-get-all-the-properties-of-a-target/6391 "2022-09-02T12:25:47Z")

</div>

In CMake, I want to get all property names that are set for a target. In this post(How to print all the properties of a target in cmake? - Stack Overflow), they use cmake --help-property-list to list a predefined set. …

---

## [Object file names use absolute path to sources outside source tree](https://discourse.cmake.org/t/object-file-names-use-absolute-path-to-sources-outside-source-tree/6383)

<div class="topic-metadata">

**Author:** [@jmqwerk](https://discourse.cmake.org/u/jmqwerk)\
**Replies:** 6\
**Last updated:** [September 2, 2022, 8:13am UTC](https://discourse.cmake.org/t/object-file-names-use-absolute-path-to-sources-outside-source-tree/6383 "2022-09-02T08:13:57Z")

</div>

Is it possible to override the current directory that CMake is using for relative file paths from a specific CMakeLists.txt file? The use case for this is to reduce very long object filenames in windows caused by full pa…

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

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