How to properly turnoff /ZI for a visual studio 17.3.4 cmake project?
10:38 29 Sep 2022

I have C++ code that only works when inlined. But VC refuse to inline them in debug mode even when __forceinline is used. I know I can turn them into macros but that's ugly.

After some googling, I found the culprit is /ZI option. I print all the options. But cmake doesn't seem to add the /ZI option. And remove all /Z7, /Zi, /ZI doesn't work.

The only way that solved the issue is by adding the line below in CmakeLists.txt:

add_compile_options(/ZI-)

But it gives me tons of the following warnings

Command line warning D9025: overriding '/Zi' with '/ZI'
Command line warning D9002: ignoring unknown option '/Z-'

Is there a way to turn off /ZI without the warnings?

visual-studio visual-c++ cmake