compiler: add CONFIG_COMPILER_TRACK_MACRO_EXPANSION

Add a new compiler option to control tracking locations of tokens across
macro expansions. It may be useful to disable it when debugging long
macro expansion chains.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7253527..4ea6433 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -304,6 +304,11 @@
   zephyr_compile_options($<TARGET_PROPERTY:compiler,save_temps>)
 endif()
 
+if(NOT CONFIG_COMPILER_TRACK_MACRO_EXPANSION)
+  # @Intent: Set compiler specific flags to not track macro expansion
+  zephyr_compile_options($<TARGET_PROPERTY:compiler,no_track_macro_expansion>)
+endif()
+
 if(CONFIG_COMPILER_COLOR_DIAGNOSTICS)
 # @Intent: Set compiler specific flag for diagnostic messages
 zephyr_compile_options($<TARGET_PROPERTY:compiler,diagnostic>)