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.

Is there any way to make this work?

I've attached a simple build system to test this, but included the
salient parts below.

Thanks,
James

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}
  )

Attachment: subdir_generated.tar.gz
Description: GNU Zip compressed data

_______________________________________________
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