cmake: fix test_fork,  fix fragile code related to HAVE_FORK macro

* report from Richard Newton indicated previous solutions was not
  working on Windows