title: CMake add target for invoking clang analyzer
body: <p>I'd basically like to achieve the same as <a href="http://blog.alexrp.com/2013/09/26/clangs-static-analyzer-and-automake">http://blog.alexrp.com/2013/09/26/clangs-static-analyzer-and-automake</a>, but with CMake.</p>
  
  <pre><code>analyze_srcs = foo.c
  analyze_plists = $(analyze_srcs:%.c=%.plist)
  CLEANFILES = $(analyze_plists)
  
  $(analyze_plists): %.plist: %.c
    @echo "  CCSA  " $@
    @$(COMPILE) --analyze $&lt; -o $@
  
  analyze: $(analyze_plists)
  .PHONY: analyze
  </code></pre>
  
  <p>So you can run</p>
  
  <pre><code>make analyze
  make clean
  </code></pre>
  
  <p>I guess I need to use <code>add_custom_command/add_custom_target</code> and somehow change the "object file" extension just for that target.</p>
  
  <p>Afterwards get a list of the generated files to perhaps pass them to a script for combining them into 1 output file.</p>
  
  <p>Can anyone point me in the right direction?</p>