CalamaresAutomoc.cmake 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # === This file is part of Calamares - <https://github.com/calamares> ===
  2. #
  3. # Calamares is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 3 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # Calamares is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with Calamares. If not, see <http://www.gnu.org/licenses/>.
  15. #
  16. # SPDX-License-Identifier: GPL-3.0+
  17. # License-Filename: LICENSE
  18. #
  19. ###
  20. #
  21. # Helper function for doing automoc on a target, and autoui on a .ui file.
  22. #
  23. # Sets AUTOMOC TRUE for a target.
  24. #
  25. # If the global variable CALAMARES_AUTOMOC_OPTIONS is set, uses that
  26. # as well to set options passed to MOC. This can be used to add
  27. # libcalamares/utils/moc-warnings.h file to the moc, which in turn
  28. # reduces compiler warnings in generated MOC code.
  29. #
  30. # If the global variable CALAMARES_AUTOUIC_OPTIONS is set, adds that
  31. # to the options passed to uic.
  32. function(calamares_automoc TARGET)
  33. set_target_properties( ${TARGET} PROPERTIES AUTOMOC TRUE )
  34. if ( CALAMARES_AUTOMOC_OPTIONS )
  35. set_target_properties( ${TARGET} PROPERTIES AUTOMOC_MOC_OPTIONS "${CALAMARES_AUTOMOC_OPTIONS}" )
  36. endif()
  37. endfunction()
  38. function(calamares_autouic TARGET)
  39. set_target_properties( ${TARGET} PROPERTIES AUTOUIC TRUE )
  40. if ( CALAMARES_AUTOUIC_OPTIONS )
  41. foreach(S ${ARGN})
  42. set_property(SOURCE ${S} PROPERTY AUTOUIC_OPTIONS "${CALAMARES_AUTOUIC_OPTIONS}")
  43. endforeach()
  44. endif()
  45. endfunction()