Hi Eli,<br><br><div class="gmail_quote">On 21 June 2012 21:25, Ateljevich, Eli <span dir="ltr"><<a href="mailto:eli@water.ca.gov" target="_blank">eli@water.ca.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal">Hi,<u></u><u></u></p><p class="MsoNormal">I was wondering if there is a best practice for providing a file for user configuration decisions (options, unique flags) that will be more persistent than the cache? I have a project where a dozen or two algorithmic decisions have to be made. I find that this is just enough that cache overwrites cause me fear. I could do this on the environment, I suppose, but most of my users prefer a small list of name-value pairs for decisions that are pretty stable for them. <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I couldn’t find anything on this. The concept is alluded to by a 2001 email about INCLUDE by Bill Hoffman:<u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">It could be used like this:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">INCLUDE (${PROJECT_BINARY_DIR}/UserCacheSettings.txt OPTIONAL)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">This would allow the user to pre-set values for the Cache file, but still<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">be able to delete the Cache file.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal">But I wasn’t sure about the mechanics of this. When would it have to be read to fulfill this role and what does “pre-set” really mean in light of that as far as precedence if there are duplicate entries? Wouldn’t everything that could be set have to be something that will also appear in CMakeCache.txt? I assume the format would be just like CMakeCache.txt? …which would be ideal.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Thanks,</p></div></div></blockquote><br><br>Could you use an initial cache file - see the "-C <initial-cache>" command line option for CMake? <br>
<br>Apologies if you've already seen that, but it seems to fit what you're looking for. The format of the initial cache is CMake script rather than CMakeCache.txt,<br>but as it's just set(...) commands with the CACHE option it should be easy for users to write.<br>
<br>I'm not 100% sure what you need in terms of persistency and precedence, but variables set in an initial cache file will "take priority over the project's default values" according to the CMake manaul entry.<br>
<br>Cheers,<br><br>Ben.<br></div>