There are a few sections across our code base where it would be nice to always optimize specific files. I’m currently using set_source_files_properties(src.cpp PROPERTIES COMPILE_FLAGS "-O3")
to enforce this.
The ninja line for flags looks like: FLAGS = -std=c++23 -g -Og ... -O3
The -g Og
comes from our default DEBUG flags we have set. I’m using a global interface_library
to enforce this. This seems to be working. I believe this is because Clang and GCC prioritize the most recent option. Can I always rely on this behavior to work? Will it work as intended if I switch to MVSC for some reason?
I’m asking the more general question of: Will set_source_files_properties
always be configured to override any linked library
properties?