mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-10 19:39:52 -05:00
automoc: silence linker warning on macos
when an empty `mocs_compilation.cpp` is included in a static library, the macos linker emits a warning: ``` /Applications/Xcode13.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: path/To/Library.a(mocs_compilation.cpp.o) has no symbols ``` we therefore generate a globally visible weak symbol in the form of a virtual function table
This commit is contained in:
@@ -2175,7 +2175,14 @@ void cmQtAutoMocUicT::JobMocsCompilationT::Process()
|
|||||||
// Placeholder content
|
// Placeholder content
|
||||||
content += "// No files found that require moc or the moc files are "
|
content += "// No files found that require moc or the moc files are "
|
||||||
"included\n"
|
"included\n"
|
||||||
"enum some_compilers { need_more_than_nothing };\n";
|
"struct cmake_automoc_silence_linker_warning{\n"
|
||||||
|
" virtual ~cmake_automoc_silence_linker_warning();\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"inline "
|
||||||
|
"cmake_automoc_silence_linker_warning::"
|
||||||
|
"~cmake_automoc_silence_linker_warning()\n"
|
||||||
|
"{}\n";
|
||||||
} else {
|
} else {
|
||||||
// Valid content
|
// Valid content
|
||||||
const bool mc = this->BaseConst().MultiConfig;
|
const bool mc = this->BaseConst().MultiConfig;
|
||||||
|
|||||||
Reference in New Issue
Block a user