diff options
author | Adriaan de Groot <groot@kde.org> | 2019-04-17 12:19:12 +0200 |
---|---|---|
committer | Adriaan de Groot <groot@kde.org> | 2019-04-18 12:06:09 +0200 |
commit | bdb7bf71a8ed1cef055cdc50a648ce7cd3e33db8 (patch) | |
tree | 647a144b02f060efba45936a940b1b7c1ab263fb /CMakeModules/CalamaresAutomoc.cmake | |
parent | cef2f50510aefa0fd0853c32c957cd4bbda1be6a (diff) |
Reduce warnings from moc-generated code
- The auto-generated code produces a lot of warnings from
Clang 8; this obscures the more meaningful warnings from
actual Calamares code, so tone the warnings down.
- For Clang, set CALAMARES_MOC_OPTIONS.
- Add convenience CMake function for automoccing. It applies
the options as needed to a given target.
Diffstat (limited to 'CMakeModules/CalamaresAutomoc.cmake')
-rw-r--r-- | CMakeModules/CalamaresAutomoc.cmake | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/CMakeModules/CalamaresAutomoc.cmake b/CMakeModules/CalamaresAutomoc.cmake new file mode 100644 index 000000000..0ca5cd89a --- /dev/null +++ b/CMakeModules/CalamaresAutomoc.cmake @@ -0,0 +1,36 @@ +# === This file is part of Calamares - <https://github.com/calamares> === +# +# Calamares is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Calamares is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Calamares. If not, see <http://www.gnu.org/licenses/>. +# +# SPDX-License-Identifier: GPL-3.0+ +# License-Filename: LICENSE +# +### +# +# Helper function for doing automoc on a target. +# +# Sets AUTOMOC TRUE for a target. +# +# If the global variable CALAMARES_AUTOMOC_OPTIONS is set, uses that +# as well to set options passed to MOC. This can be used to add +# libcalamares/utils/moc-warnings.h file to the moc, which in turn +# reduces compiler warnings in generated MOC code. +# + +function(calamares_automoc TARGET) + set_target_properties( ${TARGET} PROPERTIES AUTOMOC TRUE ) + if ( CALAMARES_AUTOMOC_OPTIONS ) + set_target_properties( ${TARGET} PROPERTIES AUTOMOC_MOC_OPTIONS "${CALAMARES_AUTOMOC_OPTIONS}" ) + endif() +endfunction() |