diff options
Diffstat (limited to 'cmake/libutils.cmake')
-rw-r--r-- | cmake/libutils.cmake | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake index 2e65e8b5ba3..2a218bc63b0 100644 --- a/cmake/libutils.cmake +++ b/cmake/libutils.cmake @@ -136,6 +136,10 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE) SET(SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_depends.c) ADD_LIBRARY(${TARGET} STATIC ${SOURCE_FILE}) SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME}) + IF(NOT _SKIP_PIC) + SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS + "${CMAKE_SHARED_LIBRARY_C_FLAGS}") + ENDIF() SET(OSLIBS) FOREACH(LIB ${LIBS_TO_MERGE}) @@ -240,11 +244,11 @@ MACRO(MERGE_LIBRARIES) # check for non-PIC libraries IF(NOT _SKIP_PIC) FOREACH(LIB ${LIBS}) - GET_TARGET_PROPERTY(${LIB} TYPE LIBTYPE) - IF(LIBTYPE STREQUAL "STATIC_LIBRARY") - GET_TARGET_PROPERTY(LIB COMPILE_FLAGS LIB_COMPILE_FLAGS) + GET_TARGET_PROPERTY(LTYPE ${LIB} TYPE) + IF(LTYPE STREQUAL "STATIC_LIBRARY") + GET_TARGET_PROPERTY(LIB_COMPILE_FLAGS ${LIB} COMPILE_FLAGS) STRING(REPLACE "${CMAKE_SHARED_LIBRARY_C_FLAGS}" - "<PIC_FLAG>" LIB_COMPILE_FLAGS ${LIB_COMPILE_FLAG}) + "<PIC_FLAG>" LIB_COMPILE_FLAGS "${LIB_COMPILE_FLAGS}") IF(NOT LIB_COMPILE_FLAGS MATCHES "<PIC_FLAG>") MESSAGE(FATAL_ERROR "Attempted to link non-PIC static library ${LIB} to shared library ${TARGET}\n" |