Selaa lähdekoodia

CMakeLists.txt: let picowota_build_combined add files to clean target

We observed strange issues that (among other things) revealed that make clean
did not really make things as clean as it could. This is an attempt to clean up
various files generated.
Maarten van der Schrieck 7 kuukautta sitten
vanhempi
commit
f8e0269740
1 muutettua tiedostoa jossa 11 lisäystä ja 1 poistoa
  1. 11
    1
      CMakeLists.txt

+ 11
- 1
CMakeLists.txt Näytä tiedosto

130
 	get_target_property(PICOWOTA_SRC_DIR picowota SOURCE_DIR)
130
 	get_target_property(PICOWOTA_SRC_DIR picowota SOURCE_DIR)
131
 	get_target_property(PICOWOTA_BIN_DIR picowota BINARY_DIR)
131
 	get_target_property(PICOWOTA_BIN_DIR picowota BINARY_DIR)
132
 
132
 
133
+	get_directory_property(initial_clean ADDITIONAL_MAKE_CLEAN_FILES)
134
+	list(APPEND clean_files ${initial_clean})
135
+	list(APPEND clean_files ${APP_BIN})
136
+	list(APPEND clean_files ${APP_HDR_BIN})
137
+
133
 	# The app must be built with the correct linker script (and a .bin)
138
 	# The app must be built with the correct linker script (and a .bin)
134
 	picowota_build_standalone(${NAME})
139
 	picowota_build_standalone(${NAME})
135
 
140
 
149
 			--update-section .app_hdr=${APP_HDR_BIN}
154
 			--update-section .app_hdr=${APP_HDR_BIN}
150
 			--update-section .app_bin=${APP_BIN} ${PICOWOTA_BIN_DIR}/picowota.elf ${COMBINED}.elf
155
 			--update-section .app_bin=${APP_BIN} ${PICOWOTA_BIN_DIR}/picowota.elf ${COMBINED}.elf
151
 	)
156
 	)
157
+	list(APPEND clean_files ${COMBINED}.bin)
158
+	list(APPEND clean_files ${COMBINED}.elf)
152
 
159
 
153
 	add_custom_command(TARGET ${COMBINED} POST_BUILD
160
 	add_custom_command(TARGET ${COMBINED} POST_BUILD
154
 		COMMAND ${CMAKE_OBJCOPY} -Obinary ${COMBINED}.elf ${COMBINED}.bin
161
 		COMMAND ${CMAKE_OBJCOPY} -Obinary ${COMBINED}.elf ${COMBINED}.bin
161
 	if (ELF2UF2_FOUND)
168
 	if (ELF2UF2_FOUND)
162
 		add_custom_command(TARGET ${COMBINED} POST_BUILD
169
 		add_custom_command(TARGET ${COMBINED} POST_BUILD
163
 			COMMAND ELF2UF2 ${COMBINED}.elf ${COMBINED}.uf2
170
 			COMMAND ELF2UF2 ${COMBINED}.elf ${COMBINED}.uf2
164
-	)
171
+		)
172
+		list(APPEND clean_files ${COMBINED}.uf2)
165
 	endif()
173
 	endif()
174
+
175
+	set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${clean_files}")
166
 endfunction()
176
 endfunction()

Loading…
Peruuta
Tallenna