You cannot do "cmake-ish" things in the CPACK_PROJECT_CONFIG_FILE.<br><br>Neither install commands nor set_target_properties calls do anything in this context.<br><br><br><br><div class="gmail_quote">On Tue, Feb 15, 2011 at 9:36 AM, Daryl N <span dir="ltr"><<a href="mailto:darylhouse2004@yahoo.com">darylhouse2004@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><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. Yes, cpack_config.cmake is my CPACK_PROJECT_CONFIG_FILE. For rpath, here is what I have in the cpack config file:<br>
<br>if (${CPACK_GENERATOR} STREQUAL "TGZ")<div class="im"><br> set(CPACK_SET_DESTDIR OFF)<br> set(CMAKE_INSTALL_RPATH ".")<br></div>
set_target_properties(npManager<br>
PROPERTIES INSTALL_RPATH ".")<br>
elseif (${CPACK_GENERATOR} STREQUAL "DEB")<br> set(CPACK_SET_DESTDIR ON)<br> set(CMAKE_INSTALL_RPATH "/usr/local/<some folder>")<br>
set_target_properties(npManager<br>
PROPERTIES INSTALL_RPATH "/usr/local/<some folder>")<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/<some folder> in my main CMakeLists.txt file and it stays that way in TGZ even with the sets above. For the TGZ file I want to be able to unpack it and then just run it locally. 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. And then that would be part of the rpath for the DEB package too. Sounds like 2 build cycles may be needed.<br>
<br>Daryl<b><span style="font-weight: bold;"><br><br>From:</span></b> Eric Noulard <<a href="mailto:eric.noulard@gmail.com" target="_blank">eric.noulard@gmail.com</a>><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 <<a href="mailto:darylhouse2004@yahoo.com" target="_blank">darylhouse2004@yahoo.com</a>><br><b><span style="font-weight: bold;">Cc:</span></b>
<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a><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><div><div></div><div class="h5"><br>
2011/2/15 Daryl N <<a href="mailto:darylhouse2004@yahoo.com" target="_blank">darylhouse2004@yahoo.com</a>>:<br>> Hi,<br>><br>> I have a question on the use of CPack. I have CMake setup to generate<br>> binaries and shared libraries. Up until now I have only created a TGZ with<br>
> rpath set to ".". This has worked nicely, but now I would like to create a<br>> Debian package for proper installation. I have added DEB to CPACK_GENERATOR<br>> and I've created my own cpack_config.cmake file. My goal is:<br>
><br>> 1. Run cmake/make package once and create the tar.gz file with all exe/libs<br>> in the root folder of the tar.gz file with rpath set to ".".<br>> 2. Create new .deb package with exes in /usr/local/bin and libs in<br>
> /usr/local/lib. Alternatively, since files are private, all could be put in<br>> /usr/local/<some folder>.<br>><br>>
I've attempted this by creating my own cpack_config.cmake file to try to<br>> override some settings per generator. Some observations:<br>><br>> 1. I've been unable to set the install(<target> DESTINATION) path per<br>
> generator in my cpack_config.cmake file. Whatever the variable is set to<br>> when the install(...) is processed in the CMakeLists.txt file is what is<br>> used for all generators. Just want to confirm changing this isn't an option<br>
> per generator.<br>><br>> The above has prevented me from having my install lines like:<br>> install(<target> DESTINATION ${BIN_PATH})<br>> install(<target> DESTINATION ${LIB_PATH})<br>
> and then setting BIN_PATH to bin and LIB_PATH to lib for DEB, but setting<br>> them to "." for TGZ, since I can't change the variable in<br>> .<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> set(CMAKE_INSTALL_RPATH ".")<br> set(CPACK_SET_DESTDIR "OFF")<br>endif(CPACK_GENERATOR MATCHES "TGZ")<br>
<br>if(CPACK_GENERATOR MATCHES "DEB")<br> set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local/<somefolder>")<br>endif(CPACK_GENERATOR MATCHES "DEB")<br><br>> 2. I would also like to set the rpath per generator. So the targets in the<br>
> TGZ only look in "." while the
DEB installed targets only look in<br>> /usr/local/<some folder>. But I haven't been able to update the rpath per<br>> generator in cpack_config.cmake. I've tried both setting<br>> CMAKE_INSTALL_RPATH and using set_target_properties(... PROPERTIES<br>
> INSTALL_RPATH). 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 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>>Do I need to run cpack<br>
> separately changing the variables before hand? I suppose that would mean 2<br>> 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 href="http://www.april.org" target="_blank">http://www.april.org</a></span><br>
</div></div></div></div>
</div><br>
</div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br>