This PR fixes problems when using add_avr_executable more than once by disambiguating targets with the same name.
Currently, when adding several images, you get:
Make Error at generic-gcc-avr.cmake:224 (add_custom_target):
add_custom_target cannot create target "upload_eeprom" because another
target with the same name already exists. The existing target is a custom
target created in source directory "...".
See documentation for policy CMP0002 for more details.
The problem was solved in several steps:
The target upload_eeprom was renamed upload_${EXECUTABLE_NAME}_eeprom
The targets get_status, get_fuses, set_fuses, get_calibration, and set_calibration were moved inside a new function, since they are stand-alone and don't depend on the executable target. The user has to explicitly call avr_generate_fixed_targets().
This PR fixes problems when using
add_avr_executable
more than once by disambiguating targets with the same name.Currently, when adding several images, you get:
The problem was solved in several steps:
upload_eeprom
was renamedupload_${EXECUTABLE_NAME}_eeprom
get_status
,get_fuses
,set_fuses
,get_calibration
, andset_calibration
were moved inside a new function, since they are stand-alone and don't depend on the executable target. The user has to explicitly callavr_generate_fixed_targets()
.Please note that this PR changes the usage.