schulmar/Templar — pull request #3 by mikael-s-persson (2014-12-30 00:00:55+00:00)
Title: Restructured the cmake file a bit, just to be in "good style"

Restructured the cmake file a bit, just to be in "good style" (options -> compiler-checks -> package-finds -> list sources -> create targets).

The Qt5-enabled cmake file looked fine to me, but I felt it was a bit bad in style (and I'm to blame for that, I was sloppy with the original one I made). Basically, the typical "good style" cmake file will start with general info and options (so that they're the first thing you see), then have compiler / platform checks and flags (e.g., C++11 support) (because it's easiest, and often needs checking / tweaking), then the searches for packages (before going too far into the listing of source files, so that things remain order-independent and general), and finally, have all your project-specific lists of source files and creation of your targets. The idea is generally that a nice cmake files are easy to re-use by copy-paste from one project to another (or even wrapping parts up into cmake modules, when it gets bigger).