# Strictly appending to CMAKE\_\<LANG\>\_FLAGS

**URL:** https://discourse.cmake.org/t/strictly-appending-to-cmake-lang-flags/6478
**Category:** Usage
**Created:** [September 13, 2022, 9:54pm UTC](https://discourse.cmake.org/t/strictly-appending-to-cmake-lang-flags/6478 "2022-09-13T21:54:52Z")
**Posts on this page:** 1
**Showing post:** 9

<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: [October 18, 2022, 5:31pm UTC](https://discourse.cmake.org/t/strictly-appending-to-cmake-lang-flags/6478/9 "2022-10-18T17:31:54Z")

</div>

I opened [CMake MR 7804](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7804) to clarify the documentation.

You should be able to achieve your use case with:

```nohighlight
$ env CXXFLAGS='-new -flags' cmake -U CMAKE_CXX_FLAGS ...

```

The `-U CMAKE_CXX_FLAGS` flag will undefine the cache entry so that it will be re-initialized using the new `CXXFLAGS` environment variable value in combination with the builtin defaults.

---

_[View the full topic](https://discourse.cmake.org/t/strictly-appending-to-cmake-lang-flags/6478)._
