On 05.03.2015 18:50, Pere Mato Vila wrote:

On 04 Mar 2015, at 19:40, Nils Gladitz <[email protected] <mailto:[email protected]>> wrote:

cmake_minimum_required() resets all policies according to the given version.

CMP0005 was introduced in 2.6.0 so requiring 2.8.8 sets it to NEW.
CMP0054 was introduced in 3.1 so requiring 2.8.8 clears the policy (since it did not exist in 2.8.8).


Thanks very much for the explanation. Nevertheless I do not understand the logic. Running with 3.1 with the exactly the same code generates warnings that were not there in 2.8.8. In order to switch them off I need to set the policy to NEW, which gets cleared by requiring somehow a less restrictive condition.

Setting individual policies before a call to cmake_minimum_required() doesn't make sense given that it resets them all but you can set them after.

The warnings are there so you as a developer of a project that conforms to CMake 2.8.8 know that the behavior will change as soon as you convert your project to 3.1. You can get rid of the warnings by working around the if() ambiguity so that behavior before and after CMake 3.1 is identical or by requiring 3.1.

If you do switch to requiring 3.1 make sure the new behavior works for you.

Nils
-- 

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

Reply via email to