CMake: Link libm to test binaries if available.

If libm is available link it to test binaries which will otherwise
fail to compile. Tested on FreeBSD 13-STABLE.

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
Signed-off-by: Ralph Giles <giles@thaumas.net>
2 jobs for master in 1 minute and 43 seconds (queued for 2 seconds)
latest
Status Job ID Name Coverage
  Build
passed autoconf #11678
docker

00:01:43

passed cmake #11679
docker

00:00:34