[CMake] ADD_DEPENDENCIES Q...

William A. Hoffman billlist at nycap.rr.com
Fri Oct 29 22:55:36 EDT 2004


See ADD_CUSTOM_COMMAND and ADD_DEPENDENCIES here:

http://www.cmake.org/HTML/Documentation.html

Basically, ADD_DEPENDENCIES is only used to set depend information
between two targets.   A custom command that is not tied to a target
will not actually do anything.   The way to tie it to a target is to
have a target that depends on the output of the command.

You may also want to look here:

http://public.kitware.com/Wiki/CMake_FAQ#How_do_I_use_CMake_to_build_LaTeX_documents.3F

If you create a custom target that depends on the output of the custom
command it will work.

-Bill


At 09:52 PM 10/29/2004, Lars Pechan wrote:
>Hi there,
>Can someone please tell me why this doesn't work?
>
>PROJECT(test)
>SET(EXE /tmp)
>
># Create the docs:
>ADD_CUSTOM_COMMAND(
>  OUTPUT ${EXE}/test.doc
>  COMMAND echo
>  ARGS "blablabla" > ${EXE}/test.doc
>)
>
>ADD_EXECUTABLE(test test.cpp)
>ADD_DEPENDENCIES(test ${EXE}/test.doc)
>
>In the generated makefile there is a  target generated for /tmp/test.doc but the dependency isn't there. So a make doesn't generate the doc-file but a 'make /tmp/test.doc' works fine.
>
>I've tried this under CMake 2.0.5 on both Windows and MacOSX as well as 2.0.3 on Linux. I'm assuming I've misunderstood what cmake is supposed to do here?
>
>(And yes, two possible workarounds are SET_SOURCE_FILES_PROPERTIES with OBJECT_DEPENDS or a custom command with POST_BUILD but I'd really like to understand why ADD_DEPENDENCIES doesn't do it?)
>
>/Lars
>
>_______________________________________________
>CMake mailing list
>CMake at www.cmake.org
>http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list