Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cmake "make install" to remote machine?

With make install I can copy my binaries, configs etcetera to a target folder for execution.

Now I have the following situation: we have a virtual machine setup as a build host, and a different real Linux machine as a target platform.

I would like to have make install copy the files directly in a folder on my remote machine (via scp or similar). How can I achieve that?

like image 863
Danoo Avatar asked Jan 23 '12 11:01

Danoo


2 Answers

You often could do

 make install DESTDIR=/tmp/mydest/

then archive that destination directory

 tar czvf /tmp/mydest.tgz -C /tmp mydest

then copy that archive to the remote place

 scp /tmp/mydest.tgz remote:tmp/

at last, untar the archive at the remote and copy it at appropriate place

like image 61
Basile Starynkevitch Avatar answered Sep 20 '22 18:09

Basile Starynkevitch


I am using this solution:

install (CODE "execute_process(COMMAND scp -r -i /home/user/.ssh/id_rsa ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/. user@remote:/path/to/copy/)")

Then I run command make install and it's works

I know that ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} not best variable for it but for me it's fine

like image 25
user2493102 Avatar answered Sep 17 '22 18:09

user2493102