1message(STATUS "Patching check ${VERSION} ${SOURCE_DIR}")
2
3# Patch checks for MinGW
4# https://sourceforge.net/p/check/patches/53/
5set(CMAKE_LISTS_LOCATION "${SOURCE_DIR}/CMakeLists.txt")
6file(READ ${CMAKE_LISTS_LOCATION} CMAKE_LISTS)
7string(REGEX REPLACE
8  "(check_type_size\\((clock|clockid|timer)_t [A-Z_]+\\)[\r\n]+[^\r\n]+[\r\n]+[^\r\n]+[\r\n]+endif\\(NOT HAVE[A-Z_]+\\))"
9  "set(CMAKE_EXTRA_INCLUDE_FILES time.h)\n\\1\nunset(CMAKE_EXTRA_INCLUDE_FILES)"
10  CMAKE_LISTS "${CMAKE_LISTS}")
11file(WRITE ${CMAKE_LISTS_LOCATION} "${CMAKE_LISTS}")
12message(STATUS "Patched ${CMAKE_LISTS_LOCATION}")
13