[CMake] how to port to cmake a project using gnulib

Alan W. Irwin irwin at beluga.phys.uvic.ca
Tue Jan 9 08:47:46 EST 2018


On 2018-01-09 12:01-0000 Cosimo Lupo wrote:

> Hello,
>
> I'm new to Cmake.
>
> I would like to port to cmake a project that is currently built with the
> Autotools and depends on gnulib, the GNU Portability Library:
> https://www.gnu.org/software/gnulib/
>
> (The project in question is https://www.freetype.org/ttfautohint/)
>
> It appears that gnulib itself is very much tied with
> autoconf/automake/libtool.
>
> In fact I couldn't find any examples of other CMake based projects that use
> gnulib.
>
> Does anyone has any tips or examples on how I could proceed?

Hi Cosimo:

I have looked at the subsequent list traffic responding to your
question above, and there
appeared to be a clear need for a description of what gnulib really
is.  That is provided by <https://www.gnu.org/software/gnulib/> which
states that gnulib is the GNU Portability Library that is apparently
designed to aid portability of software to different operating systems.
That description of gnulib further
states (in part):

"Gnulib [...] components are intended to be
shared at the source level, rather than being a library that gets
built, installed, and linked against. Thus, there is no distribution
tarball; the idea is to copy files from Gnulib into your own source
tree."

However, I think because gnulib is all about aiding portability and
CMake already is designed to do that task, you likely won't need
gnulib at all once you implement a CMake-based build system for your
own software.  I base that opinion on the general complete lack of
knowledge (including me before I got curious and read the above
description of gnulib) concerning gnulib here.  However, if it turns
out there is still some small useful component of gnulib C source code
that would be useful for your own project, it is an absolutely simple
matter under CMake to build a mixture of library source code from your
project's source directories and some subset of the source code from
the gnulib source directories.

So my best advice is don't be concerned about gnulib executables or
autotools-related cruft at all.  That is, don't be concerned in the
slightest about gnulib unless there is some specific place in your
source code that calls one of the gnulib routines.  And take care
of that case with CMake as indicated above.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list