[CMake] add_dependencies behaviuor

Tyler tyler at cryptio.net
Wed May 18 11:12:35 EDT 2011


This looks reasonably correct to me (although PreBuildCommands has no
explicit dependency on the MyTool target; I'm not sure if the fact
that you're calling MyTool as part of your custom target will cause
CMake to create an implicit dependency from PreBuildCommands to
MyTool).

What is the problem that you're seeing? Can you show us some output
from a build that demonstrates this problem?

The next step is to create a minimum case that reproduces the problem
you're seeing.

tyler

On Wed, May 18, 2011 at 2:27 AM, Andrea Galeazzi <Galeazzi at korg.it> wrote:
> 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"
>                                       "../BuildNumberUpdater.jar"
>                                       ${GENERATED_SOURCES}
>                                                          COMMAND MyTool
> DEPENDS ${SOURCES} ${LIB_TO_LINK}
>                                       COMMENT "Changing the build number")
>
> add_executable(${TARGET_NAME1} ${SOURCES} ${GENERATED_SOURCES})
> add_dependencies(${TARGET_NAME1} MyTool PreBuildCommands)
>
> add_executable(${TARGET_NAME2} ${SOURCES} ${GENERATED_SOURCES})
> 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?
>
>
> _______________________________________________
> 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
>


More information about the CMake mailing list