|
11 | 11 |
|
12 | 12 | The generated CMake file looks like this: |
13 | 13 |
|
14 | | - add_custom_target(devicetree_target) |
15 | | - set_target_properties(devicetree_target PROPERTIES |
| 14 | + add_custom_target(${DEVICETREE_TARGET}) |
| 15 | + set_target_properties(${DEVICETREE_TARGET} PROPERTIES |
16 | 16 | "DT_PROP|/soc|compatible" "vnd,soc;") |
17 | 17 | ... |
18 | 18 |
|
19 | | -It defines a special CMake target, and saves various values in the |
| 19 | +It takes an input variable - DEVICETREE_TARGET - and creates a special |
| 20 | +CMake target with this name, which will contain various values in the |
20 | 21 | devicetree as CMake target properties. |
21 | 22 |
|
22 | 23 | Be careful: |
@@ -154,15 +155,13 @@ def main(): |
154 | 155 | cmake_comp = f'DT_COMP|{comp}' |
155 | 156 | cmake_props.append(f'"{cmake_comp}" "{cmake_path}"') |
156 | 157 |
|
| 158 | + cmake_props = map( |
| 159 | + 'set_target_properties(${{DEVICETREE_TARGET}} PROPERTIES {})'.format, |
| 160 | + cmake_props |
| 161 | + ) |
157 | 162 | with open(args.cmake_out, "w", encoding="utf-8") as cmake_file: |
158 | | - print('add_custom_target(devicetree_target)', file=cmake_file) |
159 | | - print(file=cmake_file) |
160 | | - |
161 | | - for prop in cmake_props: |
162 | | - print( |
163 | | - f'set_target_properties(devicetree_target PROPERTIES {prop})', |
164 | | - file=cmake_file |
165 | | - ) |
| 163 | + print('add_custom_target(${DEVICETREE_TARGET})\n', *cmake_props, |
| 164 | + sep='\n', file=cmake_file) |
166 | 165 |
|
167 | 166 |
|
168 | 167 | if __name__ == "__main__": |
|
0 commit comments