Below.
On Mar 28, 2009, at 12:21 PM, Tyler Roscoe <[email protected]> wrote:
On Sat, Mar 28, 2009 at 12:16:21AM -0600, James Bigler wrote:
I have an add_custom_command in a subdirectory, and I'm trying to use
that output as a dependency in a parent directory.
Unfortunately, the parent directory doesn't see that I made a rule
(add_custom_command) for the file in the subdirectory.
top level CMakeLists.txt:
...
add_subdirectory(sub1)
add_custom_target(generate ALL
DEPENDS ${CMAKE_BINARY_DIR}/myfile.txt
)
sub1/CMakeLists.txt:
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/myfile.txt
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/
genmyfile.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
I would just do the add_custom_target in the same CMakeLists where you
do the add_custom_command. That target will still be available from
your
top-level CMakeLists. I use this approach all over the place.
tyler
Unfortunately, I have several directories that all pool their files
into the same target. I don't want to have a single target per file as
this would clutter up Visial Studio projects quite quickly.
Unless there's a different way to make the add_custom_command behave
globally I'll have to somehow call this function only from the
directory I call add_custom_target from. :(
Thanks,
James
_______________________________________________
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