[CMake] bash-script-like project

Eric Noulard eric.noulard at gmail.com
Sun Oct 30 17:29:51 EDT 2011


2011/10/30 Andrea Crotti <andrea.crotti.0 at gmail.com>:
> I rephrase a bit the question which was probably too long :)
> So suppose that I just need to do the following things (but in a portable
> way with CMake).
>
> cd org-mode && make
> cd tramp && autoreconf -fi && ./configure && make
> cd doxymacs && autoreconf -fi && ./configure && make

I'm not sure to understand why you want to do that with CMake
but executing any command in a particular working dir may be done
with

execute_process,

checking the RESULT_VARIABLE value may give you a mean to
emulate "&&" by checking the value before going on.
But I guess from re-reading your first message that you did already
know the command.

now again ....

autoreconf -fi
./configure

seems to be autoconf entity, so since autoconf
requires a shell, why would you write a CMake script ?

> where some of the commands are repeating...

then use CMake foreach or while command.

> what could be a way to do this with CMake?

If the objective is to run the previous sequence of command as a CMake target
then create a CMake (or shell scripts) and call the script in

add_custom_target.

in a CMake scripts the variable
CMAKE_COMMAND contains the path to CMake executable.
CMAKE_BUILD_TOOL contains the build tool to use (may be 'make' in your case)

may be those would be useful for a 'portable' CMake script.
-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list