[CMake] Multiple possible rules based on files that may be generated
Chris Green
chissg at comcast.net
Wed Jul 27 13:05:06 EDT 2005
Hi,
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:
$(dict_o_dir)%_dict.cxx : $(CINT_PREP) %.hpp %_linkdef.h
if [ -r $(include_dir)$*.hpp ] ; then \
rootcint -f $@ -c -p $(CINT_DEFECTS) $(CPPFLAGS)
$(include_dir)$*.hpp $*_linkdef.h; \
else \
rootcint -f $@ -c -p $(CINT_DEFECTS) $(CPPFLAGS)
$(workdir)$*.hpp $(workdir)$*_linkdef.h; \
fi
$(dict_o_dir)%_dict.cxx : $(CINT_PREP) %.h %_linkdef.h
rootcint -f $@ -c -p $(CINT_DEFECTS) $(CPPFLAGS) \
$(include_dir)$*.h $*_linkdef.h;
But I'm having real trouble thinking of how to do this in CMake and a)
avoid CMake errors while b) handling the dependencies properly. If I don't
get this working it could be a showstopper to our use of CMake. Can anyone
help me out?
Thanks,
Chris.
--
Chris Green, MiniBooNE / LANL. Email greenc at fnal.gov
Tel: (630) 840-2167. Fax: (630) 840-3867
More information about the CMake
mailing list