Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit a628889

Browse files
committed
Modified upload command to target
Also renamed function `upload_arduino_target` to `set_target_upload_port`.
1 parent 7c99deb commit a628889

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

cmake/Platform/Targets/UploadTarget.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
# _target_name - Name of the target (Executable) to upload.
44
# _port - Serial port on the host system used to upload/flash the connected Arduino board.
55
#=============================================================================#
6-
function(upload_arduino_target _target_name _port)
6+
function(set_target_upload_port _target_name _port)
77

88
if ("${_target_name}" STREQUAL "")
99
message(FATAL_ERROR "Can't create upload target for an invalid target ${_target_name}")
1010
endif ()
1111

1212
set_upload_target_flags(${_target_name} ${_port} upload_args)
1313

14-
add_custom_command(TARGET ${_target_name} POST_BUILD
15-
COMMAND ${ARDUINO_CMAKE_AVRDUDE_PROGRAM}
16-
ARGS ${upload_args}
17-
COMMENT "Uploading ${_target_name} target"
18-
DEPENDS ${_target_name})
14+
add_custom_target(${_target_name}_flash
15+
COMMAND ${ARDUINO_CMAKE_AVRDUDE_PROGRAM} ${upload_args}
16+
COMMENT "Uploading ${_target_name} target")
17+
18+
add_dependencies(${_target_name}_flash ${_target_name})
1919

2020
endfunction()
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
cmake_minimum_required(VERSION 3.8.2)
22

33
project(Hello_World)
4-
#get_board_id(board_id nano atmega328)
54

6-
arduino_cmake_project(Hello_World BOARD_NAME nano BOARD_CPU atmega328)
5+
arduino_cmake_project(Hello_World BOARD_NAME nano BOARD_CPU atmega328old)
76

8-
add_arduino_executable(Hello_World ${board_id} helloWorld.cpp)
7+
add_arduino_executable(Hello_World helloWorld.cpp)
98

10-
#upload_arduino_target(Hello_World "${board_id}" COM3)
9+
set_target_upload_port(Hello_World COM3)

0 commit comments

Comments
 (0)