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

Renaming `CMakeLists.txt`

Is there any way to rename the various CMakeLists.txt into something more meaningful? It can be quite distracting to have a bunch of them open at the same time when working on a bigger project that contains several CMake projects.
mattmilten
  • 6,242
  • 3
  • 35
  • 65
10
votes
0 answers

How to add an existing cmake project to the Visual Studio Solution

I am using Visual Studio 2017 and I have a solution consisting of several projects mainly in C++. Now I want to add an existing C++ project which using CMake for building to my solution in visual studio and build it along with other projects in…
Reza
  • 3,473
  • 4
  • 35
  • 54
10
votes
1 answer

How to cross compile with cmake + arm-none-eabi on windows?

I like to automate the cross compiling for several projects on a Windows build server. I have some problems with the arm cross compiler. Setting it up seems a bit difficult. The cmake compiler check fails with a linking error(see below). My…
Stefan Jaritz
  • 1,999
  • 7
  • 36
  • 60
10
votes
1 answer

Cmake command line too long windows

From my understanding of cmake, the tool takes care of file path and command lines length to avoid reaching windows limitation of 8191 characters. However I'm cross compiling with arm_none_eabi on windows and cmake doesn't generate a makefile using…
Julien
  • 1,810
  • 1
  • 16
  • 34
10
votes
1 answer

Import own native shared library from sub-module in Android Studio / CMake

I have a Android Studio (2.3) project with 2 modules, using CMake for native code. Project --> Module1 (app): java + native JNI-wrapper, linking to libnative.so --> Module2 (libnative): native c++ code, producing libnative.so What is the…
Fimagena
  • 321
  • 2
  • 7
10
votes
2 answers

How to separate header file and source file in CMake?

My project is in the structure as follows: --root: main.cpp CMakeLists.txt --src: function.cpp CMakeLists.txt --include: function.h main.cpp: #include #include "function.h" using namespace std; int main(int argc, char…
Qinchen
  • 381
  • 1
  • 3
  • 14
10
votes
1 answer

cmake - list does not recognize sub-command FILTER

cmake --version cmake version 3.5.2 list(FILTER HEADERS EXCLUDE REGEX "^\\..+") CMake Error at CMakeLists.txt:49 (list): list does not recognize sub-command FILTER Is it problem with version I am using? Its on ubuntu. Its the latest version one…
Necktwi
  • 2,483
  • 7
  • 39
  • 62
10
votes
1 answer

Android, CMake and Static Linking

In converting a library project build from Android.mk to CMakeLists.txt following the Google hello-libs example and I have encountered problems avoiding undefined references. I'm using an open source project called DCMTK and compiling DCMTK and…
Cameron Lowell Palmer
  • 21,528
  • 7
  • 125
  • 126
10
votes
4 answers

CMake Add (Test) Executable

I would like to create two executables: one executable for the application, and one for the testing of the application. To that end, I have the following in my CMakeLists.txt file: include_directories(include) file(GLOB SOURCE "src/*.cc") file(GLOB…
Ari
  • 4,121
  • 8
  • 40
  • 56
10
votes
1 answer

check if a c++11 feature is enabled in compiler with CMAKE

I'm developing a project with CMake. My code contains constexpr methods, that are allowed in Visual Studio 2015, but not in Visual Studio 2013. How can I check in the CMakeLists.txt if the feature is supported by the specified compiler? I've seen in…
Jepessen
  • 11,744
  • 14
  • 82
  • 149
10
votes
1 answer

Cannot find a header with 'include_directories' in CMake

Here is the folder hierarchy of a c++ project: 1. FolderA 1. file1.h/cpp 2. CMakeLists.txt (CmakeA) 2. FolderB 1. file2.h/cpp 2. CMakeLists.txt (CmakeB) 3. main.cpp 4. CMakeLists.txt (CmakeAll) CmakeA: file(GLOB FolderA_FILES…
Maystro
  • 2,907
  • 8
  • 36
  • 71
10
votes
4 answers

CMake, OS X bundle, recursively copy directory to Resources

I am trying to transition our Qt application to CMake, and one of the targets is an OS X app. It requires a certain folder to be put in its our.app/Contents/Resources folder. I tried adding it using file properties, but I only managed to copy the…
Ibolit
  • 9,218
  • 7
  • 52
  • 96
10
votes
1 answer

Why does CMake EXPORT require static libraries used to build a shared library?

I'm attempting to make it easier for other projects to link against the shared libraries we distribute with our project. When I try to take advantage of the EXPORT mechanism, CMake complains that I'm not including the static libraries used to build…
rpmcnally
  • 249
  • 2
  • 12
10
votes
1 answer

Get all source files a target depends on in CMake

With CMake, how can I get a list of all the source files which go into an executable target, including all sources in all targets this executable depends on? We have a pattern in the code base where initializer callers are generated by the build…
Petter Kvalvaag
  • 323
  • 2
  • 11
10
votes
2 answers

Build external library only once with CMake

My C++ projects includes the source code of a third-party library (currently as a git submodule). This library is added to the project by our main CMakelists through the use of add_subdirectory, and then the library is linked with the main…
Louen
  • 3,617
  • 1
  • 29
  • 49
1 2 3
99
100