Simplify cmake by creating macro and add dependency to math library.

If math library is not added to dependencies explicitly, then when executing fann binary the missing function error is thrown.

This is a pull request: https://github.com/libfann/fann/pull/4 separated into a branch.