# add\_compile\_options append factorisation.

**URL:** https://discourse.cmake.org/t/add-compile-options-append-factorisation/1133
**Category:** Usage
**Created:** [May 1, 2020, 8:42am UTC](https://discourse.cmake.org/t/add-compile-options-append-factorisation/1133 "2020-05-01T08:42:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Phi](https://discourse.cmake.org/user_avatar/discourse.cmake.org/phi/32/206_2.png) [@Phi](https://discourse.cmake.org/u/Phi)
#### Post date: [May 1, 2020, 8:42am UTC](https://discourse.cmake.org/t/add-compile-options-append-factorisation/1133/1 "2020-05-01T08:42:16Z")

</div>

Hi All,

I am new to cmake, so may be this is a trivial question.

I am trying to use add\_compile\_options() and I got the impression that compile options gets kind fatorised, i.e multiple -v -v would end up as a single -v.

Unfortunately I am using with my compiler something like -include a.h -include b.h, and from what I can see it generate something lile -include a.h b.h, I really need -include be repeated i.e -include a.h -include b.h, is that doable ?

Thanx in advance

Cheers

Phi

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [May 1, 2020, 8:49am UTC](https://discourse.cmake.org/t/add-compile-options-append-factorisation/1133/2 "2020-05-01T08:49:26Z")

</div>

`CMake` remove duplicate options.

In your case, you have to use `SHELL:` pattern (see [add\_compile\_options, Arguments section](https://cmake.org/cmake/help/latest/command/add_compile_options.html)) to avoid de-duplication:

```cmake
add_compile_options ("SHELL:-include a.h" "SHELL:-include b.h")

```

---

<div class="post-metadata">

### Author: ![Phi](https://discourse.cmake.org/user_avatar/discourse.cmake.org/phi/32/206_2.png) [@Phi](https://discourse.cmake.org/u/Phi)
#### Post date: [May 1, 2020, 9:02am UTC](https://discourse.cmake.org/t/add-compile-options-append-factorisation/1133/3 "2020-05-01T09:02:07Z")

</div>

Thanx Marc,

Red face ☹ I was fearing an RTFM one, I admit I red the doc too fast.

I then wondered why I missed it, and I think my ‘fast reading’ mode kinda focus on things like Example text area, i.e reading example before the literature, may be something derived from 'learning by example", so I red the what’s below the Big “Blue Example” while the real example were above that in little font 🙂

Anyway you made my day, I can resume now.

Cheers,

Phi
