[CMake] Automatic out of source build's possible?

Martin O'Brien martin.matthew.obrien at gmail.com
Tue Feb 8 03:27:51 EST 2011


Absolutely, and that is what I do in some cases, but in the particular case
that I described - which is what I had in mind; I should have been clearer -
it doesn't help, as it's still -D... syntax.


mm

-----Original Message-----
From: Eric Noulard [mailto:eric.noulard at gmail.com] 
Sent: Tuesday, February 08, 2011 3:26 AM
To: Martin O'Brien
Cc: cmake at cmake.org
Subject: Re: [CMake] Automatic out of source build's possible?

2011/2/8 Martin O'Brien <martin.matthew.obrien at gmail.com>:
> While I too find myself sometimes wanting convenience scripts - some 
> people find the use of '-DENABLE_<whatever>=ON' instead of
--enable-<whatever>'
> foreign, for example - the problem with them, IMO, is that they're 
> impossible to make crossplatform without requiring the presence of 
> some tool
> - perl, python, bash, whatever - on each system in a location that can 
> be located pre-configure, which is exactly what using cmake gets you out
of.

You can use CMake instead of perl, python etc...
you write your CMake script  and then propose to the user to run, something
like:

cmake -P easyBuild.cmake

Many [portable] CMake commands are usable for that, mainly file( ...),
execute_process, string, message.

As an example I did propose in the past a CMake script which can be used to
build a new CMake version (provided you already have one installed) with the
following single line:

cmake -P CMake-autobuild.cmake

You can write a similar cross-platform script(s) for your users.
It doesn't give you the possibility to use --enable but it's easy to use for
your user and is definitely cross-platform.

If some options have to be chosen by the users they can either edit the
script or you may launch cmake-gui / ccmake at the end of the script in
order to give a chance to the user to select  the choices.

--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org



More information about the CMake mailing list