If you need to set a policy to OLD, then we have failed...<div><br></div><div>Why do you need to set a policy to OLD?</div><div><br></div><div>How can we make it work so that you don't need to do that?</div><div><br></div>
<div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Dec 17, 2012 at 3:58 AM, Marcel Loose <span dir="ltr"><<a href="mailto:loose@astron.nl" target="_blank">loose@astron.nl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>Hi David,<br>
<br>
See my remarks inline.<div class="im"><br>
<br>
On 15/12/12 16:47, David Cole wrote:<br>
</div></div><div class="im">
<blockquote type="cite">
<div class="gmail_extra">
<div class="gmail_quote">On Sat, Dec 15, 2012 at 10:33 AM,
Marcel Loose <span dir="ltr"><<a href="mailto:marcel.loose@zonnet.nl" target="_blank">marcel.loose@zonnet.nl</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>Thanks, that seems to work.<br>
<br>
Is the idiom <br>
<blockquote><tt>if(POLICY CMP<NNNN>)</tt><tt><br>
</tt><tt> cmake_policy(PUSH)</tt><tt><br>
</tt><tt> cmake_policy(SET </tt><tt><tt>CMP<NNNN></tt>
OLD)</tt><tt><br>
</tt><tt> cmake_policy(POP)</tt><tt><br>
</tt><tt>endif()</tt><tt><br>
</tt></blockquote>
one that you also need to use with newer CMakes? Or does
it then suffice to do<tt><br>
</tt>
<blockquote><tt>cmake_policy(SET </tt><tt><tt>CMP<NNNN></tt>
OLD)</tt></blockquote>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>I assume you really mean:</div>
<tt>
<div class="gmail_quote"><tt><br>
</tt></div>
if(POLICY CMP<NNNN>)</tt><tt><br>
</tt><tt> cmake_policy(PUSH)</tt><tt><br>
</tt><tt> cmake_policy(SET </tt><tt><tt>CMP<NNNN></tt> OLD)</tt></div>
<div class="gmail_quote"><tt>endif()<br>
</tt></div>
<div class="gmail_quote"><tt><br>
</tt></div>
<div class="gmail_quote"><tt>...</tt></div>
<div class="gmail_quote">
<tt>other code where the policy is set to OLD</tt></div>
<div class="gmail_quote"><tt>...</tt></div>
<div class="gmail_quote"><tt><br>
</tt><tt>if(POLICY CMP<NNNN>)</tt><tt><br>
</tt><tt> cmake_policy(POP)</tt></div>
<div class="gmail_quote">
<tt>endif()</tt><tt><br>
</tt>
<div><br>
</div>
</div>
</div>
</blockquote></div>
Yes, you're right. I was oversimplifying. <br><div class="im">
<blockquote type="cite">
<div class="gmail_extra">
<div class="gmail_quote">
<div><br>
</div>
<div>The policies are tightly tied to the minimum required
version of CMake. So if you use cmake_minimum_required with
a certain version number, you can write code without
if(POLICY assuming that all the policies you need to set are
known as of that minimum version. If they are not (and they
must not be in this particular case), then you'll need the
if(POLICY construct.</div>
<div><br>
</div>
</div>
</div>
</blockquote></div>
So, that basically means that you need to use if(POLICY...) for all
policies that are not part of the minimum required version? Is there
a way to find out which policies exist for which version of CMake?<br>
<br>
I was hoping for a more forward compatible solution. In other words,
I was hoping that I could always use CMAKE_POLICY(SET...)
unconditionally. It's a bit of a shame that I have to clutter my
CMakeLists.txt and *.cmake files with these extra conditionals; and
have to remove them (or should I say: clean up) whenever I bump the
minimum required version. <br>
<br>
What's the reason that cmake doesn't silently ignore a
CMAKE_POLICY(SET...) for a policy it doesn't know about? <br><div class="im">
<br>
<blockquote type="cite">
<div class="gmail_extra">
<div class="gmail_quote">
<div>The other option is to bump up your minimum required
version.</div>
</div>
</div>
</blockquote></div>
Sure, but that defeats the whole purpose of setting a minimum
required version. I need to be compatible with version 2.6.2.<br>
<br>
Best regards,<br>
Marcel Loose.<br>
<br>
</div>
</blockquote></div><br></div>