# Usage

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

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

**Page:** 30

---

## [How to choose compiler (cl, clang, clang-cl) on Windows?](https://discourse.cmake.org/t/how-to-choose-compiler-cl-clang-clang-cl-on-windows/10263)

<div class="topic-metadata">

**Author:** [@garyo](https://discourse.cmake.org/u/garyo)\
**Replies:** 2\
**Last updated:** [March 4, 2024, 4:19pm UTC](https://discourse.cmake.org/t/how-to-choose-compiler-cl-clang-clang-cl-on-windows/10263 "2024-03-04T16:19:32Z")

</div>

On Win11, a good way to start is to open a Developer Powershell in terminal.exe. That has all the compilers and tools in the path. Specifically it has cl.exe, clang.exe, and clang-cl.exe. CMake seems to pick cl.exe by de…

---

## [CXX compiler identification is different version](https://discourse.cmake.org/t/cxx-compiler-identification-is-different-version/10268)

<div class="topic-metadata">

**Author:** [@KBOPYM](https://discourse.cmake.org/u/KBOPYM)\
**Replies:** 1\
**Last updated:** [March 2, 2024, 9:54pm UTC](https://discourse.cmake.org/t/cxx-compiler-identification-is-different-version/10268 "2024-03-02T21:54:07Z")

</div>

I had VS2022, but project was incompatible with it, so I uninstalled it and got VS2019. I assume cmake kept info of the old compilers and now fails to work -- The CXX compiler identification is MSVC 19.29.30154.0 -- Th…

---

## [MSVC\_RUNTIME\_LIBRARY completely ignored](https://discourse.cmake.org/t/msvc-runtime-library-completely-ignored/10004)

<div class="topic-metadata">

**Author:** [@StillWaters77](https://discourse.cmake.org/u/StillWaters77)\
**Replies:** 2\
**Last updated:** [March 1, 2024, 2:40pm UTC](https://discourse.cmake.org/t/msvc-runtime-library-completely-ignored/10004 "2024-03-01T14:40:03Z")

</div>

Hello, i have a weird problem with CMake and the MSVC runtime on windows. My application is statically linked against the msvc runtime, which means all libraries i am linking statically, also have to be linked against …

---

## [Upgrade CDash from 2.6.0 to 3](https://discourse.cmake.org/t/upgrade-cdash-from-2-6-0-to-3/9916)

<div class="topic-metadata">

**Author:** [@vlebourl](https://discourse.cmake.org/u/vlebourl)\
**Replies:** 2\
**Last updated:** [March 1, 2024, 2:09pm UTC](https://discourse.cmake.org/t/upgrade-cdash-from-2-6-0-to-3/9916 "2024-03-01T14:09:06Z")

</div>

Hi, I’m posting here as I can’t find any resource elsewhere. Please forgive me if it’s out of place. I’m trying to migrate a CDash installation on version 2.6 to a new server and a new instance of CDash 3.2.1. I manage…

---

## [Function Linkage difference between binary and library](https://discourse.cmake.org/t/function-linkage-difference-between-binary-and-library/10153)

<div class="topic-metadata">

**Author:** [@Vekleon](https://discourse.cmake.org/u/Vekleon)\
**Replies:** 2\
**Last updated:** [February 28, 2024, 8:40pm UTC](https://discourse.cmake.org/t/function-linkage-difference-between-binary-and-library/10153 "2024-02-28T20:40:29Z")

</div>

I’m seeing that when I compile an executable with a large library, and I check the function definitions via nm I see that the functions in the binary is defined i.e nm program ....... T funcnameFromLibrary and the CMak…

---

## [Stored procedure compilation without main function](https://discourse.cmake.org/t/stored-procedure-compilation-without-main-function/10150)

<div class="topic-metadata">

**Author:** [@Vekleon](https://discourse.cmake.org/u/Vekleon)\
**Replies:** 2\
**Last updated:** [February 28, 2024, 8:38pm UTC](https://discourse.cmake.org/t/stored-procedure-compilation-without-main-function/10150 "2024-02-28T20:38:02Z")

</div>

I’m trying to make a stored procedure for a database with the use of a large library (hence the need for cmake). The issue is that I’m hitting a undefined reference to 'main' error. My stored procedures don’t need a mai…

---

## [Link line dependency order using target\_link\_libraries](https://discourse.cmake.org/t/link-line-dependency-order-using-target-link-libraries/10174)

<div class="topic-metadata">

**Author:** [@Brian\_M1177](https://discourse.cmake.org/u/Brian_M1177)\
**Replies:** 2\
**Last updated:** [February 28, 2024, 1:22pm UTC](https://discourse.cmake.org/t/link-line-dependency-order-using-target-link-libraries/10174 "2024-02-28T13:22:02Z")

</div>

Hello, I am trying to create a set of libraries that are not linked until the application definition. This is to allow the selection of functionality, in this case some log features, by the user. However I am seeing tha…

---

## [Regression involving \`target\_compile\_definitions(\<target\> INTERFACE)\` recently?](https://discourse.cmake.org/t/regression-involving-target-compile-definitions-target-interface-recently/10216)

<div class="topic-metadata">

**Author:** [@h-vetinari](https://discourse.cmake.org/u/h-vetinari)\
**Replies:** 1\
**Last updated:** [February 28, 2024, 10:44am UTC](https://discourse.cmake.org/t/regression-involving-target-compile-definitions-target-interface-recently/10216 "2024-02-28T10:44:45Z")

</div>

Hey there, I help package things in conda-forge, a pretty large ecosystem for Python, R, scientific computing, etc. We essentially do binary redistribution, but with tightly controlled metadata to ensure each environment…

---

## [Check whether INSTALL target exists](https://discourse.cmake.org/t/check-whether-install-target-exists/10168)

<div class="topic-metadata">

**Author:** [@EosPengwern](https://discourse.cmake.org/u/EosPengwern)\
**Replies:** 2\
**Last updated:** [February 27, 2024, 11:15pm UTC](https://discourse.cmake.org/t/check-whether-install-target-exists/10168 "2024-02-27T23:15:45Z")

</div>

Context: I am writing a CMake library for use by a number of my colleagues. Any of their projects may generate a number of executables and libraries, not all of which they want to install, so I make them set CMake variab…

---

## [Fix Android Studio C/C++ project compile issues referencing cmake](https://discourse.cmake.org/t/fix-android-studio-c-c-project-compile-issues-referencing-cmake/3400)

<div class="topic-metadata">

**Author:** [@Bluechip\_Servers](https://discourse.cmake.org/u/Bluechip_Servers)\
**Replies:** 3\
**Last updated:** [May 25, 2021, 5:19pm UTC](https://discourse.cmake.org/t/fix-android-studio-c-c-project-compile-issues-referencing-cmake/3400 "2021-05-25T17:19:42Z")

</div>

I have an Android Studio project which has C/C++ functions, when I try to build apk, I get this errors, I have searched online for possible fix but could not ix this particular problem. Error: C/C++ debug|x86 : CMake E…

---

## [HAVE\_QT is not defined?](https://discourse.cmake.org/t/have-qt-is-not-defined/10200)

<div class="topic-metadata">

**Author:** [@Tariq](https://discourse.cmake.org/u/Tariq)\
**Replies:** 1\
**Last updated:** [February 27, 2024, 2:31pm UTC](https://discourse.cmake.org/t/have-qt-is-not-defined/10200 "2024-02-27T14:31:38Z")

</div>

Hi, I was trying to build opencv 4.5.5 on Linux Mint 21.3 with the cvv module from opencv-contrib. I used the following to do so cd /tmp # Download OpenCV wget -q https://github.com/opencv/opencv/archive/4.5.5.zip unzip…

---

## [FetchContent\_MakeAvailable could not find header generated by configure\_file](https://discourse.cmake.org/t/fetchcontent-makeavailable-could-not-find-header-generated-by-configure-file/10191)

<div class="topic-metadata">

**Author:** [@miaodi](https://discourse.cmake.org/u/miaodi)\
**Replies:** 1\
**Last updated:** [February 27, 2024, 2:26pm UTC](https://discourse.cmake.org/t/fetchcontent-makeavailable-could-not-find-header-generated-by-configure-file/10191 "2024-02-27T14:26:56Z")

</div>

I am trying to add a lib called taco to my own project. I use cmake’s FetchContent to add it: FetchContent\_Declare( taco GIT\_REPOSITORY https://github.com/tensor-compiler/taco.git GIT\_TAG master ) FetchContent\_MakeAv…

---

## [Installed module library can't find imported headers \[Ubuntu 22.04 LTS, CMake 3.28.1, Ninja 1.11.1 and Clang 17.0.6\]](https://discourse.cmake.org/t/installed-module-library-cant-find-imported-headers-ubuntu-22-04-lts-cmake-3-28-1-ninja-1-11-1-and-clang-17-0-6/9819)

<div class="topic-metadata">

**Author:** [@josecruz](https://discourse.cmake.org/u/josecruz)\
**Replies:** 22\
**Last updated:** [February 25, 2024, 12:29pm UTC](https://discourse.cmake.org/t/installed-module-library-cant-find-imported-headers-ubuntu-22-04-lts-cmake-3-28-1-ninja-1-11-1-and-clang-17-0-6/9819 "2024-02-25T12:29:05Z")

</div>

Using Ubuntu 22.04 LTS, CMake 3.28.1, Ninja 1.11.1 and Clang 17.0.6, I’m trying to create a library using modules, supported under these conditions, as described at import-cmake-the-experiment-is-over. I managed to succ…

---

## [Error linking against protoc generated object libray](https://discourse.cmake.org/t/error-linking-against-protoc-generated-object-libray/10176)

<div class="topic-metadata">

**Author:** [@poldi](https://discourse.cmake.org/u/poldi)\
**Replies:** 1\
**Last updated:** [February 25, 2024, 12:52am UTC](https://discourse.cmake.org/t/error-linking-against-protoc-generated-object-libray/10176 "2024-02-25T00:52:43Z")

</div>

I’m trying to get the Protobuf Tutorial to build and cannot figure out how to link against the protoc generated library I’m running cmake version 3.22.1 on Ubuntu The root cmake looks like this cmake\_minimum\_required(…

---

## [Prevent fatal\_error on FetchContent\_Declare](https://discourse.cmake.org/t/prevent-fatal-error-on-fetchcontent-declare/10091)

<div class="topic-metadata">

**Author:** [@etiennemlb](https://discourse.cmake.org/u/etiennemlb)\
**Replies:** 2\
**Last updated:** [February 24, 2024, 8:59am UTC](https://discourse.cmake.org/t/prevent-fatal-error-on-fetchcontent-declare/10091 "2024-02-24T08:59:40Z")

</div>

How do you use FetchContent\_Declare/FetchContent\_MakeAvailable (FetchContent\_Populate) without having it throw a fatal\_error if the download fails ? The use case is like so: find\_package, if it fails do a FetchContent…

---

## [CMake intermittently doesn't find ASM during build](https://discourse.cmake.org/t/cmake-intermittently-doesnt-find-asm-during-build/9294)

<div class="topic-metadata">

**Author:** [@gino-ashling](https://discourse.cmake.org/u/gino-ashling)\
**Replies:** 5\
**Last updated:** [February 22, 2024, 7:34am UTC](https://discourse.cmake.org/t/cmake-intermittently-doesnt-find-asm-during-build/9294 "2024-02-22T07:34:52Z")

</div>

Usually, all works fine with the scripts and commands. We’ve been seeing this issue occasionally from time to time, during many different unrelated regression tests. Please see the command used and the error log: \*cm…

---

## [cmake tutorials problems](https://discourse.cmake.org/t/cmake-tutorials-problems/10093)

<div class="topic-metadata">

**Author:** [@frankdeming](https://discourse.cmake.org/u/frankdeming)\
**Replies:** 13\
**Last updated:** [February 22, 2024, 7:05am UTC](https://discourse.cmake.org/t/cmake-tutorials-problems/10093 "2024-02-22T07:05:48Z")

</div>

Hi All! I have been having problems with going through cmake tutorials as I always get failures when invoking Cmake build Or Cmake –system-information – Building for: Visual Studio 17 2022 CMake Error at CMakeLists…

---

## [Syntax for execute\_process with two executables in command line](https://discourse.cmake.org/t/syntax-for-execute-process-with-two-executables-in-command-line/10141)

<div class="topic-metadata">

**Author:** [@EosPengwern](https://discourse.cmake.org/u/EosPengwern)\
**Replies:** 2\
**Last updated:** [February 21, 2024, 11:15pm UTC](https://discourse.cmake.org/t/syntax-for-execute-process-with-two-executables-in-command-line/10141 "2024-02-21T23:15:31Z")

</div>

In my cmake file, there is a line of the form: execute\_process(COMMAND cmake -E echo "Executing: my\_application.exe file\_being\_analysed.exe --output results\_dir" COMMAND my\_application.exe file\_being…

---

## [Ctest not running Gtests under suite](https://discourse.cmake.org/t/ctest-not-running-gtests-under-suite/5443)

<div class="topic-metadata">

**Author:** [@acpaquette](https://discourse.cmake.org/u/acpaquette)\
**Replies:** 2\
**Last updated:** [February 21, 2024, 4:40pm UTC](https://discourse.cmake.org/t/ctest-not-running-gtests-under-suite/5443 "2024-02-21T16:40:13Z")

</div>

Hello all, I am running into an execution inconsistency between gtest and ctest. Our project is a legacy project that original had a recursive make system but has been updated to a cmake system collecting old tests as w…

---

## [Leveraging precompiled headers](https://discourse.cmake.org/t/leveraging-precompiled-headers/10137)

<div class="topic-metadata">

**Author:** [@Bert](https://discourse.cmake.org/u/Bert)\
**Replies:** 1\
**Last updated:** [February 21, 2024, 2:41pm UTC](https://discourse.cmake.org/t/leveraging-precompiled-headers/10137 "2024-02-21T14:41:00Z")

</div>

I’ve been continuing to read Professional CMake, and there’s a section within that book about precompiled headers. I’m trying to wrap my head around how to best utilize these precompiled headers in my project. To help v…

---

## [Embedding binaries within macOS bundle](https://discourse.cmake.org/t/embedding-binaries-within-macos-bundle/9989)

<div class="topic-metadata">

**Author:** [@j-boivie](https://discourse.cmake.org/u/j-boivie)\
**Replies:** 7\
**Last updated:** [February 21, 2024, 9:37am UTC](https://discourse.cmake.org/t/embedding-binaries-within-macos-bundle/9989 "2024-02-21T09:37:24Z")

</div>

Howdy folks, long time listener first time caller etc. I’m looking for information on how to embed an executable binary within a macOS app bundle when using CMake with Xcode. My project is set up as follows: Executable…

---

## [set(CMAKE\_CXX\_STANDARD) adding 2 more commands, is that necessary ?](https://discourse.cmake.org/t/set-cmake-cxx-standard-adding-2-more-commands-is-that-necessary/10134)

<div class="topic-metadata">

**Author:** [@WaltOnline](https://discourse.cmake.org/u/WaltOnline)\
**Replies:** 1\
**Last updated:** [February 20, 2024, 11:54am UTC](https://discourse.cmake.org/t/set-cmake-cxx-standard-adding-2-more-commands-is-that-necessary/10134 "2024-02-20T11:54:57Z")

</div>

Hi! I can set a latest C++ standard with set(CMAKE\_CXX\_STANDARD 23) or add\_compile\_options(“/std:c++latest”) I set verbose mode to see what it’s doing under the hood and In case of set(CMAKE\_CXX\_STANDARD 23) CMake bu…

---

## [Detecting CXX compiler ABI info - failed](https://discourse.cmake.org/t/detecting-cxx-compiler-abi-info-failed/10081)

<div class="topic-metadata">

**Author:** [@N\_Bhargav](https://discourse.cmake.org/u/N_Bhargav)\
**Replies:** 2\
**Last updated:** [February 19, 2024, 9:57pm UTC](https://discourse.cmake.org/t/detecting-cxx-compiler-abi-info-failed/10081 "2024-02-19T21:57:02Z")

</div>

Hi, We are getting Detecting CXX compiler ABI info - failed error message. PFA log of the error and CopyOfCmakeCache.txt. Kindly help us in resolving the error. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*…

---

## [please post your config file on discourse.cmake.org so it can be added to cmake](https://discourse.cmake.org/t/please-post-your-config-file-on-discourse-cmake-org-so-it-can-be-added-to-cmake/10041)

<div class="topic-metadata">

**Author:** [@ygramoel](https://discourse.cmake.org/u/ygramoel)\
**Replies:** 5\
**Last updated:** [February 19, 2024, 1:48pm UTC](https://discourse.cmake.org/t/please-post-your-config-file-on-discourse-cmake-org-so-it-can-be-added-to-cmake/10041 "2024-02-19T13:48:54Z")

</div>

While trying to compile a modified version of LLVM in MSYS MINGW64, I got this message repeatedly: please post your config file on discourse.cmake.org so it can be added to cmake so that’s exactly what I am trying to …

---

## [OpenMP linking errors on Windows using Ninja and clang](https://discourse.cmake.org/t/openmp-linking-errors-on-windows-using-ninja-and-clang/7246)

<div class="topic-metadata">

**Author:** [@KrisThielemans](https://discourse.cmake.org/u/KrisThielemans)\
**Replies:** 2\
**Last updated:** [February 19, 2024, 1:29pm UTC](https://discourse.cmake.org/t/openmp-linking-errors-on-windows-using-ninja-and-clang/7246 "2024-02-19T13:29:55Z")

</div>

In our project we use OpenMP successfully in many systems, including Windows with VS compiler (and I believe both VS generator and Ninja). Relevant lines are essentially target\_link\_libraries(buildblock OpenMP::OpenMP\_C…

---

## [CMAKE C compiler not found](https://discourse.cmake.org/t/cmake-c-compiler-not-found/10130)

<div class="topic-metadata">

**Author:** [@Ahmed\_Wafi](https://discourse.cmake.org/u/Ahmed_Wafi)\
**Replies:** 2\
**Last updated:** [February 19, 2024, 1:31pm UTC](https://discourse.cmake.org/t/cmake-c-compiler-not-found/10130 "2024-02-19T13:31:39Z")

</div>

hi every one!..im new to cmake and am follow a tutorial on learnopengl.com…so when i hit configure it\`s give ,this error: The C compiler identification is unknown CMake Error at CMakeLists.txt:3 (project): No CMAKE\_C\_…

---

## [How to correctly define CMakeLists.txt for Tesseract?](https://discourse.cmake.org/t/how-to-correctly-define-cmakelists-txt-for-tesseract/10122)

<div class="topic-metadata">

**Author:** [@Raphy](https://discourse.cmake.org/u/Raphy)\
**Replies:** 2\
**Last updated:** [February 19, 2024, 9:44am UTC](https://discourse.cmake.org/t/how-to-correctly-define-cmakelists-txt-for-tesseract/10122 "2024-02-19T09:44:05Z")

</div>

I want to compile and build with CMake this simple tesseract C++ code: // https://tesseract-ocr.github.io/tessdoc/Examples\_C++.html #include \<tesseract/baseapi.h\> #include \<leptonica/allheaders.h\> int main() { char…

---

## [Comparing Visual Studio IDE default release build vs CMake default release build](https://discourse.cmake.org/t/comparing-visual-studio-ide-default-release-build-vs-cmake-default-release-build/10098)

<div class="topic-metadata">

**Author:** [@One\_Cable5781](https://discourse.cmake.org/u/One_Cable5781)\
**Replies:** 4\
**Last updated:** [February 19, 2024, 4:12am UTC](https://discourse.cmake.org/t/comparing-visual-studio-ide-default-release-build-vs-cmake-default-release-build/10098 "2024-02-19T04:12:32Z")

</div>

Hello, I am trying to transition from Visual Studio IDE’s vcxproj project files and embrace CMake. By default, Visual Studio’s release mode comes with the following settings: UseDebugLibraries false WholeProg…

---

## [Incorrect Source File Paths](https://discourse.cmake.org/t/incorrect-source-file-paths/10123)

<div class="topic-metadata">

**Author:** [@bhvima](https://discourse.cmake.org/u/bhvima)\
**Replies:** 3\
**Last updated:** [February 19, 2024, 4:04am UTC](https://discourse.cmake.org/t/incorrect-source-file-paths/10123 "2024-02-19T04:04:56Z")

</div>

I created a very simple CMake project to demonstrate my issue. ├── CMakeLists.txt └── apps ├── CMakeLists.txt └── src └── main.cpp # CMakeLists.txt cmake\_minimum\_required(VERSION 3.19) # Set the projec…

---

## [Source Files Path in Executable](https://discourse.cmake.org/t/source-files-path-in-executable/10119)

<div class="topic-metadata">

**Author:** [@bhvima](https://discourse.cmake.org/u/bhvima)\
**Replies:** 2\
**Last updated:** [February 18, 2024, 3:44am UTC](https://discourse.cmake.org/t/source-files-path-in-executable/10119 "2024-02-18T03:44:44Z")

</div>

I am using CMake to build a large project. The source directory is /home/user/project and the build directory is /home/user/project/build/linux. In the final executable generated when I look at the DW\_AT\_name it is /hom…

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

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