[CMake] Help with dependency on custom command output

David Cole david.cole at kitware.com
Thu Aug 5 11:42:16 EDT 2010


Shouldn't that be this?

add_custom_command(OUTPUT test_diagnostics_get_mean.icc
   COMMAND python test_diagnostics_crosscheck.py
   DEPENDS test_diagnostics_crosscheck.py)
add_executable(test_diagnostics test_diagnostics.cc
test_diagnostics_get_mean.icc)

FYI, add_dependencies is only used to establish target-to-target
dependencies (ordering), not file level dependencies...
http://cmake.org/cmake/help/cmake-2-8-docs.html#command:add_dependencies


HTH,
David


On Thu, Aug 5, 2010 at 11:30 AM, James Amundson <amundson at fnal.gov> wrote:

>  I cannot get the following simple build process to work. I must be missing
> something.
>
> I build a (test) executable test_diagnostics, which depends on a source
> file test_diagnostics.cc and a generated file test_diagnostics_get_mean.icc.
> I generate the latter with
>    python test_diagnostics_crosscheck.py
>
> I thought the following would work:
>
> add_custom_command(OUTPUT test_diagnostics_get_mean.icc
>    COMMAND python test_diagnostics_crosscheck.py
>    DEPENDS test_diagnostics_crosscheck.py)
> add_executable(test_diagnostics test_diagnostics.cc)
> add_dependencies(test_diagnostics test_diagnostics_get_mean.icc)
>
> However
>
> make test_diagnostics
>
> fails because test_diagnostics_get_mean.icc is not found. I have to invoke
>
> make test_diagnostics_get_mean.icc
>
> manually in order to get it to work. What am I missing?
>
> Thanks,
> Jim Amundson
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100805/b40f5225/attachment-0001.htm>


More information about the CMake mailing list