[CMake] Multiple possible rules based on files that may be generated

Brad King brad.king at kitware.com
Wed Jul 27 17:23:26 EDT 2005


Chris Green wrote:
> I have a utility called rootcint which generates C++ dictionaries. It is 
> run on a file myfile_linkdef.h and optionally one or more headers to 
> produce a dictionary of C++ options to allow them to be called in 
> another utility.
> 
> In the particular case I'm trying to implement, I know that, if a header 
> auxiliary to myfile_linkdef.h exists at the time I want to run rootcint, 
> it will have a name myfile.(h|hpp|hh|h++) and be found in the current 
> include directory list or the current source or binary directory. 
> However, it may be generated just prior to wanting to run rootcint by 
> another rule, or it may not exist at all.
> 
> I want some way of deciding at *command time* which form of the rule to 
> execute and still handle the dependencies properly. This was possible in 
> raw make by doing something like:

By "form of the rule" do you mean from where it retrieves the associated 
headers?  Let's try to define what you want the command to do without 
using make syntax:

1.) The input is always somedir/foo_linkdef.h
2a.) There is a somedir/foo.h on which the rule should depend and run.
2b.) There is a someotherdir/foo.h on which the rule should depend and run.
2c.) There is no other header.
3.) For cases 2a/2b the other header may be generated by a prior build 
rule.  In this case where is the generation rule defined?

-Brad


More information about the CMake mailing list