CMake: switch to using autouic on plugins

- Use autouic so that we can also pass in --include to add
   a code-warning-suppression to the generated code, just like
   we can do with moc.
This commit is contained in:
Adriaan de Groot 2019-05-13 14:52:26 +02:00
parent ed3eafbc2d
commit ba7ee445c6
3 changed files with 17 additions and 7 deletions

View file

@ -18,7 +18,7 @@
#
###
#
# Helper function for doing automoc on a target.
# Helper function for doing automoc on a target, and autoui on a .ui file.
#
# Sets AUTOMOC TRUE for a target.
#
@ -27,6 +27,8 @@
# libcalamares/utils/moc-warnings.h file to the moc, which in turn
# reduces compiler warnings in generated MOC code.
#
# If the global variable CALAMARES_AUTOUIC_OPTIONS is set, adds that
# to the options passed to uic.
function(calamares_automoc TARGET)
set_target_properties( ${TARGET} PROPERTIES AUTOMOC TRUE )
@ -34,3 +36,12 @@ function(calamares_automoc TARGET)
set_target_properties( ${TARGET} PROPERTIES AUTOMOC_MOC_OPTIONS "${CALAMARES_AUTOMOC_OPTIONS}" )
endif()
endfunction()
function(calamares_autouic TARGET)
set_target_properties( ${TARGET} PROPERTIES AUTOUIC TRUE )
if ( CALAMARES_AUTOUIC_OPTIONS )
foreach(S ${ARGN})
set_property(SOURCE ${S} PROPERTY AUTOUIC_OPTIONS "${CALAMARES_AUTOUIC_OPTIONS}")
endforeach()
endif()
endfunction()