[CMake] add_dependencies behaviuor

Andrea Galeazzi Galeazzi at korg.it
Wed May 18 05:27:27 EDT 2011

I've multiple executable targets depending on a custom target that 
invokes another executable target:
add_executable(MyTool  ${MyTool_SOURCES})
add_custom_target(PreBuildCommands ALL COMMAND "java" "-jar"
                                        COMMAND MyTool DEPENDS 
                                        COMMENT "Changing the build number")

add_dependencies(${TARGET_NAME1} MyTool PreBuildCommands)

add_dependencies(${TARGET_NAME2} MyTool PreBuildCommands)

I'd like, or better I need, that when the building of MyTool fails the 
other dependent targets won't build or fails their build too.
How could I achieve that?


More information about the CMake mailing list