<div dir="ltr">2017-02-09 12:08 GMT+01:00 Martin Craig <span dir="ltr"><<a href="mailto:martin.craig@eng.ox.ac.uk" target="_blank">martin.craig@eng.ox.ac.uk</a>></span>:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div>
<div style="direction:ltr;font-family:tahoma;color:rgb(0,0,0);font-size:10pt">Hi, got this problem which I've boiled down to a simple test case. My source dir contains just one file (realfile) and the installation should install this in bin and make a symlink
 from linkfile to it. This is the CMakeLists.txt file:
<div><br>
</div>
<div>
<div>    cmake_minimum_required(VERSION 2.8.0)</div>
<div><br>
</div>
<div>    INSTALL(FILES realfile DESTINATION bin)</div>
<div>    INSTALL(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink realfile ${CMAKE_INSTALL_PREFIX}/bin/<wbr>linkfile)")</div>
</div></div></div></blockquote><div><br>You could do it in two separate steps and without absolute path:<br><br>execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../some_relative_path/bin/realfile linkfile) # at this point path doesn't need to point to the location of existing file<br>install(FILES ${CMAKE_CURRENT_BINARY_DIR}/linkfile DESTINATION some_relative_path COMPONENT libraries)<br><br></div><div>Not certain which CPack package generator you're using but in case of CPackRPM there is quite some automated handling of symlink paths (even support for symlinks in relocatable rpm packages).<br><br></div><div>In this file are some examples of using symlinks in combination with CPackRPM (never checked how they behave with other CPack package generators though...):<br><br><a href="https://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/CPackComponentsForAll/CMakeLists.txt;h=344084317166ff4f62850ed77807af2647db6d6a;hb=HEAD">https://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/CPackComponentsForAll/CMakeLists.txt;h=344084317166ff4f62850ed77807af2647db6d6a;hb=HEAD</a><br><br></div><div>Side note - during packaging CPACK_PACKAGING_INSTALL_PREFIX is used instead of CMAKE_INSTALL_PREFIX.</div><div><br></div><div>Regards,<br></div><div>Domen<br></div></div></div></div>