[CMake] Targets like Makefile suffix rules?

Jordi Gutiérrez Hermoso jordigh at octave.org
Wed Jun 1 11:19:00 EDT 2011


If I have several files with a .cc or .cpp filename extension that I
want to compile using Octave's mkoctfile script (a wrapper that turns
them into loadable object code in a form recognisable by the Octave
interpreter), how should I do it?

I thought I could do it with add_custom_command, but as I seem to
understand it, I need to write one such add_custom_command per source
file I want to process, perhaps with a loop?

What I'm really looking for is something like

   .cpp.oct:
   mkoctfile $< $COMPILATION_OPTIONS

like in Makefiles, a way to specify a custom command to turn files of
type A into type B with some flexibility of the option passed to this
command. Then I want to use this custom command to any specified
source file.

TIA,
- Jordi G. H.


More information about the CMake mailing list