Alan W. Irwin wrote:
On 2009-02-01 09:03-0800 Alan W. Irwin wrote:

According to the documentation of 2.6.2, policies CMP0008 and CMP0009
were introduced after 2.6.0.  Also, according to that documentation,
cmake_policy(VERSION 2.6.0) should set those policies to OLD and warn about
that.

I use

CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)

according to the documentation that sets

cmake_policy(VERSION 2.6.0)

by default.  This documented behaviour seems quite logical and useful so
that users can use a variety of CMake versions above 2.6.0 and get the
same 2.6.0 policies.

However, I could see no such warning messages concerning policies CMP0008 and
CMP0009 even with -Wdev (and even if I use cmake_policy(VERSION 2.6.0)
explicitly).  I then investigated further with

foreach(policy RANGE 0 9)
 if(POLICY CMP000${policy})
     message(STATUS "Policy ${policy} is ON")
 else(POLICY CMP000${policy})
     message(STATUS "Policy ${policy} is OFF")
 endif(POLICY CMP000${policy})
endforeach(policy RANGE 0 9)

and obtained

-- Policy 0 is ON
-- Policy 1 is ON
-- Policy 2 is ON
-- Policy 3 is ON
-- Policy 4 is ON
-- Policy 5 is ON
-- Policy 6 is ON
-- Policy 7 is ON
-- Policy 8 is ON
-- Policy 9 is ON

I am pretty sure the ON result for policies CMP0008 and CMP0009 for

CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)

must be a bug in 2.6.2.

Oops! That test simply asked if a policy exists. So that test is ambiguous
at best.  Here is an improved test and results:

foreach(policy RANGE 0 9)
  cmake_policy(GET CMP000${policy} policy_result)
  message(STATUS "Policy CMP000${policy} is ${policy_result}")
endforeach(policy RANGE 0 9)

-- Policy CMP0000 is NEW
-- Policy CMP0001 is NEW
-- Policy CMP0002 is NEW
-- Policy CMP0003 is NEW
-- Policy CMP0004 is NEW
-- Policy CMP0005 is NEW
-- Policy CMP0006 is NEW
-- Policy CMP0007 is NEW
-- Policy CMP0008 is -- Policy CMP0009 is

So from these results (and if you can trust the documentation of
cmake_policy(GET ...)) it appears CMP0008 and CMP0009 are not set. Shouldn't
those be set to OFF with a warning (i.e., the documented behaviour) when

Everything is behaving as intended and as documented. You're just misinterpreting the documentation. See below.

CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)

is used?

If a policy is undefined as for CMP0008 and CMP0009 for 2.6.2 what does that
mean? Is that the same as OLD (or NEW) or does the policy implementation
have buggy/unknown behaviour under these circumstances?

The policies are defined but "unset". I've updated the documentation to clarify this:

- "All policies introduced after the specified version will be reset "
- "to use OLD behavior with a warning.  "
+ "All policies introduced after the specified version will be unset.  "

The documentation of cmake_poilcy already says

"When CMake needs to know which behavior
 to use it checks for a setting specified by the project.  If no
 setting is available the OLD behavior is assumed and a warning is
 produced requesting that the policy be set."

Therefore you'll only see a warning if CMake encounters a situation in which it needs to know which behavior to use. In CMP0009 for example, you should see a warning only if file(GLOB) encounters a symlink.

-Brad
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to