[llvm] [CMake][AIX] Enable CMP0182: Create shared library archives by default (PR #155686)

David Tenty via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 27 13:12:12 PDT 2025


https://github.com/daltenty created https://github.com/llvm/llvm-project/pull/155686

On AIX we prefer to create shared libraries as shared library archives (i.e. we archive the shared object in a big AR archive) as this is the standard format on the platform.

There is now a CMake policy that allows us to do this by default, so opt-in to that behaviour.

>From 114a0563286edc74923f205c8dd6ce34a72ff3e9 Mon Sep 17 00:00:00 2001
From: David Tenty <daltenty at ibm.com>
Date: Wed, 27 Aug 2025 15:40:40 -0400
Subject: [PATCH] [CMake][AIX] Enable CMP0182: Create shared library archives
 by default

On AIX we prefer to create shared libraries as shared library archives (i.e. we archive the shared object in a big AR archive) as this is the standard format on the platform.

There is now a CMake policy that allows us to do this by default, so opt-in to that behaviour.
---
 cmake/Modules/CMakePolicy.cmake | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/cmake/Modules/CMakePolicy.cmake b/cmake/Modules/CMakePolicy.cmake
index 421f5a4dda6c6..6458af215af20 100644
--- a/cmake/Modules/CMakePolicy.cmake
+++ b/cmake/Modules/CMakePolicy.cmake
@@ -41,3 +41,9 @@ if(POLICY CMP0156)
     cmake_policy(SET CMP0179 NEW)
   endif()
 endif()
+
+# CMP0182: Create shared library archives by default on AIX.
+# New in CMake 4.0: https://cmake.org/cmake/help/latest/policy/CMP0182.html
+if(POLICY CMP0182)
+    cmake_policy(SET CMP0182 NEW)
+endif()



More information about the llvm-commits mailing list