Perhaps I&#39;m missing something. What I&#39;m trying to do is script things so the usercan do this<br><br>cd build<br>cmake -Dfoo=bar /path/to/sources<br>make<br><br>where the CMakeLists.txt in /path/to/sources actually ends up building several different things by creating directories for each thing, stepping in and calling cmake/make to build each piece. The trick will be to push -Dfoo=bar into the sub-builds.<br>
<br>If I understand you correctly, I do the first cmake call with -Dfoo=bar, pointing at my top-level CMakeLists.txt, and then call cmake again from the same directory and picked up cached values? This is fine to repickup cached -D values but will only work for the same sources, right? What I think I want to do is<br>
<br>cd build<br>cmake -Dfoo=bar /sources<br>.... under the scenes we <br>.... mkdir a; cd a<br>.... cmake -Dfoo=bar /sources/a; make; cd ..<br>.... mkdir b; cd b<br>.... cmake -Dfoo-bar /sources/b; make; cd ..<br>make<br>
<br>I guess I could try grabbing some things from the top-level cache, but as you mention, that seems open to later problems.<br><br>Am I misunderstanding your suggestion?<br><br>Thanks,<br>b.<br><br><br><div class="gmail_quote">
On Tue, Apr 7, 2009 at 1:14 PM, Bill Hoffman <span dir="ltr">&lt;<a href="mailto:bill.hoffman@kitware.com">bill.hoffman@kitware.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Bill O&#39;Hara wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
Also to mail list.<br>
<br>
---------- Forwarded message ----------<br></div><div class="im">
From: *Bill O&#39;Hara* &lt;<a href="mailto:billtohara@gmail.com" target="_blank">billtohara@gmail.com</a> &lt;mailto:<a href="mailto:billtohara@gmail.com" target="_blank">billtohara@gmail.com</a>&gt;&gt;<br>
Date: Tue, Apr 7, 2009 at 12:51 PM<br>
Subject: Re: [CMake] ARGV to pass to CMAKE_COMMAND<br></div><div class="im">
To: <a href="mailto:a.neundorf-work@gmx.net" target="_blank">a.neundorf-work@gmx.net</a> &lt;mailto:<a href="mailto:a.neundorf-work@gmx.net" target="_blank">a.neundorf-work@gmx.net</a>&gt;<br>
<br>
<br>
I think it makes sense for us. We have a quite large build and sometimes users want to rebuild part of our software automatically rather than use a preinstalled version. We can support this with recursive calls to cmake for the particular code they are trying to build but we need to also pass down whatever parameters they passed to the top-level cmake invocation. We don&#39;t know them all ahead of time, nor do we really want to hardcode them explicitly in the calls to cmake.<br>

<br>
</div></blockquote>
<br>
I suppose you might be able to copy the CMakeCache.txt or parts of it down to the sub-project.  Any -D options given to cmake will be in the cache with lots of other stuff....  Also, it is not really a reliable thing to do anyway.   What if the user does this:<br>

<br>
cd build<br>
cmake -Dfooba=bar ../source<br>
cmake ../source   # this one does not have -Dfooba=bar on the command line, but it will have fooba set in the cache from the previous run.<br><font color="#888888">
<br>
-Bill<br>
</font></blockquote></div><br>