This is an archive of the discontinued LLVM Phabricator instance.

[libc] Guard cmake policy to avoid errors on older versions of cmake.
AbandonedPublic

Authored by PaulkaToast on Feb 23 2020, 6:51 PM.

Details

Summary

Building with older versions of cmake result in this error.
Error Message:

CMake Error at /src/llvm-project/libc/CMakeLists.txt:5 (cmake_policy):
Policy "CMP0076" is not known to this version of CMake.

The set policy statement must be guarded as described here.
Example of existing cmake policy guarding in llvm.

The policy used here was introduced in version 3.13 after the minimum version supported by llvm which is 3.4.3.

Event Timeline

PaulkaToast created this revision.Feb 23 2020, 6:51 PM
abrachet accepted this revision.Feb 23 2020, 7:32 PM
abrachet added a subscriber: abrachet.

Do those older versions still build fine without this policy being set?

This revision is now accepted and ready to land.Feb 23 2020, 7:32 PM

Do those older versions still build fine without this policy being set?

Yes they do because the old behavior is default before the policy existed.

MaskRay added a subscriber: beanz.Feb 23 2020, 7:47 PM

A few months ago @beanz asked whether we can upgrade CMake to 3.15 https://lists.llvm.org/pipermail/llvm-dev/2019-October/136295.html It ended up with nothing definite.

Maybe we could make a smaller step, say CMake 3.12.

Like @MaskRay suggests, would bumping LLVM-libc's minimum required version instead of this change help/unblock you?

Like @MaskRay suggests, would bumping LLVM-libc's minimum required version instead of this change help/unblock you?

This issue doesn't block me, I just noticed this when building on ubuntu-xenial 16.04 which is from 2016. I just figured that we wanted to remain consistent in what is supported by llvm. https://llvm.org/docs/CMake.html

Version 3.4.3 is the minimum required.
PaulkaToast abandoned this revision.Apr 9 2020, 12:28 AM

Abandoned due to recent cmake upgrade: D77781.