Skip to main content

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
2 votes
3 answers
173 views

How to decouple spagheti code for unit tests [duplicate]

A little background on the project: we as a company receive a spaghetti source code, and into that we add even more spaghetti code. So with that I want to say that complete restructuring and ...
Tomáš Viks Pilný's user avatar
10 votes
4 answers
4k views

Is there something between Debug and Release build?

Specifically with CMake builds, if you don't specify a build type explicitly, the build will use neither Debug nor Release compilation flags. I was writing my own Makefile for a simple program and ...
Reverent Lapwing's user avatar
1 vote
1 answer
141 views

App that can be deployed both as monolith and microservices?

We have a monolith C++ application and I consider doing some major refactorings. Since we're not completely ready to go full "microservices only" (maybe in about two years time), I want to ...
glades's user avatar
  • 419
1 vote
1 answer
68 views

CMake Reusability and Package Management

My question is focused on CMake C++ projects and separating out code into multiple repositories for re-usability, and somewhat mimicking a naive package management system. For now I would like to ...
nick2225's user avatar
  • 157
1 vote
0 answers
189 views

Are absolute paths in C++ libraries okay to have if they are *generated* at configuration time from non absolute paths?

I've recently created a library that needs a non-text (but platform agnostic) resource to be used. I basically tell CMake, if this is an install interface, it's in the "${...
Krupip's user avatar
  • 1,300
-1 votes
1 answer
158 views

development environment for C++ GUI applications

I am currently developing some C++ GUI application using wxWidgets (although the GUI framework doesn't really matter here) and thus far have been developing this on my own, which was working well. ...
tom's user avatar
  • 129
0 votes
1 answer
423 views

Global vs local CMake functions for compiler flags

In the online book "Introduction to Modern CMake", I found the following recommendation: Do not use global functions: This includes link_directories, include_libraries, and similar. Yet the ...
Vorac's user avatar
  • 7,129
10 votes
2 answers
2k views

Should Visual Studio specific files be excluded from version control?

I work on a number of code projects, some open source and some not. Many of these projects are intended to be cross-platform, most often running on either Linux (my natural habitat) or Windows and ...
Edward's user avatar
  • 214
2 votes
0 answers
245 views

How to "orchestrate" a multi-repository installation

Suppose I'm working on software to be installed on a Linux machine (not mine). Say the software consists of applications the user might start independently; an application which will likely be started ...
einpoklum's user avatar
  • 2,566
-2 votes
1 answer
127 views

In C++, does it make sens to have library project be composed of other libraries?

I'm working on a C++ project which is currently divided into "sub modules" / "components". Each of these are compiled into a separate library (components are usually 10-20 files). The libraries are ...
Antiro42's user avatar
3 votes
0 answers
277 views

C++ dependency management across projects

We are developing a benchmarking framework in C++, with Make and CMake as build tools. The aim of the framework is to allow others who build algorithms to perform head-to-head comparison against prior ...
Mihai Bujanca's user avatar
5 votes
1 answer
758 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 ...
Giorgio Buttiglieri's user avatar
1 vote
1 answer
71 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 ...
einpoklum's user avatar
  • 2,566
19 votes
6 answers
4k 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,...
Synxis's user avatar
  • 307
1 vote
1 answer
900 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 (...
tjwrona's user avatar
  • 249
7 votes
2 answers
3k 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 ...
einpoklum's user avatar
  • 2,566
-1 votes
1 answer
469 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 ...
Marco Stramezzi's user avatar
1 vote
1 answer
2k 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 ...
Gnosophilon's user avatar
19 votes
1 answer
10k 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, /...
DiB's user avatar
  • 487
0 votes
1 answer
184 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/...
Ezechiel's user avatar
1 vote
0 answers
170 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 ...
Ash's user avatar
  • 219
0 votes
2 answers
662 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 ...
Anedar's user avatar
  • 101
1 vote
1 answer
497 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 ...
Standback's user avatar
  • 1,320
1 vote
1 answer
109 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 ...
Rama's user avatar
  • 121
3 votes
1 answer
1k 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 ...
Florian's user avatar
  • 133
3 votes
1 answer
2k 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 ...
user695652's user avatar
16 votes
1 answer
22k 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 ...
Barth's user avatar
  • 471
6 votes
2 answers
2k 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 ...
void.pointer's user avatar
  • 5,083
3 votes
2 answers
693 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 ...
Greg Kramida's user avatar
46 votes
8 answers
23k 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 ...
JParrilla's user avatar
  • 681
4 votes
3 answers
579 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....
foo's user avatar
  • 43
3 votes
1 answer
6k 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 ....
vanna's user avatar
  • 337
15 votes
4 answers
5k 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 ...
Klaim's user avatar
  • 14.9k
53 votes
5 answers
15k 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 ...
André Caron's user avatar
9 votes
2 answers
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 (...
Raphael's user avatar
  • 2,234