[llvm-branch-commits] [llvm] release/21.x: [CMake][AIX] Enable CMP0182: Create shared library archives by default (#155686) (PR #156504)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 2 10:31:19 PDT 2025


https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/156504

Backport 94738ddaf42a0fa1981dc083f9ed94ba11943458

Requested by: @amy-kwan

>From 58a31b4aa15cfa88cade7a0ebe66a14396a7e007 Mon Sep 17 00:00:00 2001
From: David Tenty <daltenty at ibm.com>
Date: Thu, 28 Aug 2025 09:29:27 -0400
Subject: [PATCH] [CMake][AIX] Enable CMP0182: Create shared library archives
 by default (#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.

---------

Co-authored-by: Hubert Tong <hubert.reinterpretcast at gmail.com>
(cherry picked from commit 94738ddaf42a0fa1981dc083f9ed94ba11943458)
---
 cmake/Modules/CMakePolicy.cmake | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/cmake/Modules/CMakePolicy.cmake b/cmake/Modules/CMakePolicy.cmake
index 421f5a4dda6c6..cf986331707b6 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-branch-commits mailing list