Commit 44096e8b authored by Leif Walsh's avatar Leif Walsh

fixed cmake warnings for 3.0.0

parent ebe12128
......@@ -16,9 +16,7 @@
# This script merges many static libraries into
# one big library on Unix.
SET(TARGET_LOCATION "@TARGET_LOCATION@")
SET(TARGET "@TARGET@")
SET(STATIC_LIBS "@STATIC_LIBS@")
SET(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@")
SET(CMAKE_AR "@CMAKE_AR@")
SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
......@@ -30,7 +28,7 @@ MAKE_DIRECTORY(${TEMP_DIR})
# clashes) Since the lib may contain objects with the same name, we first
# list the archive contents, then uniquify the object names as we extract
# them.
FOREACH(LIB ${STATIC_LIBS})
FOREACH(LIB ${STATIC_LIB_FILES})
GET_FILENAME_COMPONENT(NAME_NO_EXT ${LIB} NAME_WE)
SET(TEMP_SUBDIR ${TEMP_DIR}/${NAME_NO_EXT})
MAKE_DIRECTORY(${TEMP_SUBDIR})
......@@ -87,10 +85,10 @@ FOREACH(OBJ ${OBJECTS})
SET(ALL_OBJECTS ${ALL_OBJECTS} ${OBJ})
ENDFOREACH()
FILE(TO_NATIVE_PATH ${TARGET_LOCATION} ${TARGET_LOCATION})
FILE(TO_NATIVE_PATH ${TARGET_FILE} TARGET_FILE)
# Now pack the objects into library with ar.
EXECUTE_PROCESS(
COMMAND ${CMAKE_AR} rcs ${TARGET_LOCATION} ${ALL_OBJECTS}
COMMAND ${CMAKE_AR} rcs ${TARGET_FILE} ${ALL_OBJECTS}
WORKING_DIRECTORY ${TEMP_DIR}
)
......
......@@ -27,17 +27,12 @@ MACRO(TOKU_MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
SET(OSLIBS)
FOREACH(LIB ${LIBS_TO_MERGE})
GET_TARGET_PROPERTY(LIB_LOCATION ${LIB} LOCATION)
GET_TARGET_PROPERTY(LIB_TYPE ${LIB} TYPE)
IF(NOT LIB_LOCATION)
# 3rd party library like libz.so. Make sure that everything
# that links to our library links to this one as well.
LIST(APPEND OSLIBS ${LIB})
ELSE()
IF(TARGET ${LIB})
# This is a target in current project
# (can be a static or shared lib)
GET_TARGET_PROPERTY(LIB_TYPE ${LIB} TYPE)
IF(LIB_TYPE STREQUAL "STATIC_LIBRARY")
SET(STATIC_LIBS ${STATIC_LIBS} ${LIB_LOCATION})
LIST(APPEND STATIC_LIBS ${LIB})
ADD_DEPENDENCIES(${TARGET} ${LIB})
# Extract dependend OS libraries
TOKU_GET_DEPENDEND_OS_LIBS(${LIB} LIB_OSLIBS)
......@@ -46,6 +41,10 @@ MACRO(TOKU_MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
# This is a shared library our static lib depends on.
LIST(APPEND OSLIBS ${LIB})
ENDIF()
ELSE()
# 3rd party library like libz.so. Make sure that everything
# that links to our library links to this one as well.
LIST(APPEND OSLIBS ${LIB})
ENDIF()
ENDFOREACH()
IF(OSLIBS)
......@@ -65,19 +64,21 @@ MACRO(TOKU_MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
# To merge libs, just pass them to lib.exe command line.
SET(LINKER_EXTRA_FLAGS "")
FOREACH(LIB ${STATIC_LIBS})
SET(LINKER_EXTRA_FLAGS "${LINKER_EXTRA_FLAGS} ${LIB}")
SET(LINKER_EXTRA_FLAGS "${LINKER_EXTRA_FLAGS} $<TARGET_FILE:${LIB}>")
ENDFOREACH()
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES STATIC_LIBRARY_FLAGS
"${LINKER_EXTRA_FLAGS}")
ELSE()
GET_TARGET_PROPERTY(TARGET_LOCATION ${TARGET} LOCATION)
FOREACH(STATIC_LIB ${STATIC_LIBS})
LIST(APPEND STATIC_LIB_FILES $<TARGET_FILE:${STATIC_LIB}>)
ENDFOREACH()
IF(APPLE)
# Use OSX's libtool to merge archives (ihandles universal
# binaries properly)
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
COMMAND rm ${TARGET_LOCATION}
COMMAND /usr/bin/libtool -static -o ${TARGET_LOCATION}
${STATIC_LIBS}
COMMAND rm $<TARGET_FILE:${TARGET}>
COMMAND /usr/bin/libtool -static -o $<TARGET_FILE:${TARGET}>
${STATIC_LIB_FILES}
)
ELSE()
# Generic Unix, Cygwin or MinGW. In post-build step, call
......@@ -88,11 +89,14 @@ MACRO(TOKU_MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
${TOKU_CMAKE_SCRIPT_DIR}/merge_archives_unix.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake
@ONLY
)
)
STRING(REGEX REPLACE ";" "\\\;" STATIC_LIB_FILES "${STATIC_LIB_FILES}")
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
COMMAND rm ${TARGET_LOCATION}
COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake
COMMAND rm $<TARGET_FILE:${TARGET}>
COMMAND ${CMAKE_COMMAND}
-D TARGET_FILE=$<TARGET_FILE:${TARGET}>
-D STATIC_LIB_FILES="${STATIC_LIB_FILES}"
-P ${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake"
)
ENDIF()
......
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