[CMake] feature request: easy to to specify actions for all files with a certain extension

Bill O'Hara billtohara at gmail.com
Thu Feb 19 12:10:59 EST 2009


I've not seen a straightforward way to do this, but would happily be
corrected :-)

I have a few types of files in our project which, based on the extension,
need certain actions performed as part of the build. For example, foo.S
would require running cpp on the file before assembling it. Or, several .fS
files which are written in our own in-house macro language - you need to run
our preprocessor before assembly. While I can add custom commands, or try to
figure out how to add a new language support to cmake, it'd be nice if there
were an easy way to specify a generic action to take when seeing a file with
a certain extension.

Blue-skying, if I were to say

add_command_pattern(EXTENSION "fS"
  COMMAND foopreprocessor file.fS -o file.s)

add_executable(hello hello.c foo.fS)

and then the sequence of actions would be

foopreprocessor foo.fS -o foo.s
cc -o hello hello.c foo.s

Is this reasonable? Or is there a simple way I'm overlooking to declare such
generic actions based on file extensions?

thanks!
b.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090219/1c47408c/attachment.htm>


More information about the CMake mailing list