On Sat, Aug 7, 2010 at 11:55 AM, Chris Wolf <span dir="ltr">&lt;<a href="mailto:cw10025@gmail.com">cw10025@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><br>
<br>
On 8/7/10 11:22 AM, David Cole wrote:<br>
&gt; On Sat, Aug 7, 2010 at 11:02 AM, Chris Wolf &lt;<a href="mailto:cw10025@gmail.com">cw10025@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On 8/7/10 9:44 AM, David Cole wrote:<br>
&gt;&gt;&gt; On Sat, Aug 7, 2010 at 9:26 AM, Chris Wolf &lt;<a href="mailto:cw10025@gmail.com">cw10025@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On 8/7/10 7:14 AM, Eric Noulard wrote:<br>
&gt;&gt;&gt;&gt;&gt; 2010/8/7 Chris Wolf &lt;<a href="mailto:cw10025@gmail.com">cw10025@gmail.com</a>&gt;:<br>
&gt;&gt;&gt;&gt;&gt;&gt; On 8/6/10 8:55 PM, Eric Noulard wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Did you try the command line?<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; cpack -D CPACK_PACKAGING_INSTALL_PREFIX=&quot;/opt&quot; -G DEB<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; it works for me.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; if it works for you may be<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; CPACK_PACKAGING_INSTALL_PREFIX is set to late<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; in the CMakeLists.txt?<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Yes, I tried that about 8 hours ago:<br>
&gt;&gt;&gt;&gt; <a href="http://www.cmake.org/pipermail/cmake/2010-August/038785.html" target="_blank">http://www.cmake.org/pipermail/cmake/2010-August/038785.html</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; I have to say NOW it&#39;s working.  Sorry - I suppose I was changing too<br>
&gt;&gt;&gt;&gt; many things at one back then<br>
&gt;&gt;&gt;&gt;&gt;&gt; and I was missing something.<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Ok, this issue is resolved, thank you.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Good to know.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; [...]<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Sorry to beat a &quot;deadhorse&quot;, since I see this has already been<br>
&gt;&gt;&gt;&gt; discussed:<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://www.mail-archive.com/cmake@cmake.org/msg16180.html" target="_blank">http://www.mail-archive.com/cmake@cmake.org/msg16180.html</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; I think that guy had a good proposal - being able to control path<br>
&gt;&gt;&gt;&gt; prefixes<br>
&gt;&gt;&gt;&gt;&gt;&gt; at a per/generator level.  I guess for now, I can just run cpack<br>
&gt;&gt;&gt;&gt; multiple<br>
&gt;&gt;&gt;&gt;&gt;&gt; times with path/generator options on the command line.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; I think you are right, command line is the current best way to go.<br>
&gt;&gt;&gt;&gt;&gt; Now having a Generator Specific<br>
&gt;&gt;&gt;&gt;&gt; CPACK_&lt;GEN&gt;_PACKAGING_INSTALL_PREFIX<br>
&gt;&gt;&gt;&gt;&gt; wouldn&#39;t be that difficult to implement.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Now when enough [wo]man power will be given in<br>
&gt;&gt;&gt;&gt;&gt; <a href="http://public.kitware.com/Bug/view.php?id=7000" target="_blank">http://public.kitware.com/Bug/view.php?id=7000</a><br>
&gt;&gt;&gt;&gt;&gt; this can be discussed.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Re-read the bug comments and may be add your ideas there.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; And I do not think the horse is dead, we are merely waiting<br>
&gt;&gt;&gt;&gt;&gt; for a jockey for ridding bug #7000 :-)<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Ok, I added a note to this bug with an example proposed code change.  If<br>
&gt;&gt; it<br>
&gt;&gt;&gt;&gt; looks good, I can try it myself and if it works I can submit patches.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Let me know, thanks,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt; You can already do what you propose with that change today: in a<br>
&gt;&gt;&gt; CPACK_PROJECT_CONFIG_FILE<br>
&gt;&gt;&gt; file. (Without making any C++ changes and without waiting for resolution<br>
&gt;&gt; of<br>
&gt;&gt;&gt; issue #7000...).<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Inside that file, you can inspect the value of CPACK_GENERATOR and<br>
&gt;&gt;&gt; set/override other CPACK_* variables. In this case, you would have as<br>
&gt;&gt; many<br>
&gt;&gt;&gt; if() blocks as needed to set CPACK_PACKAGING_INSTALL_PREFIX to whatever<br>
&gt;&gt;&gt; value you want for each generator.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The CPACK_PROJECT_CONFIG_FILE file is included *at cpack time* and is<br>
&gt;&gt;&gt; intended to give you the hook you need to do generator specific stuff.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Perhaps the proposed change is still a good one and would make this task<br>
&gt;&gt;&gt; easier. Although it seems silly to me to invent a bunch of new variables<br>
&gt;&gt;&gt; when there&#39;s already a technique that could be used to achieve the task<br>
&gt;&gt;&gt; today. We already, as you have observed, have enough &quot;prefix&quot; variables<br>
&gt;&gt;&gt; floating around. I&#39;m not sure adding more is the way to go.<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; To try to understand your approach, I created a file,<br>
&gt;&gt; &quot;MyCpackConfig.cmake&quot;,<br>
&gt;&gt; which looks like:<br>
&gt;&gt;<br>
&gt;&gt; # keep cmake-generated settings<br>
&gt;&gt; include(CPackConfig.cmake)<br>
&gt;&gt;<br>
&gt;&gt; if(&quot;${CPACK_GENERATOR}&quot; STREQUAL &quot;PackageMaker&quot;)<br>
&gt;&gt;   set(CPACK_PACKAGING_INSTALL_PREFIX &quot;/tmp/local&quot;)<br>
&gt;&gt; endif(&quot;${CPACK_GENERATOR}&quot; STREQUAL &quot;PackageMaker&quot;)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ...then I invoke like:<br>
&gt;&gt;<br>
&gt;&gt; cpack --config MyCpackConfig.cmake<br>
&gt;&gt;<br>
&gt;&gt; ...and yet, the results show that CPACK_PACKAGING_INSTALL_PREFIX was not<br>
&gt;&gt; overriden for PackageMaker.  I am at a loss here...<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt; You do not need to include(CPackConfig.cmake) -- and, in fact, you<br>
&gt; shouldn&#39;t.<br>
&gt;<br>
&gt; Since you did include it, it has CPACK_GENERATOR defined to a list from<br>
&gt; CPackConfig.cmake, rather than cpack&#39;s internal definition. (So it&#39;s never<br>
&gt; equalling PackageMaker...) So you&#39;re not seeing your override take effect...<br>
&gt;<br>
&gt; The CPACK_PROJECT_CONFIG_FILE is included automatically on a per-generator<br>
&gt; basis. It only need contain overrides.<br>
&gt;<br>
&gt; Here&#39;s how it goes:<br>
&gt; - cpack runs<br>
&gt; - it includes CPackConfig.cmake<br>
&gt; - iterates over the generators listed in that file&#39;s CPACK_GENERATOR (unless<br>
&gt; told to use just a specific one via -G on the command line...)<br>
&gt; --- foreach generator, it then<br>
&gt;   - sets CPACK_GENERATOR to the one currently being iterated<br>
&gt;   - includes the CPACK_PROJECT_CONFIG_FILE<br>
&gt;   - produces the package for that generator<br>
&gt;<br>
&gt; This is the key: For each generator listed in CPACK_GENERATOR in<br>
&gt; CPackConfig.cmake, cpack will *reset* CPACK_GENERATOR internally to *the one<br>
&gt; currently being used* and then include the CPACK_PROJECT_CONFIG_FILE.<br>
&gt;<br>
&gt; As I said before, it&#39;s somewhat confusing, but once you get it, it does make<br>
&gt; sense.<br>
&gt;<br>
&gt; So, to recap:<br>
&gt; -- do not include CPackConfig in your CPACK_PROJECT_CONFIG_FILE<br>
&gt; -- just run &quot;cpack&quot; on the command line<br>
&gt;<br>
&gt; I hope this gets you over the finish line, now. ;-)<br>
&gt;<br>
&gt;<br>
&gt; David<br>
&gt;<br>
<br>
</div></div>Ok, now *that* explanation did the job - thanks!<br>
<br>
I was under the impression that CPACK_PROJECT_CONFIG_FILE was going to<br>
*replace* the cmake-generated CPackConfig.cmake and that it would only<br>
be referenced once for all the cpack generators.<br>
<br>
Unless I missed it, I would recommend putting this latest explanation<br>
from you in a Wiki page.<br>
<br>
Thanks again,<br>
<font color="#888888"><br>
  -Chris<br>
</font></blockquote></div><div><br></div><br><div>Excellent! I am now officially done for the weekend. :-)</div><div><br></div><div>Would you recommend a certain location on the Wiki? i.e. -- were you looking someplace for this, and found a place where you think such an explanation should go...? I&#39;ll be happy to add this to the Wiki, but frequently, I&#39;m not sure where to link stuff from. If I knew around where you were looking, maybe that would be the right place to link from to get to the new Wiki page.</div>
<div><br></div><div>If you give me a hint about where, I&#39;ll add this to the Wiki next week sometime.</div><div><br></div><div>Thanks,</div><div>David</div><div><br></div>