[CMake] Source package without CMake dependency?

Eric Noulard eric.noulard at gmail.com
Mon Feb 4 01:33:22 EST 2013


2013/2/4 Martin Sustrik <sustrik at 250bpm.com>:
> Hi all,
>
> Is it possible to create a source package that wouldn't require to install
> cmake on the destination machine?

Short answer NO.
Long answer : keep reading.

> With autotools, all the build scripts are generated when building the
> package and included into the package. So, on the destination box you can do
> the following:
>
>     tar -xzf mypackage.tar.gz
>     cd mypackage
>     make
>     sudo make install

I doubt you can do that [and make it work all the time] with autoscripts.
Usually you have to:

   tar -xzf mypackage.tar.gz
   cd mypackage
   ./configure
   make
   sudo make install

Then not only you depend on "make" but also on a "shell" for the configure part
(plus the set of tools ./configure may be discovering).
The "no dependency" myth of autotools comes from the fact one assume
one have those 2 tools (shell and script) preinstalled everywhere.
Most of the time this is wrong on the windows platform, may be wrong on
some other platform too.

> There's no need to install autotools itself. Is something similar possible
> with CMake/CPack? Will simply creating the build directory inside of the
> source tree help?

Nope.

CMake is a requirement just as 'shell' and 'make' are for autotools.
CMake is calling itself for dependency computing
CMake sometimes really needs absolute path so that you can not
export a build tree (see cmake --help-variable CMAKE_USE_RELATIVE_PATHS)
....

CMake notion of "no dependency" can be summarized as
"CMake only requires CMake"

If you dig into the mailing list archive you may found more extensive arguments
explaining why requiring to generate "CMake independent build system" may
not be "easy as it seems" and "a reasonable goal anyway".

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list