On 09/18/2014 01:00 PM, Adam Strzelecki wrote:
> If I understand correctly all modules included via
> include/find_package have implicit POLICY PUSH and POP

Yes.

> at the EOF. Wouldn't it be reasonable to require all
> internal .cmake files to begin with:
> 
>       cmake_policy(VERSION 3.1) # or whatever version the module was tested 
> against
> 
> Then before next release all of these should be checked
> against new policies and upgraded to:
> 
>       cmake_policy(VERSION 3.2) # next release version

Like Nils' proposal, this will not be reliable without full coverage
of module functionality in the test suite (which is very hard to do
because every find module depends on another external package).  It
could be done manually on a per-module basis.

> Then we can safely drop all these fancy
> if("x${var}" STREQUAL "xVALUE") in favor of if(var STREQUAL "VALUE")

This can be done with just

 cmake_policy(SET CMP0054 NEW)

at the top of any module that has been ported accordingly.

Most policies do not affect CMake syntax, but several have come
before this one and there are very few modules that make any
explicit mention of cmake_policy.  In most cases the module
code can be written to work with any policy settings.

On 09/17/2014 08:37 AM, Rolf Eike Beer wrote:
> Wait, what? This is actually the opposite of what that policy is for,

This is true, but will only affect modules that come with CMake
that must work regardless of the cmake_minimum_required(VERSION)
used in the project.  Once a release of CMake contains this policy,
project code can require that version of CMake when it is ready
and then use the nicer if() tests.

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to