Here is the build log of rev11488 of spell check 32bit wx31 project(SpellChecker_wx31.cbp).
About the linker option, only the last target is need the linking option "-lwxmsw31u", the other targets do not need this linker options, so WX_VERSION is only used in the last target. The other targets are just using the ar.exe to achieve the object files.
About the compiler option when building the first target named "hunspell"
[ 5.0%] g++.exe -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -std=gnu++11 -g -O0 -pipe -mthreads -fmessage-length=0 -fexceptions -DHUNSPELL_STATIC -Iwxspellchecker\include -IE:\wxWidgets-3.1.1-rc\include -IE:\wxWidgets-3.1.1-rc\lib\gcc_dll\mswu -Ihunspell\src\hunspell -Ihunspell\ -c hunspell\src\hunspell\affentry.cxx -o ..\..\..\.objs31\plugins\contrib\SpellChecker\hunspell\hunspell\src\hunspell\affentry.o
I see in the target's compiler option, there is a line:
$(#WX31.lib)\gcc_dll$(WX_CFG)\msw$(WX_SUFFIX)
But the WX_CFG and WX_SUFFIX is not defined in the target level. I also don't find those variables in project level.
So, how does those custom variables expand? Maybe, I just build the CodeBlocks_wx31.cbp, and the custom variables are cached?