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
75
votes
5 answers

CMake: The C Compiler is not able to compile a simple test program

I am trying to cross-compile the Azure IoT SDK C for a Mips processor. Cross-compiling an older version of the same SDK using an older version of CMake (2.8.12.2) works just fine, so I doubt it's the code itself. I am guessing it's the Mips GCC…
Kagemand Andersen
  • 1,470
  • 2
  • 16
  • 30
75
votes
4 answers

How to print all the properties of a target in cmake?

With the following cmake scrpt: get_cmake_property(_variableNames VARIABLES) foreach (_variableName ${_variableNames}) message(STATUS "${_variableName}=${${_variableName}}") endforeach() We can print all the variables in the CMake project. Then…
feelfree
  • 11,175
  • 20
  • 96
  • 167
74
votes
5 answers

Creating symbol table for gdb using cmake

Is there any way to create only symbol table using cmake for gdb ?
Vivek Goel
  • 22,942
  • 29
  • 114
  • 186
74
votes
7 answers

How to copy directory from source tree to binary tree?

Copying directory from source tree to binary tree. For example: How to copy www to bin folder. work ├─bin └─src ├─doing │ └─www ├─include └─lib Thanks.
Jiang Bian
  • 1,933
  • 3
  • 16
  • 14
74
votes
4 answers

Running CMake on Windows

I am currently trying to get CMake to run on my Windows 7 (64-bit) system. I want to compile TagLib for later use with a Qt application I am working on. I would like to compile it with MinGW (not Visual C++ as in this other question). I download the…
Joel Verhagen
  • 5,110
  • 4
  • 38
  • 47
74
votes
4 answers

How can I use the tool 'Include What You Use' together with CMake to detect unused headers?

The tool Include What You Use can be used to detect unneeded headers. I am using CMake for my C++ software project. How can I instruct CMake to run Include What You Use automatically on the source files of my software project?
Erik Sjölund
  • 10,690
  • 7
  • 46
  • 74
74
votes
9 answers

CMake: use a custom linker

I want to setup a custom toolchain with CMake. I've set the compiler but I don't know how to set the linker. This error is reported because CMake try to use the compiler to link: The C compiler "xgcc.exe" is not able to compile a simple test…
Breezeight
  • 1,855
  • 2
  • 22
  • 27
73
votes
8 answers

How to generate CMakeLists.txt?

I need some pointers/advice on how to automatically generate CMakeLists.txt files for CMake. Does anyone know of any existing generators? I've checked the ones listed in the CMake Wiki but unfortunately they are not suitable for me. I already have…
celavek
  • 5,575
  • 6
  • 41
  • 69
73
votes
5 answers

Linking different libraries for Debug and Release builds in Cmake on windows?

So I've got a library I'm compiling and I need to link different third party things in depending on if it's the debug or release build (specifically the release or debug versions of those libraries). Is there an easy way to do this in Cmake? Edit:…
gct
  • 14,100
  • 15
  • 68
  • 107
73
votes
5 answers

CMAKE - How to properly copy static library's header file into /usr/include?

I'm getting into CMAKE usage with C and actually I'm creating two very small static libraries. My goal is: The libraries are compiled and linked into *.a files. [THIS WORKS] Then I wish to copy that *.a files into /usr/local/lib [THIS ALSO…
Miroslav Mares
  • 2,292
  • 3
  • 22
  • 27
72
votes
2 answers

cmake, print compile/link commands

Can somebody please enlighten me as to what the command line flag to CMake might be that will make it print out all the compile/link commands it executes? I can't find this anywhere in the documentation. Many hours of my life have just evaporated.…
mr grumpy
  • 1,513
  • 1
  • 10
  • 17
72
votes
16 answers

How can I get CMake to find my alternative Boost installation?

I have installed the most recent version of Boost in /usr/local (with includes in /usr/local/include/boost and libraries in /usr/local/lib/boost) and I am now attempting to install Wt from source, but CMake (version 2.6) can't seem to find the Boost…
BD at Rivenhill
  • 12,395
  • 10
  • 46
  • 49
72
votes
6 answers

cmake not working, could not exec qmake

I am using Ubuntu 14.04. I'm trying to install a program which requires cmake. When I run cmake src/ I get: qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory What am I doing wrong?
Alexandre Holden Daly
  • 6,944
  • 5
  • 25
  • 36
72
votes
6 answers

cmake - find_library - custom library location

I'm currently trying to get CMake running for my project (on windows). I want to use a custom location where all libraries are installed. To inform CMake about that path I tried to do that: set(CMAKE_PREFIX_PATH D:/develop/cmake/libs) But when I…
Daniel
  • 2,993
  • 2
  • 23
  • 40
71
votes
3 answers

Add Source in a subdirectory to a cmake project

I have project which has not been divided into libraries, but the source is organized in a directory tree. I do not know how to tell cmake to go down a directory, then add the source in that directory to project defined in the parent directory. I…
2NinerRomeo
  • 2,687
  • 4
  • 29
  • 35