[CMake] more targets to run in parallel

Andrea Crotti andrea.crotti.0 at gmail.com
Tue Feb 21 08:35:15 EST 2012


Anyway just to answer myself, I managed to solve all my problems.
Now I first generate at cmake file a file with some paths, and from
these paths I generate all the targets that I need.

I also create a list with all the targets to make it easy from other 
targets to depend on them.

Here below the simplified code (if there are better ways I'm all hears)


foreach (egg ${egg_list})
   get_filename(${egg})
   set(egg_install ${RESULT_VAR}_install)
   add_custom_target(${egg_install})
   # generate the list of targets to create more easily dependencies
   list(APPEND target_install_list ${egg_install})

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

endforeach ()

add_custom_target(install_all_eggs ALL
   DEPENDS ${target_install_list}
   )



More information about the CMake mailing list