Skip to content

Commit 6751d38

Browse files
authored
Merge pull request #3219 from compnerd/library-optimization
build: improve static library generation
2 parents 9aeb542 + da092bf commit 6751d38

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,19 @@ option(SWIFT_BUILD_SOURCEKIT
307307
"Build SourceKit"
308308
${SWIFT_BUILD_SOURCEKIT_default})
309309

310+
#
311+
# Assume a new enough ar to generate the index at construction time. This avois
312+
# having to invoke ranlib as a secondary command.
313+
#
314+
315+
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <LINK_FLAGS> <OBJECTS>")
316+
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qs <TARGET> <LINK_FLAGS> <OBJECTS>")
317+
set(CMAKE_C_ARCHIVE_FINISH "")
318+
319+
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <LINK_FLAGS> <OBJECTS>")
320+
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qs <TARGET> <LINK_FLAGS> <OBJECTS>")
321+
set(CMAKE_CXX_ARCHIVE_FINISH "")
322+
310323
#
311324
# Include CMake modules
312325
#

0 commit comments

Comments
 (0)