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