Going back to the original question, I realised that my approach could not work.

In short the list of targets and commands that I need to generate depend on a file,
which is generated from a python script.

So I thought I could use execute_process before the foreach:

execute_process(
  OUTPUT_FILE ${INSTALLED_EGGS_LIST}
COMMAND "${PYTHON_EXECUTABLE} ${GEN_DEPENDENCY_SCRIPT} ${BUILD_APP_OPTIONS}"
  )

foreach (egg ${INSTALLED_EGGS_LIST})
  set(egg_install ${egg}_install)
  set(egg_unzip ${egg}_unzip)
  add_custom_target(${egg_install})
  add_custom_target(${egg_unzip})

  add_custom_command(
    TARGET ${egg_install}
COMMAND ${PYTHON_EXECUTABLE} ${egg} setup.py bdist_egg -d ${DESTINATION}
    WORKING_DIRECTORY ${egg}
    )

  add_custom_target(
    TARGET ${egg_unzip}
    COMMAND ${PYTHON_EXECUTABLE}
    )
endforeach ()


But now *why* the process is actually not executed every time I run "cmake", as I was expecting?
--

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