fix type of cmake variable
Ported from http://trac.research.cc.gatech.edu/fastlab/wiki/UsingCMake and modified slightly