Bladeren bron

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 1 jaar geleden
bovenliggende
commit
f8e0269740
1 gewijzigde bestanden met toevoegingen van 11 en 1 verwijderingen
  1. 11
    1
      CMakeLists.txt

+ 11
- 1
CMakeLists.txt Bestand weergeven

@@ -130,6 +130,11 @@ function(picowota_build_combined NAME)
130 130
 	get_target_property(PICOWOTA_SRC_DIR picowota SOURCE_DIR)
131 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 138
 	# The app must be built with the correct linker script (and a .bin)
134 139
 	picowota_build_standalone(${NAME})
135 140
 
@@ -149,6 +154,8 @@ function(picowota_build_combined NAME)
149 154
 			--update-section .app_hdr=${APP_HDR_BIN}
150 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 160
 	add_custom_command(TARGET ${COMBINED} POST_BUILD
154 161
 		COMMAND ${CMAKE_OBJCOPY} -Obinary ${COMBINED}.elf ${COMBINED}.bin
@@ -161,6 +168,9 @@ function(picowota_build_combined NAME)
161 168
 	if (ELF2UF2_FOUND)
162 169
 		add_custom_command(TARGET ${COMBINED} POST_BUILD
163 170
 			COMMAND ELF2UF2 ${COMBINED}.elf ${COMBINED}.uf2
164
-	)
171
+		)
172
+		list(APPEND clean_files ${COMBINED}.uf2)
165 173
 	endif()
174
+
175
+	set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${clean_files}")
166 176
 endfunction()

Laden…
Annuleren
Opslaan