This looks like it matches our consensus, but I'm not entirely comfortable signing off on cmake stuff. Can any build gurus take a look at this and confirm it does what the comment says? http://reviews.llvm.org/D4581