[CMake] CheckTypeSize policy warning

Graham Bloice graham.bloice at trihedral.com
Wed Apr 29 17:27:29 EDT 2015


In CMake 3.1.3 and later invoking check_type_size from the module
CheckTypeSize.cmake causes a policy CMP0054 warning.

For example, when building zlib-1.28 (on Windows):

CMake Warning (dev) at
C:/ProgramData/chocolatey/lib/cmake/content/cmake-3.1.3-win32-x86/share/cmake-3.1/Modules/CheckTypeSize.cmake:232
(if):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.
  Quoted variables like "C" will no longer be dereferenced when the policy
is
  set to NEW.  Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
  E:/Wireshark/wireshark-win32-libs/zlib-1.2.8/CMakeLists.txt:43
(check_type_size)

As the function has a cmake_policy_push(), followed by a
cmake_policy(VERSION 3.0) at the start we can't pass down a policy setting.

I can fix this locally by changing the policy set to 3.1

There might be other similarly afflicted modules.

I looked but couldn't see anything on the bug tracker, shall I raise an
issue?

-- 
Graham Bloice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150429/73f3005e/attachment.html>


More information about the CMake mailing list