linker cannot find openmp library on msys system

I am using FIND_PACKAGE(OpenMP) on mysy2 and then linking the necessary libraries using

TARGET_LINK_LIBRARIES( target_name ... ${OpenMP_CXX_LIBRARIES} )

This works find on most systems, but on msys2 I get the following error during linking:

cannot find -lC:/msys64/mingw64/lib/libcomp.dll.a

If I use verbose makefiles to get the linker command. Then execute the linker command with all occurrences of ‘-lC:/’ changed to 'C:/`, the linker command works fine. Is this a problem with the linker command generated by cmake ?

This was a problem with the version of cmake;see
https://gitlab.kitware.com/cmake/cmake/-/issues/24949