[libc-commits] [PATCH] D75027: [libc] Guard cmake policy to avoid errors on older versions of cmake.

Paula Toth via Phabricator via libc-commits libc-commits at lists.llvm.org
Sun Feb 23 18:57:44 PST 2020


PaulkaToast created this revision.
PaulkaToast added a reviewer: sivachandra.
PaulkaToast added a project: libc-project.
Herald added subscribers: libc-commits, tschuett, MaskRay, mgorny.

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 <https://cmake.org/pipermail/cmake/2012-December/053013.html>.
Example of existing cmake policy guarding in llvm <https://github.com/llvm/llvm-project/blob/e1f6b68d1fd117b92953d2e21567dd8dad759a8b/lldb/CMakeLists.txt#L6-L8>.

The policy used here <https://cmake.org/cmake/help/git-stage/policy/CMP0076.html> was introduced in version `3.13` after the minimum version supported by llvm which is `3.4.3`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75027

Files:
  libc/CMakeLists.txt


Index: libc/CMakeLists.txt
===================================================================
--- libc/CMakeLists.txt
+++ libc/CMakeLists.txt
@@ -2,7 +2,9 @@
 
 # Use old version of target_sources command which converts the source
 # file paths to full paths.
-cmake_policy(SET CMP0076 OLD)
+if(POLICY CMP0076)
+  cmake_policy(SET CMP0076 OLD)
+endif()
 list(APPEND CMAKE_MODULE_PATH  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
 
 # The top-level source directory of libc.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75027.246133.patch
Type: text/x-patch
Size: 476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200224/b35358dc/attachment.bin>


More information about the libc-commits mailing list