Debian Codegraph @

CMakeModules/CalamaresAutomoc.cmake

raw
1 # === This file is part of Calamares - <https://calamares.io> ===
2 #
3 # SPDX-FileCopyrightText: 2019 Adriaan de Groot <[email protected]>
4 # SPDX-License-Identifier: BSD-2-Clause
5 #
6 # Calamares is Free Software: see the License-Identifier above.
7 #
8 #
9 ###
10 #
11 # Helper function for doing automoc, autouic, autorcc on targets,
12 # and on the corresponding .ui or .rcc files.
13 #
14 # calamares_automoc(target)
15 # Sets AUTOMOC TRUE for a target.
16 #
17 # If the global variable CALAMARES_AUTOMOC_OPTIONS is set, uses that
18 # as well to set options passed to MOC. This can be used to add
19 # libcalamares/utils/moc-warnings.h file to the moc, which in turn
20 # reduces compiler warnings in generated MOC code.
21 #
22 # calamares_autouic(target [uifile ..])
23 # Sets AUTOUIC TRUE for a target.
24 #
25 # If the global variable CALAMARES_AUTOUIC_OPTIONS is set, adds that
26 # to the options passed to uic for each of the named uifiles.
27 #
28 # calamares_autorcc(target [rcfile ..])
29 # Sets AUTOUIC TRUE for a target.
30 #
31 # If the global variable CALAMARES_AUTORCC_OPTIONS is set, adds that
32 # to the options passed to rcc for each of the named rcfiles.
33
34 function(calamares_automoc TARGET)
35 set_target_properties( ${TARGET} PROPERTIES AUTOMOC TRUE )
36 if ( CALAMARES_AUTOMOC_OPTIONS )
37 set_target_properties( ${TARGET} PROPERTIES AUTOMOC_MOC_OPTIONS "${CALAMARES_AUTOMOC_OPTIONS}" )
38 endif()
39 endfunction()
40
41 function(calamares_autouic TARGET)
42 set_target_properties( ${TARGET} PROPERTIES AUTOUIC TRUE )
43 if ( CALAMARES_AUTOUIC_OPTIONS )
44 foreach(S ${ARGN})
45 set_property(SOURCE ${S} PROPERTY AUTOUIC_OPTIONS "${CALAMARES_AUTOUIC_OPTIONS}")
46 endforeach()
47 endif()
48 endfunction()
49
50 function(calamares_autorcc TARGET)
51 set_target_properties( ${TARGET} PROPERTIES AUTORCC TRUE )
52 if ( CALAMARES_AUTORCC_OPTIONS )
53 foreach(S ${ARGN})
54 set_property(SOURCE ${S} PROPERTY AUTORCC_OPTIONS "${CALAMARES_AUTORCC_OPTIONS}")
55 endforeach()
56 endif()
57 endfunction()