[cmake-developers] different behavior of cmake_minimum_required(3.0) and 3.1

Rolf Eike Beer eike at sf-mail.de
Fri Mar 15 18:10:40 EDT 2019


Out of boredom I'm hacking a bit around in the build system of Subsurface 
(https://github.com/Subsurface-divelog/subsurface). One of the things I'm 
looking to is requiring a newer CMake version. And now something strange 
happens:

The original code:
cmake_minimum_required(VERSION 2.8.11)

This still works:
cmake_minimum_required(VERSION 3.0)

like this:

-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") 
-- Checking for module 'libxml-2.0'
--   Found libxml-2.0, version 2.9.4
-- Checking for module 'sqlite3'
--   Found sqlite3, version 3.20.1
-- Checking for module 'libxslt'
--   Found libxslt, version 1.1.29
-- Checking for module 'libzip'
--   Found libzip, version 1.1.3


And this breaks:
cmake_minimum_required(VERSION 3.1)

like this:

-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") 
-- Checking for module 'libxml-2.0'
--   Found libxml-2.0, version 2.9.1
-- Checking for module 'sqlite3'
--   Found sqlite3, version 3.8.2
-- Checking for module 'libxslt'
--   Found libxslt, version 1.1.28
-- Checking for module 'libzip'
--   No package 'libzip' found

I suspected it was a policy thing, so I tried this:

foreach(_p RANGE 21 54)
       cmake_policy(SET CMP00${_p} OLD)
endforeach()

Does not change anything.

Build logs can be found here for 3.0:
https://api.travis-ci.org/v3/job/506938155/log.txt

And for 3.1:
https://api.travis-ci.org/v3/job/506849909/log.txt

It's a CMake 3.8.2 actually, which can be found in the mxe tarballs (look in 
the logs, IIRC it's the first one).

Has anyone an idea what's happening there? And even more important: how to get 
it fixed? The maximum version the requirement can be raised to is 3.5.1 for 
the moment because of the supported Ubuntu versions (16.04+).

Greetings,

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part.
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20190315/4336c915/attachment.sig>


More information about the cmake-developers mailing list