Browse Source

Merge pull request #12 from thingsconnected/pullreq1

CMakeLists.txt: let picowota_build_combined add files to clean target
Brian Starkey 1 year ago
parent
commit
d0772ec9be
No account linked to committer's email address
1 changed files with 11 additions and 1 deletions
  1. 11
    1
      CMakeLists.txt

+ 11
- 1
CMakeLists.txt View File

@@ -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()

Loading…
Cancel
Save