Commit ec97ac41 authored by Leif Walsh's avatar Leif Walsh

added optimization for normal static libraries Tokutek/mongo#983

parent 92eae38a
...@@ -40,6 +40,20 @@ FOREACH(LIB ${STATIC_LIBS}) ...@@ -40,6 +40,20 @@ FOREACH(LIB ${STATIC_LIBS})
) )
STRING(REGEX REPLACE "\n" ";" LIB_OBJ_LIST "${LIB_OBJS}") STRING(REGEX REPLACE "\n" ";" LIB_OBJ_LIST "${LIB_OBJS}")
STRING(REGEX REPLACE ";$" "" LIB_OBJ_LIST "${LIB_OBJ_LIST}") STRING(REGEX REPLACE ";$" "" LIB_OBJ_LIST "${LIB_OBJ_LIST}")
LIST(LENGTH LIB_OBJ_LIST LENGTH_WITH_DUPS)
SET(LIB_OBJ_LIST_NO_DUPS ${LIB_OBJ_LIST})
LIST(REMOVE_DUPLICATES LIB_OBJ_LIST_NO_DUPS)
LIST(LENGTH LIB_OBJ_LIST_NO_DUPS LENGTH_WITHOUT_DUPS)
IF(LENGTH_WITH_DUPS EQUAL LENGTH_WITHOUT_DUPS)
# Optimization for when lib doesn't actually have duplicate object
# names, we can just extract everything.
EXECUTE_PROCESS(
COMMAND ${CMAKE_AR} -x ${LIB}
WORKING_DIRECTORY ${TEMP_SUBDIR}
)
ELSE()
LIST(SORT LIB_OBJ_LIST) LIST(SORT LIB_OBJ_LIST)
SET(SAME_OBJ_COUNT 1) SET(SAME_OBJ_COUNT 1)
SET(LAST_OBJ_NAME) SET(LAST_OBJ_NAME)
...@@ -57,6 +71,7 @@ FOREACH(LIB ${STATIC_LIBS}) ...@@ -57,6 +71,7 @@ FOREACH(LIB ${STATIC_LIBS})
WORKING_DIRECTORY ${TEMP_SUBDIR} WORKING_DIRECTORY ${TEMP_SUBDIR}
) )
ENDFOREACH() ENDFOREACH()
ENDIF()
FILE(GLOB_RECURSE LIB_OBJECTS "${TEMP_SUBDIR}/*.o") FILE(GLOB_RECURSE LIB_OBJECTS "${TEMP_SUBDIR}/*.o")
SET(OBJECTS ${OBJECTS} ${LIB_OBJECTS}) SET(OBJECTS ${OBJECTS} ${LIB_OBJECTS})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment