[CMake] Problem with Static Pattern Rules

Alexander Neundorf a.neundorf-work at gmx.net
Tue Jul 8 15:53:50 EDT 2008


On Tuesday 08 July 2008, Carminati Federico wrote:
> Hello,
>    it is possible to add a custom command to cmake with a static
> pattern rule? My problem is the following, I have a coding convention
> checker that for each c++ source file creates a "violation" file. The
> rule I had in my makefile was
>
> $(SRCS:.cxx=.viol) : %.viol : %.cxx
>       bla bla
>
> How can I do this in cmake? The only way that seems to work is to
> create a single rule for each file with foreach. 

Yes, that's how to do it.
You can wrap this in a macro, so you get something like:

add_violation_rules(... files....)

Alex


More information about the CMake mailing list