<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Sorry, don't know how to reply inline with this editor.&nbsp; Yes, cpack_config.cmake is my CPACK_PROJECT_CONFIG_FILE.&nbsp; For rpath, here is what I have in the cpack config file:<br><br>if (${CPACK_GENERATOR} STREQUAL "TGZ")<br>&nbsp;&nbsp;&nbsp; set(CPACK_SET_DESTDIR OFF)<br>&nbsp;&nbsp;&nbsp; set(CMAKE_INSTALL_RPATH ".")<br>
&nbsp;&nbsp;&nbsp; set_target_properties(npManager<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PROPERTIES INSTALL_RPATH ".")<br>
elseif (${CPACK_GENERATOR} STREQUAL "DEB")<br>&nbsp;&nbsp;&nbsp; set(CPACK_SET_DESTDIR ON)<br>&nbsp; &nbsp; set(CMAKE_INSTALL_RPATH "/usr/local/&lt;some folder&gt;")<br>

&nbsp;&nbsp;&nbsp; set_target_properties(npManager<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PROPERTIES INSTALL_RPATH "/usr/local/&lt;some folder&gt;")<br>
endif ()<br><br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">CMAKE_INSTALL_RPATH was initially set to /user/local/&lt;some folder&gt; in my main CMakeLists.txt file and it stays that way in TGZ even with the sets above.&nbsp; For the TGZ file I want to be able to unpack it and then just run it locally.&nbsp; If I use the bin/lib folder structure in the TGZ, then I would need to set rpath to "../lib" for them to be found.&nbsp; And then that would be part of the rpath for the DEB package too.&nbsp; Sounds like 2 build cycles may be needed.<br><br>Daryl<b><span style="font-weight: bold;"><br><br>From:</span></b> Eric Noulard &lt;eric.noulard@gmail.com&gt;<br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font face="Tahoma" size="2"><b><span style="font-weight: bold;">To:</span></b> Daryl N &lt;darylhouse2004@yahoo.com&gt;<br><b><span style="font-weight: bold;">Cc:</span></b>
 cmake@cmake.org<br><b><span style="font-weight: bold;">Sent:</span></b> Tue, February 15, 2011 4:00:17 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [CMake] Setting target destination and rpath per generator<br></font><br>
2011/2/15 Daryl N &lt;<a ymailto="mailto:darylhouse2004@yahoo.com" href="mailto:darylhouse2004@yahoo.com">darylhouse2004@yahoo.com</a>&gt;:<br>&gt; Hi,<br>&gt;<br>&gt; I have a question on the use of CPack.&nbsp; I have CMake setup to generate<br>&gt; binaries and shared libraries.&nbsp; Up until now I have only created a TGZ with<br>&gt; rpath set to ".".&nbsp; This has worked nicely, but now I would like to create a<br>&gt; Debian package for proper installation.&nbsp; I have added DEB to CPACK_GENERATOR<br>&gt; and I've created my own cpack_config.cmake file.&nbsp; My goal is:<br>&gt;<br>&gt; 1. Run cmake/make package once and create the tar.gz file with all exe/libs<br>&gt; in the root folder of the tar.gz file with rpath set to ".".<br>&gt; 2. Create new .deb package with exes in /usr/local/bin and libs in<br>&gt; /usr/local/lib.&nbsp; Alternatively, since files are private, all could be put in<br>&gt; /usr/local/&lt;some folder&gt;.<br>&gt;<br>&gt;
 I've attempted this by creating my own cpack_config.cmake file to try to<br>&gt; override some settings per generator.&nbsp; Some observations:<br>&gt;<br>&gt; 1. I've been unable to set the install(&lt;target&gt; DESTINATION) path per<br>&gt; generator in my cpack_config.cmake file.&nbsp; Whatever the variable is set to<br>&gt; when the install(...) is processed in the CMakeLists.txt file is what is<br>&gt; used for all generators.&nbsp; Just want to confirm changing this isn't an option<br>&gt; per generator.<br>&gt;<br>&gt; The above has prevented me from having my install lines like:<br>&gt; &nbsp; &nbsp; install(&lt;target&gt; DESTINATION ${BIN_PATH})<br>&gt; &nbsp; &nbsp; install(&lt;target&gt; DESTINATION ${LIB_PATH})<br>&gt; and then setting BIN_PATH to bin and LIB_PATH to lib for DEB, but setting<br>&gt; them to "." for TGZ, since I can't change the variable in<br>&gt; .<br><br>I suppose cpack_config.cmake is your
 CPACK_PROJECT_CONFIG_FILE.<br>As far as I know you cannot change install rules on "CPack generator basis".<br><br>install rules belongs to CMakeLists.txt and they are evaluated at CMake-time<br>(not CPack-time).<br><br>cpack_config.cmake is evaluated at CPack-time, i.e. when CPack runs.<br>You can do CPack-generator specific actions in this file.<br>(like setting CPACK_SET_DESTDIR OFF or ON or changing<br> CPACK_PACKAGING_INSTALL_PREFIX etc...)<br><br>I did not tried playing with rpath but may be you can<br><br>if(CPACK_GENERATOR MATCHES "TGZ")<br>&nbsp; set(CMAKE_INSTALL_RPATH ".")<br>&nbsp; set(CPACK_SET_DESTDIR&nbsp; "OFF")<br>endif(CPACK_GENERATOR MATCHES "TGZ")<br><br>if(CPACK_GENERATOR MATCHES "DEB")<br>&nbsp; set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local/&lt;somefolder&gt;")<br>endif(CPACK_GENERATOR MATCHES "DEB")<br><br>&gt; 2. I would also like to set the rpath per generator.&nbsp; So the targets in the<br>&gt; TGZ only look in "." while the
 DEB installed targets only look in<br>&gt; /usr/local/&lt;some folder&gt;.&nbsp; But I haven't been able to update the rpath per<br>&gt; generator in cpack_config.cmake.&nbsp; I've tried both setting<br>&gt; CMAKE_INSTALL_RPATH and using set_target_properties(... PROPERTIES<br>&gt; INSTALL_RPATH).&nbsp; Again, I'm assuming this can't be changed at CPack time.<br><br>I don't know whether if CMAKE_INSTALL_RPATH can be changed at CPack time<br>(as I suggested in my previous example) you'll have to try and<br>may be verify in the CMake source code in order to check&nbsp; when it is handled.<br>Whatever the current status,<br>I don't see why it couldn't be handled at CPack time<br>(but I may be missing something).<br><br>&gt;Do I need to run cpack<br>&gt; separately changing the variables before hand?&nbsp; I suppose that would mean 2<br>&gt; builds cycles also, once for each generator.<br><br>2 build cycles will definitely work.<br><br>However if you gives
 us more information on what's inside your<br>"cpack_config.cmake"<br>what works what does not work with it, may be we can see if it it can<br>be done in a single build.<br><br>I think the main issue is the fact that as far as I understand your<br>need you want<br>to put all files (libs, exe) in a single folder for the TGZ and have<br>prefix+/lib, prefix+/bin<br>in the DEB case?<br><br>Changing the prefix is easy but adding (or removing) the extra /lib<br>and /bin I don't<br>currently know how to do that. Why won't you keep the lib and bin<br>suffix in the TGZ case?<br><br><br>-- <br>Erk<br>Membre de l'April - « promouvoir et défendre le logiciel libre » -<br><span><a target="_blank" href="http://www.april.org">http://www.april.org</a></span><br></div></div>
</div><br>







      </body></html>