cppcheck: fix --with-gui option not finding cfg

(maybe) Fixes #27756.