<div dir="ltr"><div>+1 for Mathews solution. To bad it's just on the developers list. <br><br></div>I will simply cite him:<br><pre>On 2013-11-04 15:47, David Cole wrote:
>><i> My question is still not answered completely:
</i>>><i>
</i>>><i> When should the new variable be added? On startup is not really
</i>>><i> possible because it might be the case that your src/binary directory
</i>>><i> is not set properly.
</i>>><i>
</i>>><i> So you would agree that it makes sense to do it "on configure" but
</i>>><i> only if the cache is empty? This will not allow to overwrite the
</i>>><i> variable via parameter but I guess that usecase is not very
</i>>><i> common?
</i>><i>
</i>><i> On startup is the only time it does make sense. After that, the user
</i>><i> should be in charge, and the command line settings should not be
</i>><i> re-applied again after a user makes an edit. You don't need the
</i>><i> src/binary directories set properly necessarily in order to add a cache
</i>><i> entry to the UI.
</i>
There are two mostly separate issues here.
As far as the bug, the ccmake behavior is (IMO, but seems generally
shared) is just wrong. physhh's questions (above) don't apply to this
case because there is no concept of interactively selecting the build
directory in ccmake. So fixing this is, if not easy, at least easy to
understand how it should behave.
As far as cmake-gui, there are no backward compatibility issues because
right now it just doesn't support -D at all.
It does however get more complicated...
- What should happen with a -D option if there is not initially a build
directory selected?
- What should happen if the wrong build directory is initially selected
and subsequently changed? It seems non-desirable here to forget -D
(etc.) entirely at that point.
><i> ccmake and cmake-gui *should* behave (in *my* opinion) as follows:
</i>><i> - on startup, load the CMakeCache.txt values (if there are any) from the
</i>><i> previous run
</i>><i> - then apply the -D arguments so that any -D arguments given on the
</i>><i> command line overwrite previous cache entries (just like command line
</i>><i> cmake does already)
</i>><i> - then put the user in charge and wait for user input
</i>
I suppose if I were writing the patch, I would have cmake-gui remember
whatever -D/-U/etc. options are given and apply them to any build
directory when it is selected, after loading the cache (if any). But
*don't* pass them on the cmake (except inasmuch as the initial cache
will contain them, modulo any changes the user made in the mean time).
IOW, if I specify a -D to cmake-gui, change that value, then change to
some other build directory, that -D would reset to the value from the
command line. This is consistent with the current behavior that any
other changes to the cache of the initial build directory are also lost.
Hmm... a corner case comes to mind, however; if I configure build
directory A after changing a -D value, then switch to build directory B,
then back to A, I probably don't want to reapply the -D. So maybe
cmake-gui would keep track of what build directories have been
configured in that instance and not apply -D/etc. to them. (However,
it's probably not very common for that to happen.)
Make sense?
--
Matthew</pre><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 5, 2013 at 3:25 PM, David Cole <span dir="ltr"><<a href="mailto:dlrdave@aol.com" target="_blank">dlrdave@aol.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
My question is still not answered completely:<br>
<br>
When should the new variable be added? On startup is not really<br>
possible because it might be the case that your src/binary directory<br>
is not set properly.<br>
<br>
So you would agree that it makes sense to do it "on configure" but<br>
only if the cache is empty? This will not allow to overwrite the<br>
variable via parameter but I guess that usecase is not very<br>
common?<br>
</blockquote>
<br></div><div class="im">
On startup is the only time it does make sense. After that, the user<br>
should be in charge, and the command line settings should not be<br>
re-applied again after a user makes an edit. You don't need the<br>
src/binary directories set properly necessarily in order to add a <br>
</div></blockquote></blockquote>
cache<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
entry to the UI.<br>
</blockquote>
<br><div class="im">
...<br>
<br>
- What should happen with a -D option if there is not initially a <br>
</div></blockquote>
build<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
directory selected?<br>
<br>
</blockquote>
<br>
It should add UI entries even though there is no build directory selected, and set them according to the -D values. Then, the -D values should be forgotten about and never applied again during that session, regardless of future user actions.<br>
<br>
Also, you could require that for -D args to work properly, the current directory *is* the binary directory at startup time (just like cmake and ccmake). If you're passing -D arguments to the gui program, then you have control over its launching point, and can set the current directory to be whatever you like.<br>
<br>
If launched without a build directory, you could choose the last known build directory (if there is one) just like cmake-gui does now.<br>
<br>
If no build directory, no -D args.<div class="im"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- What should happen if the wrong build directory is initially <br>
</blockquote>
selected<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
and subsequently changed? It seems non-desirable here to forget -D<br>
(etc.) entirely at that point.<br>
</blockquote>
<br></div>
No, it seems desirable to forget them at that point. They only apply to the build tree you launched it with. If you change the build directory, they do not apply.<div class="im"><br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I suppose if I were writing the patch, I would have cmake-gui <br>
</blockquote>
remember<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
whatever -D/-U/etc. options are given and apply them to any build<br>
directory when it is selected, after loading the cache (if any). But<br>
*don't* pass them on the cmake (except inasmuch as the initial cache<br>
will contain them, modulo any changes the user made in the mean time).<br>
<br>
IOW, if I specify a -D to cmake-gui, change that value, then change <br>
</blockquote>
to<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
some other build directory, that -D would reset to the value from the<br>
command line. This is consistent with the current behavior that any<br>
other changes to the cache of the initial build directory are also <br>
</blockquote>
lost.<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Hmm... a corner case comes to mind, however; if I configure build<br>
directory A after changing a -D value, then switch to build directory <br>
</blockquote>
B,<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
then back to A, I probably don't want to reapply the -D. So maybe<br>
cmake-gui would keep track of what build directories have been<br>
configured in that instance and not apply -D/etc. to them. (However,<br>
it's probably not very common for that to happen.)<br>
<br>
Make sense?<br>
</blockquote>
<br></div>
Not really -- I think you're vastly over complicating the solution to a very simple problem.<br>
<br>
<br>
D<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><div class="im"><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br></div><div class="im">
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/<u></u>CMake_FAQ</a><br>
<br></div><div class="im">
Follow this link to subscribe/unsubscribe:<br>
</div><a href="http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers" target="_blank">http://public.kitware.com/cgi-<u></u>bin/mailman/listinfo/cmake-<u></u>developers</a><br>
</blockquote></div><br></div>