# append headers using target\_include\_directories() after target\_compile\_options()

**URL:** https://discourse.cmake.org/t/append-headers-using-target-include-directories-after-target-compile-options/6388
**Category:** Code
**Created:** [September 2, 2022, 5:26am UTC](https://discourse.cmake.org/t/append-headers-using-target-include-directories-after-target-compile-options/6388 "2022-09-02T05:26:35Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Khushal\_Khanna](https://discourse.cmake.org/user_avatar/discourse.cmake.org/khushal_khanna/32/2731_2.png) [@Khushal\_Khanna](https://discourse.cmake.org/u/Khushal_Khanna)
#### Post date: [September 2, 2022, 5:26am UTC](https://discourse.cmake.org/t/append-headers-using-target-include-directories-after-target-compile-options/6388/1 "2022-09-02T05:26:35Z")

</div>

Hello all,

I have some compiler settings that require me to append headers after compile\_options in generated .rsp files. In current case, .rsp file → headers compiler\_options  
required case → compiler options headers  
is there a way to do it using target\_include\_directories() and target\_compile\_options()

```auto
add_library(lib STATIC src)
target_compile_options(lib PUBLIC options)
target_include_directories(lib AFTER PUBLIC headers)

```

---

<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: [September 2, 2022, 2:05pm UTC](https://discourse.cmake.org/t/append-headers-using-target-include-directories-after-target-compile-options/6388/2 "2022-09-02T14:05:17Z")

</div>

Fine-grained flag ordering is not controllable in CMake today.

I suppose this has to do with the `.rsp` having include directives of its own that this needs to come afterwards? Would it be easier to add the flag to another `.rsp` file and use that through the options?
