Changed the way some CMake functions are used to support older versions of CMake.