Browse Source

fix dependencies (again)

The dependencies should be between targets, not between commands and files.
Target dependencies on commands are not what they seem to be, and don't work.

Also see question, answer and comments on https://stackoverflow.com/questions/4010212/cmake-struggling-with-add-custom-command-dependencies
Maarten van der Schrieck 1 year ago
parent
commit
8bfef475ed
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      CMakeLists.txt

+ 3
- 3
CMakeLists.txt View File

141
 	# Build the bootloader with the sections to fill in
141
 	# Build the bootloader with the sections to fill in
142
 	pico_set_linker_script(picowota ${PICOWOTA_SRC_DIR}/bootloader_shell.ld)
142
 	pico_set_linker_script(picowota ${PICOWOTA_SRC_DIR}/bootloader_shell.ld)
143
 
143
 
144
-	add_custom_target(${NAME}_hdr DEPENDS ${NAME})
145
-	add_custom_command(TARGET ${NAME}_hdr DEPENDS ${NAME} picowota
144
+	add_custom_target(${NAME}_hdr DEPENDS ${NAME} picowota)
145
+	add_custom_command(TARGET ${NAME}_hdr
146
 		COMMAND ${PICOWOTA_SRC_DIR}/gen_imghdr.py --map ${PICOWOTA_BIN_DIR}/picowota.elf.map --section .app_bin ${APP_BIN} ${APP_HDR_BIN}
146
 		COMMAND ${PICOWOTA_SRC_DIR}/gen_imghdr.py --map ${PICOWOTA_BIN_DIR}/picowota.elf.map --section .app_bin ${APP_BIN} ${APP_HDR_BIN}
147
 	)
147
 	)
148
 
148
 
149
 	add_custom_target(${COMBINED} ALL)
149
 	add_custom_target(${COMBINED} ALL)
150
 	add_dependencies(${COMBINED} picowota ${NAME}_hdr)
150
 	add_dependencies(${COMBINED} picowota ${NAME}_hdr)
151
-	add_custom_command(TARGET ${COMBINED} DEPENDS ${NAME}_hdr
151
+	add_custom_command(TARGET ${COMBINED}
152
 		COMMAND ${CMAKE_OBJCOPY}
152
 		COMMAND ${CMAKE_OBJCOPY}
153
 			--update-section .app_hdr=${APP_HDR_BIN}
153
 			--update-section .app_hdr=${APP_HDR_BIN}
154
 			--update-section .app_bin=${APP_BIN} ${PICOWOTA_BIN_DIR}/picowota.elf ${COMBINED}.elf
154
 			--update-section .app_bin=${APP_BIN} ${PICOWOTA_BIN_DIR}/picowota.elf ${COMBINED}.elf

Loading…
Cancel
Save