cmake how to use scp command to transport bin file to another linux board

how to use cmake file generated makefile scp conmand?

makefile like this
upload:
scp $(TARGET) orangepi@192.168.8.105:/home/orangepi/sgai

It seems you want to send the output of some target to another machine?

add_custom_command(
  DEPENDS "${target}"
  OUTPUT "${output}"
  COMMAND scp "$<TARGET_FILE:${target}>" "${destination}"
  COMMAND "${CMAKE_COMMAND}" -E touch "${output}")
add_custom_target("send-${target}" DEPENDS "${output}")

cmake:write like this blow

set(target sgai.txt)
set(output /home/orangepi/sgai)
set(destination orangepi@192.168.8.105)
add_custom_command(
DEPENDS “${target}”
OUTPUT “${output}”
COMMAND scp “$<TARGET_FILE:${target}>” “${destination}”
COMMAND “${CMAKE_COMMAND}” -E touch “${output}”)
add_custom_target(“send-${target}” DEPENDS “${output}”)

equals blow???
makefile:

upload:
scp sgai.txt orangepi@192.168.8.105:/home/orangepi/sgai

output should be some unique file that indicates “this upload was performed”. destination should be orangepi@ipaddress:/path/on/remote.

upload:
scp sgai.txt orangepi@192.168.8.105:/home/orangepi/sgai

I want to use command"make upload" to achieve “scp sgai.txt orangepi@192.168.8.105:/home/orangepi/sgai”,how should I encode my cmakefile?thanks!!!

set(target sgai)
set(destination orangepi@192.168.8.105:/home/orangepi/sgai)
message(STATUS “destination: ${destination}”)
add_custom_target(upload
POST_BUILD
COMMAND scp “$<TARGET_FILE:${target}>” “${destination}”

generated:

#=============================================================================

Target rules for targets named upload

Build rule for target.

upload: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 upload
.PHONY : upload

fast build rule for target.

upload/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/upload.dir/build.make CMakeFiles/upload.dir/build
.PHONY : upload/fast

#============================================================================

is this right?

set(target upload)
set(output sgai)
set(destination orangepi@192.168.8.105:/home/orangepi/sgai)

add_custom_command(
DEPENDS “${target}”
OUTPUT “${output}”
COMMAND scp “$<TARGET_FILE:${target}>” “${destination}”
COMMAND “${CMAKE_COMMAND}” -E touch “${output}”)
add_custom_target("${target}" DEPENDS “${output}”)

is this right?

hello,
COMMAND SCP “$<TARGET_FILE:${target}>” “${destination}”
cmake version 3.18.0 version assist SCP command?

add_custom_target(upload
DEPENDS

  COMMAND scp /home/dji/SGAI_3399/sgai-main/build/log.c
  orangepi@192.168.8.105:/home/orangepi/log.c
  COMMAND ${CMAKE_COMMAND} -E echo "send finish"

)

hello,dose cmake add_custom_target COMMAND sopport SCP cmd transport file?

add_custom_target(upload
DEPENDS
COMMAND scp ${PROJECT_NAME} ${destination}
COMMAND ${CMAKE_COMMAND} -E echo “transport finish”
)

have solveld,thanks!