On 04.03.2015 19:20, Pere Mato Vila wrote:
Hi,
With version 3.1.3, I have to define policy 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 CMP0005. Is there any reason for it?
To test this behaviour is as simple cmaking the following
CMakeLists.txt file:
cmake_policy(SET CMP0005 NEW)
cmake_policy(SET CMP0054 NEW)
cmake_policy(GET CMP0005 cmp0005)
cmake_policy(GET CMP0054 cmp0054)
message("Policy CMP0005 before version ${cmp0005}")
message("Policy CMP0054 before version ${cmp0054}")
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
cmake_policy(GET CMP0005 _cmp0005)
cmake_policy(GET CMP0054 _cmp0054)
message("Policy CMP0005 after version ${_cmp0005}")
message("Policy CMP0054 after version ${_cmp0054}")
The output is:
Policy CMP0005 before version NEW
Policy CMP0054 before version NEW
Policy CMP0005 after version NEW
Policy CMP0054 after version
so, CMP0054 is undefined after the cmake_minimum_required()
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).
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