HDF5 + CMake + MinGW32

Hi, I try to compile HDF5 with MinGW32 and CMake (link
<http://stackoverflow.com/a/25752390/910139>), with enabled THREADSAFE
flag. My system is Windows 7 x64. Compilation goes fine, but I have some
problem on Linking stage. I get *"undefined reference to
InitOnceExecuteOnce"*. I found that this function is part of libkernel32.a (
link
<https://msdn.microsoft.com/en-us/library/windows/desktop/ms683493(v=vs.85).aspx>),
which I obviously have on my system. I try compilation on other PC, but I
get the same error. What I missed? I appreciate any help.