Commit 45625de0 authored by Leif Walsh's avatar Leif Walsh

fixed cmake warnings for 3.0.0

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