[CMake] failing target

Andrea Crotti andrea.crotti.0 at gmail.com
Tue Mar 6 09:07:15 EST 2012


On 03/06/2012 02:01 PM, Michael Hertling wrote:
> Yes, the DEPENDS clause of ADD_CUSTOM_TARGET() is only for *file*
> dependencies, but you use it for *target* dependencies. According
> to the documentation of ADD_CUSTOM_TARGET():
>
> "Dependencies listed with the DEPENDS argument may reference files
> and outputs of custom commands created with add_custom_command()
> in the same directory (CMakeLists.txt file)."
>
> "Use ADD_DEPENDENCIES to add dependencies to or from other targets."
>
> Regards,
>
> Michael
> --
>


I opened a thread some time ago about this, and I actually thought it
was a bug in the documentation, because then why everything works otherwise?

This simple example which I produced

add_custom_target(a
   ${CMAKE_COMMAND} -E echo "a"
   )

add_custom_target(b
   ${CMAKE_COMMAND} -E echo "b"
   DEPENDS a
   )


does exactly what would be expected, even if there files a or b don't exist.
So I might suppose that this intra-target dependencies work but not always,
is that correct?


More information about the CMake mailing list