CMake 3.19 - check_c_compiler_flag doesn't support CMAKE_REQUIRED_FLAGS

It seems that with 3.19, check_c_compiler_flag no longer respects CMAKE_REQUIRED_FLAGS.

check_c_compiler_flag -> cmake_check_compiler_flag

It looks like there are two implementations of cmake_check_compiler_flag one in Modules/Internal/CheckCompilerFlag.cmake and the other in Modules/Internal/CMakeCheckCompilerFlag.cmake.

If the version on CMakeCheckCompilerFlag.cmake wins than CMAKE_REQUIRED_FLAGS and related aren’t respected. Is this expected behavior?

And if so how do you control which version of cmake_check_compiler_flag gets pulled in?

Cc: @brad.king Potential 3.19 regression. File history points to d192918586364b98e916887b190da825c1373f7f as the potential culprit. @robert.maynard

I see you’ve opened CMake Issue 21497 for this, thanks.