[CMake] ADD_DEPENDENCIES Q...

Lars Pechan lars.pechan at parkerpechan.com
Fri Oct 29 21:52:20 EDT 2004


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



More information about the CMake mailing list