[CMake] CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR) and cmake_policy(VERSION 2.6.0) not working correctly for 2.6.2

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Feb 1 12:03:53 EST 2009


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.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list