[CMake] What is the preferred method of establishing the dependence of a custom command on an executable target?

Brandon J. Van Every bvanevery at gmail.com
Sun Apr 8 14:06:25 EDT 2007


CMake (unfortuantely) distinguishes between target level dependencies 
and file level dependencies.  An ADD_CUSTOM_COMMAND only creates file 
level dependencies, and these fail in various circumstances.  To create 
target level dependencies, you create an ADD_CUSTOM_TARGET that depends 
on the file output of your ADD_CUSTOM_COMMAND.  You should connect all 
your important dependencies at the target level.

Yes this is redundant, verbose, and not the most elegant or likeable 
thing about CMake, but the drill itself is not actually that hard.  What 
is annoying, however, is believing your build works fine, you see it 
work fine on various platforms, then there's some other platform where 
it fails because you forgot to do this kind of wrapping job somewhere.  
So then you're scratching your head about where you did it, or if you 
did it.  I suspect we have a bug like this on Linux right now, but I 
haven't had time to deal with it.


Cheers,
Brandon Van Every



More information about the CMake mailing list