Questions tagged [cmake]

Questions about CMake, an open-source cross-platform "meta-make" where you can describe your software project's build, test and deployment process in an abstract way using configuration files. From those configurations it can generate build environments for all sorts of compilers and IDEs on all major operating systems.

Filter by
Sorted by
Tagged with
0
votes
0answers
11 views

Can I mix static and dynamic libraries? [migrated]

I want to build a library which requires several other libraries, that I also need to build. Does it make a difference if I build some of them as static libraries and some of them as dynamic libraries,...
5
votes
1answer
310 views

What is the right way to create a build system?

I'm a student, and I don't have much expirience with the building process. In the last few days i've read something about CMake and others build system generators, but other than that I don't know ...
1
vote
1answer
44 views

code for a try_run() invocation - where do I place it?

I'm working on a CMake module which, at some point, invokes try_run(). The file I'm compiling is not really part of the project's sources - it's not used anywhere. It's only ever useful for CMake, to ...
18
votes
6answers
2k views

Why should makefiles have an “install” target?

Coming from the world of C and C++, most build system have an install target, notably Makefiles (where it is recommended by GNU for example) or CMake. This target copies the runtime files (executables,...
1
vote
1answer
78 views

Managing a third party library that is used by multiple independent libraries

I am working on configuring the build environment for a C++ project that uses multiple libraries. These libraries are independent of each other, but they all depend on the same 3rd party library (...
4
votes
1answer
127 views

Which should I prefer: A subrepository/submodule, or a CMake ExternalProject?

I'm developing or maintaining a free software project Foo which uses CMake for a build system, as well as source control (e.g. Mercurial or Git), with the repository being available online. Now, this ...
-1
votes
1answer
200 views

Multi module project version management

I have a CMake multi module project made of a library and an executable. Both the root project and each sub module has its own version (major.minor.patch). I would like to know how to handle each ...
1
vote
1answer
815 views

How to control optional dependencies of a header-only library in `CMake`?

I am developing my own header-only library that I want to use as a framework in other software. I am using CMake for setting up demo targets, tests, and so on. However, I am unsure how to deal with ...
8
votes
1answer
3k views

In-Source Build vs. Out-Of-Source Build

In my (primarily C++) development, I have long adhered to using out-of-source builds. That is, my source usually sits in a /project/src directory and the builds live in a /project/build/bin/release, /...
0
votes
1answer
133 views

How to avoid explicit naming of source files in unit tests

I'm using CMake to build my application and CUnit to test it. And I was wondering if there is a way to avoid including the production source files directly from the test code by name (#include ../src/...
1
vote
0answers
119 views

How to separate source code directories from build directories with VS Xamarin solutions

I've been using CMake for years when developing in C++ using Visual Studio. My directory layout has always seen me separate source code directories from build directories. For those who are not ...
0
votes
2answers
237 views

How to deliver binaries and source to customers and developers, if both are the same?

I'm currently working on a project where i am the only developer, but it should be delivered soon to "customers". Since this is actually an application consisting of multiple libraries for physicists ...
1
vote
1answer
153 views

How do I use CMake to build my codebase for different purposes and resolutions?

I'm working on a C++ codebase targeted at multiple platforms, and we've just moved over to CMake as our buildsystem. Previously our buildsystem was a pretty ad-hoc affair; getting our code under a ...
0
votes
1answer
63 views

Sharing Project configuration files for an application with Qt IDE using Cmake and sharing via Git?

Imagine that you are starting to work in a project with a group of people. You want to share your code and the full configuration files of CMake, Qt IDE configuration. So you if you want to test or ...
2
votes
1answer
650 views

How to frame the concept behind CMake?

I'm using CMake for several years now and found that - in the cases where I'm struggling with CMake - I'm still not completely sure about the concept behind CMake (not taking into account CTest, CPack ...
3
votes
1answer
718 views

How to deal with relative paths in out of source build?

An out of source build is a build which can be in any directory other than the source directory I have a project which contains relative paths to some resource files, needed at runtime, which are ...
12
votes
1answer
14k views

Directory organization of a CMake (C++) repository containing several projects

I would like some advises on the organization of a set of related but independent C++ projects stored in a single (git) repository. The projects use CMake. For a simplified example we imagine 2 ...
6
votes
2answers
1k views

How to setup build system for unit testing + mocking?

We have a legacy code base in entirely C++. Our build system is CMake. My first stab at unit testing was as follows: Define a target (LibraryA). This library contains the code to test. Define a unit ...
2
votes
2answers
457 views

What uses are there today for manually writing Makefiles? [closed]

I remember the general gist of writing Makefiles, but, due to CMake, autotools and other such Makefile generators, I've forgotten so many details that, if you were to ask me to write a makefile from ...
28
votes
8answers
10k views

Is directly using Make considered obsolete? [closed]

So I have been coming across many comments/posts/etc regarding creating makefiles directly, and how it is a silly thing to do in 2015. I am aware of tools such as CMake, and I actually use CMake quite ...
4
votes
3answers
496 views

Purpose of building file using Make

I am trying to understand what is the purpose of making files using commands such as cmake .. and make, I have tried looking online but there is no concise explanation on its purpose that i could find....
3
votes
1answer
5k views

Generating CMakeLists.txt [closed]

I got a bunch of C++ sources files and headers. They may use external libraries such as Boost e.g. I am interested in the process of building binaries for Windows and *nix. Makefiles (*nix) and ....
15
votes
4answers
3k views

Does it make sense to write build scripts in C++?

I'm using CMake to generate my projects IDE/makefiles, but I still need to call custom "scripts" to manipulate my compiled files or even generate code. In previous projects I've been using Python and ...
49
votes
5answers
10k views

Organizing Git repositories with common nested sub-modules

I'm a big fan of Git sub-modules. I like to be able to track a dependency along with its version, so that you can roll-back to a previous version of your project and have the corresponding version of ...
9
votes
2answers
3k views

Build automation: Is it usual to use QMake for non-Qt projects?

So, I'm planning to write a C++ library and I want it to be cross-platform, and as this library won't deal with UI and I want it to have as little dependencies as possible, I won't be using Qt (...