Unresonable checks of Linux headers, while running CMake on FreeBSD 13

I am experiencing some inappropriate behavior of CMake (apparently cause of both lack of platform specific patch and due to a need to re-write project specific build rules).

Some headers have no sense on BSD systems. The current issue is more about specifically kqueue versus epoll headers.

I wasn’t to reference Github’s issue directly - but an opened one has an ID 42282.

So while building gollvm (FreeBSD 13.0, x86_64) I got this:

CMake Error at tools/gollvm/cmake/modules/AutoGenGo.cmake:389 (message):
*** struct epoll_event data.fd offset unknown
Call Stack (most recent call first):
tools/gollvm/libgo/CMakeLists.txt:323 (mkepoll)
This shouldn’t be even considered, since epoll is present on Linux (but not on FreeBSD).
Instead it has check for kqueue.
The above Github issue contains the list of libgo’s source files, some which depend on kqueue.
Despite the fact that gollvm project has CMake’s configuration as a replacement of “configure” and autotools - ensuring that libgo’s C files would compiled, by probing via some dummy, should be enough.
I wouldn’t expect anything expect an abort, if the probed sample source file wouldn’t compile.

These are the issues you are referring to:

This looks like a libgo CMakeLists.txt issue and not an issue with CMake itself AFAIK.