summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-08-16 16:40:31 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-08-16 16:40:48 (GMT)
commitc082c5c1678023221e10a608e5a442c82e8a4367 (patch)
treeafe7f7d3bd4cf17f015b655a9647f88c7bdcee2c /Source
parent9ce5018be9f8ffd2bcfda00b9c1b81d3401e20ba (diff)
parent844244ccdc020f8b16d02478ceb4f79fd696aed6 (diff)
downloadCMake-c082c5c1678023221e10a608e5a442c82e8a4367.zip
CMake-c082c5c1678023221e10a608e5a442c82e8a4367.tar.gz
CMake-c082c5c1678023221e10a608e5a442c82e8a4367.tar.bz2
Merge topic 'automoc-silence-warnings'
844244ccdc automoc: avoid compiler warnings in linker-warning-silencing code Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7558
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoMocUic.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index a7125b1..8c09b56 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -2167,22 +2167,23 @@ void cmQtAutoMocUicT::JobCompileUicT::Process()
void cmQtAutoMocUicT::JobMocsCompilationT::Process()
{
+ std::string const& compAbs = this->MocConst().CompFileAbs;
+
// Compose mocs compilation file content
std::string content =
"// This file is autogenerated. Changes will be overwritten.\n";
if (this->MocEval().CompFiles.empty()) {
// Placeholder content
+ cmCryptoHash hash(cmCryptoHash::AlgoSHA256);
+ const std::string hashedPath = hash.HashString(compAbs);
+ const std::string functionName =
+ "cmake_automoc_silence_linker_warning" + hashedPath;
+
content += "// No files found that require moc or the moc files are "
"included\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";
+ "void " +
+ functionName + "() {}\n";
} else {
// Valid content
const bool mc = this->BaseConst().MultiConfig;
@@ -2191,7 +2192,6 @@ void cmQtAutoMocUicT::JobMocsCompilationT::Process()
content += cmWrap(wrapFront, this->MocEval().CompFiles, wrapBack, "");
}
- std::string const& compAbs = this->MocConst().CompFileAbs;
if (cmQtAutoGenerator::FileDiffers(compAbs, content)) {
// Actually write mocs compilation file
if (this->Log().Verbose()) {