[CMake] Why policy CMP0054 does not survive cmake_minimum_required?
Pere Mato Vila
Pere.Mato at cern.ch
Wed Mar 4 13:20:16 EST 2015
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()
Cheers,
Pere
-------------------------------------------------------------
Pere Mato CERN, PH Department, CH 1211 Geneva 23, Switzerland
e-mail: pere.mato at cern.ch<mailto:pere.mato at cern.ch> tel: +41 22 76 78696
fax: +41 22 76 68792 gsm: +41 76 48 70855
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150304/08dc64cb/attachment.html>
More information about the CMake
mailing list