<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 04.03.2015 19:20, Pere Mato Vila
wrote:<br>
</div>
<blockquote cite="mid:7D957D63-A674-4D1F-9C42-7A2ACA0E2A4D@cern.ch"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<div style="margin: 0px; font-family: Menlo;" class="">Hi,</div>
<div style="margin: 0px; font-family: Menlo;" class=""><br
class="">
</div>
<div style="margin: 0px;" class=""><font class="" face="Menlo">
With version </font><span style="font-family: Menlo;
font-size: 11px;" class="">3.1.3, I have to define policy </span><font
class="" face="Menlo"><span style="font-size: 11px;" class="">CMP0054
to NEW to avoid lots of warnings. My original approach was
to define it at the top level CMakeLists.txt file hoping
this will be inherited by all sub_directories of the
project. Beware that some of the sub_directories contain
a cmake_minimum_required() command because they can also be
standalone projects with a project() command. To my surprise
this does not work for policy CMP0054 and it works for
others like for example </span></font><span
style="font-family: Menlo;" class="">CMP0005. Is there any
reason for it? </span></div>
<div style="margin: 0px;" class=""><span style="font-family:
Menlo;" class=""><br class="">
</span></div>
<div style="margin: 0px;" class=""><font class="" face="Menlo">
To test this behaviour is as simple cmaking the following
CMakeLists.txt file:</font></div>
<div style="margin: 0px;" class=""><font class="" face="Menlo"><span
style="font-size: 11px;" class=""> </span></font></div>
<div style="margin: 0px; font-family: Menlo;" class="">cmake_policy(SET
CMP0005 NEW)</div>
<div style="margin: 0px; font-family: Menlo;" class="">cmake_policy(SET
CMP0054 NEW)</div>
<div style="margin: 0px; font-family: Menlo; min-height: 14px;"
class=""><br class="">
</div>
<div style="margin: 0px; font-family: Menlo;" class="">cmake_policy(GET
CMP0005 cmp0005)</div>
<div style="margin: 0px; font-family: Menlo;" class="">cmake_policy(GET
CMP0054 cmp0054)</div>
<div style="margin: 0px; font-family: Menlo;" class="">message("Policy
CMP0005 before version ${cmp0005}")</div>
<div style="margin: 0px; font-family: Menlo;" class="">message("Policy
CMP0054 before version ${cmp0054}")</div>
<div style="margin: 0px; font-family: Menlo; min-height: 14px;"
class=""><br class="">
</div>
<div style="margin: 0px; font-family: Menlo;" class="">cmake_minimum_required(VERSION
2.8.8 FATAL_ERROR)</div>
<div style="margin: 0px; font-family: Menlo; min-height: 14px;"
class=""><br class="">
</div>
<div style="margin: 0px; font-family: Menlo;" class="">cmake_policy(GET
CMP0005 _cmp0005)</div>
<div style="margin: 0px; font-family: Menlo;" class="">cmake_policy(GET
CMP0054 _cmp0054)</div>
<div style="margin: 0px; font-family: Menlo;" class="">message("Policy
CMP0005 after version ${_cmp0005}")</div>
<div style="margin: 0px; font-family: Menlo;" class="">message("Policy
CMP0054 after version ${_cmp0054}")</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">The output is:</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-size: 11px; font-family: Menlo;"
class="">Policy CMP0005 before version NEW</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;"
class="">Policy CMP0054 before version NEW</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;"
class="">Policy CMP0005 after version NEW</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;"
class="">Policy CMP0054 after version </div>
</div>
<div class=""><br class="">
</div>
<div class="">so, <span style="font-family: Menlo; font-size:
11px;" class="">CMP0054</span> is undefined after the
cmake_minimum_required()</div>
</blockquote>
<br>
cmake_minimum_required() resets all policies according to the given
version.<br>
<br>
CMP0005 was introduced in 2.6.0 so requiring 2.8.8 sets it to NEW.<br>
CMP0054 was introduced in 3.1 so requiring 2.8.8 clears the policy
(since it did not exist in 2.8.8).<br>
<br>
Nils<br>
</body>
</html>