add_compile_options append factorisation.

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

CMake remove duplicate options.

In your case, you have to use SHELL: pattern (see add_compile_options, Arguments section) to avoid de-duplication:

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

Thanx Marc,

Red face :frowning: 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 :slight_smile:

Anyway you made my day, I can resume now.

Cheers,

Phi