Nice Idea.
In the mean time you might want to take a look at FindQt4.cmake in the Modules directory. In that file are some macros like:

  # QT4_WRAP_CPP(outfiles inputfile ... )

  MACRO (QT4_WRAP_CPP outfiles )
    # get include dirs
    QT4_GET_MOC_FLAGS(moc_flags)
    QT4_EXTRACT_OPTIONS(moc_files moc_options ${ARGN})

    FOREACH (it ${moc_files})
      GET_FILENAME_COMPONENT(it ${it} ABSOLUTE)
      QT4_MAKE_OUTPUT_FILE(${it} moc_ cxx outfile)
QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "$ {moc_options}")
      SET(${outfiles} ${${outfiles}} ${outfile})
    ENDFOREACH(it)

  ENDMACRO (QT4_WRAP_CPP)

Where you feed it some source files and it will run the qt "moc" program on the input files and produce new output files that can then be compiled. You may want to implement something like that for your own special preprocessors.


_________________________________________________________
Mike Jackson                  [email protected]
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Feb 19, 2009, at 12:10 PM, Bill O'Hara wrote:

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.


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to