[CMake] bash-script-like project
Andrea Crotti
andrea.crotti.0 at gmail.com
Fri Oct 28 10:20:20 EDT 2011
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?
More information about the CMake
mailing list