Include guards added to Check...SourceCompiles modules lock in policy settings of first inclusion
Splitting this out of #22766 (comment 1049936), see there for a scenario where this came up.
The include guards were added by !1327 (merged), which was part of an effort to improve CMake's performance. #22766 (closed) shows an example where that has led to a change in behavior - the policies associated with the function defined in those files are no longer controlled by the last thing to include them, but instead by the first. We also saw an example of a very similar thing for the
CheckIPOSupported module back in that MR (see Brad's comment).
Projects are no longer able to influence the behavior of the functions these modules define after they have been included once. Since this wasn't the case before !1327 (merged), we should consider this a regression. But that change was in CMake 3.11, so we've had many releases since then. Reverting it now could be considered another regression, but the original behavior would seem to be the more correct.