# Overriding Source File Properties Precedense Clarity

**URL:** https://discourse.cmake.org/t/overriding-source-file-properties-precedense-clarity/13955
**Category:** Usage
**Tags:** os:linux, gen:ninja
**Created:** [April 17, 2025, 11:32pm UTC](https://discourse.cmake.org/t/overriding-source-file-properties-precedense-clarity/13955 "2025-04-17T23:32:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Drue\_Peters](https://discourse.cmake.org/user_avatar/discourse.cmake.org/drue_peters/32/2629_2.png) [@Drue\_Peters](https://discourse.cmake.org/u/Drue_Peters)
#### Post date: [April 17, 2025, 11:32pm UTC](https://discourse.cmake.org/t/overriding-source-file-properties-precedense-clarity/13955/1 "2025-04-17T23:32:06Z")

</div>

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?
