Back to overview

cmake

I hate cmake. I hate a lot of things, though and some of them are still useful. I found myself having to use cmake so I am now trying to figure out how to create a decent cmake project. I have managed to create a working cmake project but there are still several aspects that I do not understand.

From what I can tell the project is kind of terrible. To just give two examples:

Function names are part of the arguments. Seriously, the functions for working on lists are called list("APPEND", ..., list("LENGTH", ..., and so on. See here.

It comes with a package registry which is supposed to tell projects where to find your library. But - probably because this is a solved problem - there is apparently no way to add things to that registry and it only exists on Windows. The only real use is for finding libraries in their build tree when they are not installed. See here.

cmake is also changing a lot so there are a lot of bad examples of cmake configurations out there. According to some people I spoke to this includes the official tutorial. The docu in general isn't great either.

Useful links:

  1. https://github.com/forexample/package-example
  2. https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/

Possibly useful links:

  1. https://foonathan.net/blog/2016/03/03/cmake-install.html
  2. https://www.youtube.com/watch?v=rLopVhns4Zs&feature=youtu.be
  3. https://rix0r.nl/blog/2015/08/13/cmake-guide/
  4. https://www.johnlamp.net/cmake-tutorial-1-getting-started.html
  5. https://github.com/pyk/cmake-tutorial