Questions tagged [cmake]

CMake is a cross-platform, open-source build system generator. It generates files for build systems like native makefiles, ninja-build and project files for several integrated development environments.

CMake is a cross-platform, open-source build system generator. It generates files for build systems like native makefiles, ninja-build and project files for several integrated development environments.

It is often used along with , and .

Official

Quick Start / Howtos

Wisdom of the Stack

Books

27471 questions
10
votes
2 answers

When trying to generate an Xcode project from a cmake folder, I get an error related to Xcode new build system

I am trying to generate an Xcode project from a cmake folder, using this very good answer. When executing this command: cmake -G Xcode I get: CMake Error in CMakeLists.txt: The custom command generating …
Alfonso Tesauro
  • 1,730
  • 13
  • 21
10
votes
1 answer

macOS build universal binary 2 with CMake

How would I build a Universal Binary 2 that supports both Intel and Apple Silicon using CMake/Make? I have found some documentation here - https://developer.apple.com/documentation/xcode/building_a_universal_macos_binary - but that uses XCode, which…
theBanana19
  • 101
  • 1
  • 3
10
votes
0 answers

find_package for a static library instead of a shared library

When building my project with CMake, I would like it to link to libraries statically (if available). Right now, it finds .dll.a files, regardless of the existence of .a files. For example, take linking to libpng in a small sample…
Rheel
  • 410
  • 4
  • 19
10
votes
0 answers

Cmake: only one configuration for a specific sub project, Debug&Release for all others

In my root folder's CMakeLists.txt I have defined the possible configurations to be Debug and Release: if(NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_CONFIGURATION_TYPES Debug Release) set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}"…
PhilLab
  • 4,777
  • 1
  • 25
  • 77
10
votes
3 answers

How can I specify library path when using Meson?

I'm trying to build a c++ project with Meson. The thing is, I have some libraries under /opt/conda but can't figure out how to link the project when running meson build. It seems to be only searching through /usr/lib directory. As far as I…
Jinu
  • 536
  • 1
  • 4
  • 12
10
votes
7 answers

ERROR: Unable to start debugging. Unexpected GDB output from command "-exec-run". Unable to find Mach task port for process-id 1401

I am trying to use GDB to run the debugger in VSCode in a C++ project, but I keep getting this error when running my debugger. I have set up a cert and everything and it is still giving me this error (I am running macOS Catalina version…
Nathan Anderson
  • 155
  • 1
  • 2
  • 7
10
votes
2 answers

CMake FetchContent show download progress

Is there some way to show download progress while downloading git repository using FetchContent? I tried to clear FETCHCONTENT_QUIET, but it did nothing. I have no idea if it is even possible.
Etwus
  • 549
  • 5
  • 15
10
votes
1 answer

In CLion, how do you set CMakeLists.txt option values?

I'm trying to use CLion (latest version - 2019.3) to work on a source repository of mine, which already uses CMake (i.e. has a CMakeLists.txt). Now, the package has some options regarding which targets to build; by default it builds just a few, but…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
10
votes
2 answers

How do I get Wireguard-Android make file to function on Windows?

I'm trying to build the wireguard-android sources on my windows machine, fixing the problems step by step with trial and error. I have CMake and Make installed, the first problem I encountered was the 'bad' value reported by uname (mingw64), not…
Nick Cardoso
  • 20,807
  • 14
  • 73
  • 124
10
votes
1 answer

CMake configure fails to find Qt5 on Linux

I'm running in visual studio code the following message occurs when building cmake By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt5", but CMake did not find…
MarcosApps
  • 414
  • 2
  • 4
  • 15
10
votes
2 answers

How to use dynamic link library with CMake?

I have simple program as follow: CMakeLists.txt: cmake_minimum_required(VERSION 3.5) project(test LANGUAGES CXX) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}) add_executable(test…
Nima Ghorab
  • 309
  • 1
  • 3
  • 13
10
votes
1 answer

How to use lld with CMake on Windows?

I'm trying to compile SDL2 (https://www.libsdl.org/download-2.0.php) using CMake with clang + lld (http://releases.llvm.org/) + mingw (https://sourceforge.net/projects/mingw-w64/) headers on Windows 10. Despite my many efforts, I seem unable to get…
10
votes
1 answer

With CMake, how can I set environment properties on the gtest_discover_tests --gtest_list_tests call?

I'm currently working on migrating our current build environment from MSBuild to CMake. I have a situation where I need to update the PATH variable in order for the units tests executable to run. This is not a issue for gtest_add_tests, as it uses…
travis
  • 233
  • 3
  • 11
10
votes
1 answer

CMake with gRPC cannot find gRPCTargets.cmake

I am having issues building the grpc cpp helloworld example with cmake. I built and installed grpc with cmake initially, and then with make directly. I have found this issue raised by someone else in the past, which was closed as resolved. It does…
codentary
  • 993
  • 1
  • 14
  • 33
10
votes
5 answers

Gradle sync fails with cmake "cause: executing external native build for cmake"

I'm trying to build my colleagues' project in Android Studio, which requires CMake SDK to build the external c/cpp files included in the project. The problem I'm running into is despite having installed the LLDB, NDK, and CMake SDK tools through SDK…
e.cho
  • 101
  • 1
  • 1
  • 7