[llvm] 2d3ae6f - [cmake] Enable users to specify archive creation commands
Alexander Shaposhnikov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 10 10:54:24 PST 2022
Author: Alexander Shaposhnikov
Date: 2022-01-10T18:53:40Z
New Revision: 2d3ae6f4844bb5b61936d957e9328490f18ecd41
URL: https://github.com/llvm/llvm-project/commit/2d3ae6f4844bb5b61936d957e9328490f18ecd41
DIFF: https://github.com/llvm/llvm-project/commit/2d3ae6f4844bb5b61936d957e9328490f18ecd41.diff
LOG: [cmake] Enable users to specify archive creation commands
This diff enables users to override CMAKE_C_ARCHIVE_CREATE & CMAKE_CXX_ARCHIVE_CREATE
(currently set in HandleLLVMOptions.cmake).
For example, one can specify
cmake -DCMAKE_C_ARCHIVE_CREATE="<CMAKE_AR> TDqc <TARGET> <LINK_FLAGS> <OBJECTS>" \
-DCMAKE_CXX_ARCHIVE_CREATE="<CMAKE_AR> TDqc <TARGET> <LINK_FLAGS> <OBJECTS>" ...
to make the build create thin archives instead of regular ones.
For a clean run `ninja lld` using thin archives seems to reduce the size
of the build directory from ~14GB to ~8GB
Differential revision: https://reviews.llvm.org/D116850
Added:
Modified:
llvm/cmake/modules/HandleLLVMOptions.cmake
Removed:
################################################################################
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 3d3be961a6755..dc08b3a7ae8e8 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -189,11 +189,13 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
ERROR_QUIET
)
if(${RANLIB_RESULT} EQUAL 0)
- set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Dqc <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Dqc <TARGET> <LINK_FLAGS> <OBJECTS>"
+ CACHE STRING "archive create command")
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> Dq <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -D <TARGET>")
- set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Dqc <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Dqc <TARGET> <LINK_FLAGS> <OBJECTS>"
+ CACHE STRING "archive create command")
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> Dq <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -D <TARGET>")
endif()
More information about the llvm-commits
mailing list