[CMake] add_compile_options query

Alex Biddulph c3124185 at uon.edu.au
Fri Aug 12 05:08:08 EDT 2016


Hi,

I am trying to add some GCC compiler optimisation flags using the add_compile_options directive but am running into some issues due to the nature of the flags.

There are 3 flags that I am trying to set:
--param l1-cache-size=24
--param l1-cache-line-size=64
--param l2-cache-size=512

If I try to add these as:
add_compile_options(--param l1-cache-size=24)
add_compile_options(--param l1-cache-line-size=64)
add_compile_options(--param l2-cache-size=512)

Then the resulting portion of the command line is: 
--param l1-cache-size=24 l1-cache-line-size=64 l2-cache-size=512

That is, only one of the '--param's is maintained, but all 3 need to be maintained in order for GCC to understand the flags.

Is it possible to use add_compile_options to set these flags? Or is there another more effective method? I would like to avoid adding them to CFLAGS and CXXFLAGS if at all possible.

Thanks in advance,
Alex


More information about the CMake mailing list