Mailinglist Archive: yast-devel (122 mails)

< Previous Next >
[yast-devel] make_wrapper for CMake vs. Autotools Projects
  • From: Stefan Hundhammer <sh@xxxxxxx>
  • Date: Wed, 12 Dec 2007 18:18:10 +0100
  • Message-id: <>

(or: svn up devtools)

This is a script you can use to make life more convenient when working with
both CMake and autotools based projects:

CMake is intended for building out of the source tree. Autotools (and
pure "make") build in the same tree where the source files are. If you have
both kinds of projects, you always have to keep in mind where to "cd" to (or
to what shell window to go) to invoke "make". And for CMake
out-of-source-tree building it's really hard to invoke "make" directly from
the editor of your choice so it can immediately load the source file where
the compiler reported an error and fix it.

Coolo suggested to use the "makeobj" script from the KDE 4 SDK, but not only
does this require the user to set environment variables where the build tree
is, it also does not seem to work well in mixed CMake / Autotools

So I wrote this "make_wrapper" script that checks the current directory for a
file "Makefile" and call "make" there directly if there is one. If there is
none, it checks ../build/Makefile, then ../../build/Makefile etc.

All you have to do is stick to that convention to name the CMake
out-of-source-tree build directory "build" (configurable in the script of
course) and simply call "make_wrapper" rather than "make". The toplevel
Makefile.cvs in libzypp and yast2-qt4 support that anyway: They create
a "build" directory and invoke "cmake" there.

Emacs users might want to set their "compile-command" variable in ~/.emacs :

(setq compile-command "make_wrapper -k && sudo make_wrapper install")

or, when using "icecream" distributed compilation:

(setq compile-command "make_wrapper -k -j20 && sudo make_wrapper install")

Stefan Hundhammer <sh@xxxxxxx> Penguin by conviction.
YaST2 Development
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
Nürnberg, Germany
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups