On 01/27/2012 06:41 PM, Schuchard, Matthew wrote: > Contrary to the CMake FAQ, but consistent with what I have been reading > elsewhere, it does not seem possible for me with CMake 2.8.6 to add a > generated file as a dependency to a target, even in the same directory. > > I have done something similar to the following: > > add_custom_command(OUTPUT foo.ext) > add_executable(foo foo2.ext) > add_custom_target(foo_custom DEPENDS foo.ext) > set_source_files_properties(foo.ext PROPERTIES GENERATED TRUE) > add_dependencies(foo foo_custom) > > The above will not cause a dependency of foo on foo.ext, and when attempting > to run make, throws an error of: > No rule to make target 'CMakeFiles/foo_custom.dir/requires' > > Could anyone please shine some light on this? > What I have been reading elsewhere (CMake mailing list, stackoverflow, etc.) > is that the majority of the time, attempting something similar to the above > does not succeed. > Could this fix be included among 2.8.8 updates?
Is foo2.txt in ADD_EXECUTABLE() a typo? Could you provide a minimal but complete example which exposes your issue for detailed investigation? The DEPENDS clause of custom targets/commands should always be used with *full* paths, even if the concerned files are generated in the same CMakeLists.txt, since the behavior w.r.t. relative paths isn't specified. So, you might retry with DEPENDS ${CMAKE_CURRENT_BINARY_ DIR}/foo.ext. Besides, the GENERATED property doesn't need to be set on files generated by ADD_CUSTOM_COMMAND(OUTPUT ...) as this is done automatically. Regards, Michael -- 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