automoc: avoid more compiler warnings in linker-warning-silencing code
requested to merge tsdgeos/cmake:less_warnings_in_cmake_automoc_silence_linker_warning_v3 into master
Revise the approach from !7558 (merged) to avoid -Wmissing-declarations
warnings too.
Issue: #23823 (closed)
Backport: release
Topic-rename: automoc-silence-warnings
Edited by Brad King