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

Reply via email to