[CMake] Help with dependency on custom command output

James Amundson amundson at fnal.gov
Thu Aug 5 11:30:09 EDT 2010


  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


More information about the CMake mailing list