[SDL] Problem to build and link SDL 2 with project using CMake

Scott Percival moralrecordings at gmail.com
Sat Mar 2 16:08:25 PST 2013

You're sounding a little confused. CMake is more a replacement for GNU
Autotools (automake, autoconf, libtool etc.); it takes a script
(CMakeLists.txt) with the dependencies and targets, and spits out makefiles
which are interpreted by the build tool (e.g. GNU make).

There's quite a few differences; the main one is that scripts for Autotools
need to be written in M4, a macro language from the late 70s which only
still exists because Autotools uses it. M4 itself is about as intelligent
as a lump hammer, and almost as fun as being smacked in the testicles with.
It's best described as shorthand for copy-pasting snippets together to form
something indecipherable to humans, which you'll later have to debug while

While CMake isn't perfect by any means, it's a hell of a lot more sane than
Autotools. It has a very nice bundled library of scripts and dependency
lookup routines, or can fall back to pulling info from pkg-config.
Configuring is tremendously faster than autotools, as it cuts out nearly
all of the pointless "checking that 1+1 == 2" compilation tests at the
start, and does an okay job at caching. It can generate makefiles for tools
other than GNU make. If there's an error in the script, you have a fighting
chance of figuring it out.

Hell it even -looks- nicer; when you run make it gives you a nice coloured
progress readout for each file, instead of the wall of text sent as
arguments to g++. Very useful for separating out compile warnings.

SDL's CMake scripts are pretty good, the only downside is that they've only
been around for 3 months and still need some TLC. Have a look inside the
configure script one day and say with a straight face that it looks nicer
than the equivalent CMakeLists.txt.

On 2 March 2013 16:31, neoaggelos <neoaggelos at yahoo.gr> wrote:

> **
> Well, cmake might be a little better, but I haven't seen much of a
> difference.
> Also, make works great, and it's the standard.
> But, if you want to build just one file, then sdl2-config is your friend [image:
> Wink]
> ------------------------------
> C is the God's Programming Language
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130303/1d4a0e54/attachment-0009.htm>

More information about the SDL mailing list