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.