[CMake] ADD_DEPENDENCIES: "non-existent target"??

Matthew Woehlke mw_triad at users.sourceforge.net
Mon Mar 19 15:28:46 EST 2007


I have a project with some Doxygen doc that has examples. I want to add 
a non-default target to build the examples. I tried this:

src/CMakeLists.txt:
ADD_CUSTOM_TARGET(examples)

src/examples/CMakeLists.txt:
MACRO(ADD_EXAMPLE name)
     ADD_EXECUTABLE(${name} EXCLUDE_FROM_ALL ${name}.c)
     TARGET_LINK_LIBRARIES(${name} mylib)
     ADD_TEST(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name})
     ADD_DEPENDENCIES(examples ${name})
ENDMACRO(ADD_EXAMPLE)
ADD_EXAMPLE(foo)


...but I always get this error:
src/examples/CMakeLists.txt:5:
ADD_DEPENDENCIES Adding dependency to non-existent target: examples


What am I doing wrong?

-- 
Matthew
You are in a dark room. The only exit is a door to the east.
 > OPEN DOOR
I don't know which door you mean.
 > OPEN EAST DOOR
It's locked.



More information about the CMake mailing list