In our repository we have multiple apps in our application directory with shared code in our subsys directory. We want to compile all of our code with certain compile options. For example, we want to compile with -O0 when debugging, add more warning checks, etc.
We cannot build the NCS and Zephyr code with the same compile options because the applications do not fit in flash when Zephyr sources are also compiled with -O0, zephyr has many warnings with certain warning checks, etc.
I have tried adding this to the bottom of an application CMakeLists.txt file, but it does not seem to have any effect:
target_compile_options(app PRIVATE -O0)
Is there a way to specific target compile options, such as '-O0' just for our app sources and our subsys sources?