It begins with:
MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
IF("${VAR}" MATCHES "^${VAR}$")
What is the intent here? If ${VAR} contains regex special characters
you're going to get all kinds of weird and nasty behavior.
Cheers,
Brandon Van Every