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

Eric Noulard eric.noulard at gmail.com
Tue Feb 8 03:26:24 EST 2011


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMake-autobuild.cmake
Type: application/octet-stream
Size: 3911 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110208/0f018b7e/attachment.obj>


More information about the CMake mailing list