CMake: changed cached bools into "option"
fix some compile  warnings:
- passing NULL to non-pointer
- unused vars
- unused function
- order of init
- parentheses
fix warning:

equality comparison with extraneous parentheses
fix SimpleOpenGL linking (missing libm)
Merge pull request #332 from abma/master

some minor fixes