Re: [CMake] bash-script-like project

2011-10-30 Thread Andrea Crotti

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
...

where some of the commands are repeating... what could be a way
to do this with CMake?
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] bash-script-like project

2011-10-30 Thread Eric Noulard
2011/10/30 Andrea Crotti andrea.crott...@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
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] bash-script-like project

2011-10-28 Thread Andrea Crotti
I'm experiment a bit with CMake and now I would like to automate the 
configuration of my Emacs configuration.


In my configuration I have many git submodules and some of them need to 
be actually compiled.


So I just need to do a foreach loop and run for each of them the right 
command, very simple.


So first I did a very fancy thing with functions and macro

macro (execute_in_subdir subdir command)
  execute_process(
COMMAND ${command}
WORKING_DIRECTORY ${subdir}
)
endmacro ()

function (to_master_branch subdir)
  # do I ever need execute_process?
  execute_in_subdir(${subdir} git checkout master)
endfunction()

set(simple_make make)
#TODO: add the setting for the Emacs output
set(autoconf autoreconf -fi  ./configure  make)

function (org_compile)
  execute_in_subdir(org_mode ${simple_make})
endfunction()

#TODO: we need to have all these tools
function (doxymacs)
  execute_in_subdir(doxymacs ${autoconf})
endfunction()

function (tramp)
  execute_in_subdir(tramp ${autoconf})
endfunction()

But then I actually wanted a target, and I can't find a way to call 
functions

from the custom_target.
Then I found out that something like this also works and is much simpler:

add_custom_target(
  org-mode ALL
  cd org-mode  make
)

But what's the best way to do something like this?
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake