# \`target\_compile\_options()\` not setting compile flags

**URL:** https://discourse.cmake.org/t/target-compile-options-not-setting-compile-flags/4183
**Category:** Usage
**Created:** [October 1, 2021, 11:04am UTC](https://discourse.cmake.org/t/target-compile-options-not-setting-compile-flags/4183 "2021-10-01T11:04:57Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![codeling](https://discourse.cmake.org/user_avatar/discourse.cmake.org/codeling/32/1700_2.png) [@codeling](https://discourse.cmake.org/u/codeling)
#### Post date: [October 1, 2021, 11:35am UTC](https://discourse.cmake.org/t/target-compile-options-not-setting-compile-flags/4183/2 "2021-10-01T11:35:57Z")

</div>

Just for reference, I’m guessing this is related to the problem in [this post](https://discourse.cmake.org/t/print-out-compile-options-of-a-target-within-a-function/4175)?

How did you verify that the options weren’t set? Variables such as `CMAKE_CXX_FLAGS` will not be modified by `target_compile_options`, you’d have to check the actual options on the target via get\_target\_properties on property [`COMPILE_OPTIONS`](https://cmake.org/cmake/help/latest/prop_tgt/COMPILE_OPTIONS.html) (or by checking the actual compiler calls in the output of a verbose build).

---

_[View the full topic](https://discourse.cmake.org/t/target-compile-options-not-setting-compile-flags/4183)._
