dev-cafe/cmake-cookbook

Missing deps for generated file in chapter-06/recipe-02

Closed this issue · 2 comments

The chapter-06 recipe 02 uses execute_process to execute a python script for generating a C-file.
This cannot generate an automatic dependency which would regenerate print_info.c at build time.

If you configure + build its ok.
if you configure + rm <BUILD_DIR>/print_info.c
it fails:

$ make
Scanning dependencies of target example
make[2]: ***  Aucune règle pour fabriquer la cible « print_info.c », nécessaire pour « CMakeFiles/example.dir/print_info.c.o ». Arrêt.

this is different from chapter-06/recipe-01 for which configure_file will generate proper build time dependency.
I'll try a patch and propose a PR.

bast commented

Good point and the problem is confirmed.

bast commented

This limitation is highlighted in the book and in 3cebcca and the unnecessary command is removed in fc10425. The recipe is however kept as trampoline to 6/3 where this is done properly at build time.