# CMake 3.19 - check\_c\_compiler\_flag doesn't support CMAKE\_REQUIRED\_FLAGS

**URL:** https://discourse.cmake.org/t/cmake-3-19-check-c-compiler-flag-doesnt-support-cmake-required-flags/2233
**Category:** Usage
**Created:** [November 24, 2020, 11:00pm UTC](https://discourse.cmake.org/t/cmake-3-19-check-c-compiler-flag-doesnt-support-cmake-required-flags/2233 "2020-11-24T23:00:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![galak](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/g/f9ae1b/32.png) [@galak](https://discourse.cmake.org/u/galak)
#### Post date: [November 24, 2020, 11:00pm UTC](https://discourse.cmake.org/t/cmake-3-19-check-c-compiler-flag-doesnt-support-cmake-required-flags/2233/1 "2020-11-24T23:00:28Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 24, 2020, 11:17pm UTC](https://discourse.cmake.org/t/cmake-3-19-check-c-compiler-flag-doesnt-support-cmake-required-flags/2233/2 "2020-11-24T23:17:34Z")

</div>

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

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [November 25, 2020, 12:08pm UTC](https://discourse.cmake.org/t/cmake-3-19-check-c-compiler-flag-doesnt-support-cmake-required-flags/2233/3 "2020-11-25T12:08:26Z")

</div>

I see you’ve opened [CMake Issue 21497](https://gitlab.kitware.com/cmake/cmake/-/issues/21497) for this, thanks.
