Trick for pre-processing source in CMake

When using <LANG>_COMPILER_LAUCHER or RULE_LAUNCH_COMPILER the following is a nice little pattern to deal with the arguments.

That is, first create a parser for launcher-specific arguments and the compiler arguments1 that are of interest to the launcher. Then perform the magic of the launcher. Finally, create another parser and use it to remove the launcher-specific arguments and use the remainder to perform the compilation.


  1. Here I’m relying on CMake always putting -c just before the source file, which seems to hold most of the time.

⟸ Elm 0.16 with stack Free play, part one ⟹
Leave a comment