On 04/05/2011 12:22 PM, Clinton Stimpson wrote:
> 
> I'm looking at bug #11884
> http://public.kitware.com/Bug/view.php?id=11884
> 
> And I've noticed there is a problem with depending on generated headers 
> across 
> directories but not within the same directory.
> 
> For example:
> 
> # section A
> add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/out.h  COMMAND ....)
> add_executable(... ${CMAKE_BINARY_DIR}/out.h ...)
> 
> # section B
> add_custom_command(OUTPUT out2.h COMMAND .. DEPENDS ${CMAKE_BINARY_DIR}/out.h)
> add_executable(... out2.h ...)
> 
> 
> If section A and B are in the same CMakeLists.txt, then there is no problem.
> 
> If they are in sibling directories, then building section B first will lead 
> to 
> an error about out.h missing.  A workaround involves the user of 
> add_dependencies() and/or a custom target.
> 
> Is this a bug in CMake?  It seems there is enough information given that 
> CMake 
> could notice the dependency.  But maybe it can't quite do it because its a 
> separate directory?  Maybe cmake can do the add_dependencies() automatically?

This is expected.  You need to do add_dependencies or use a separate custom
target and then make both targets depend on that.  CMake cannot just magically
introduce an extra custom target or arbitrary dependency between existing
targets.

-Brad
_______________________________________________
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

Reply via email to