[PATCH] D116850: [cmake] Enable users to specify archive creation commands
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 7 22:08:40 PST 2022
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.
Nice finding and great saving (build speed and file size)!
About LLVM_USE_THIN_ARCHIVES: I think just `-DCMAKE_CXX_ARCHIVE_CREATE='<CMAKE_AR> <LINK_FLAGS> qcTD <TARGET> <OBJECTS>'` is sufficient to achieve the saving as all(?) ar operations use `CMAKE_CXX_ARCHIVE_CREATE`, not `CMAKE_C_ARCHIVE_CREATE`. The new CMake variable will just be a convenience alias and have a discoverability issue. So to not complicate the build system further, I think not introducing a new mode is fine.
In addition, the reason thin archives cannot become the default is because `ninja install` users may delete their build directory or want the archives to be movable. (The portability on Linux is not a concern => binutils ar has supported thin archives since 2008-03.) This means we would need more code to say that install targets may not work well with `CMAKE_CXX_ARCHIVE_CREATE`. I think setting `CMAKE_CXX_ARCHIVE_CREATE` can be a tip in some documentation like `llvm/docs/GettingStarted.rst`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116850/new/
https://reviews.llvm.org/D116850
More information about the llvm-commits
mailing list