|
|
@ -20,10 +20,10 @@ MACRO(CHECK_UNDEFINED_SYMBOL MYLIBRARY SYMBOL SYMBOL_FOUND)
|
|
|
|
IF(CMAKE_NM)
|
|
|
|
IF(CMAKE_NM)
|
|
|
|
# Use nm to check if a library is using an external symbol
|
|
|
|
# Use nm to check if a library is using an external symbol
|
|
|
|
EXEC_PROGRAM(${CMAKE_NM} ARGS "-gu ${${MYLIBRARY}} | grep ${SYMBOL}" OUTPUT_VARIABLE NM_SYMBOL)
|
|
|
|
EXEC_PROGRAM(${CMAKE_NM} ARGS "-gu ${${MYLIBRARY}} | grep ${SYMBOL}" OUTPUT_VARIABLE NM_SYMBOL)
|
|
|
|
MESSAGE(STATUS "Checking for undefined symbol ${SYMBOL} in ${${MYLIBRARY}}")
|
|
|
|
# MESSAGE(STATUS "Checking for undefined symbol ${SYMBOL} in ${${MYLIBRARY}}")
|
|
|
|
IF(NOT NM_SYMBOL MATCHES ${SYMBOL})
|
|
|
|
IF(NOT NM_SYMBOL MATCHES ${SYMBOL})
|
|
|
|
SET(${SYMBOL_FOUND} FALSE)
|
|
|
|
SET(${SYMBOL_FOUND} FALSE)
|
|
|
|
MESSAGE(STATUS "Defined symbol ${SYMBOL} detected in ${${MYLIBRARY}}")
|
|
|
|
# MESSAGE(STATUS "Defined symbol ${SYMBOL} detected in ${${MYLIBRARY}}")
|
|
|
|
ENDIF(NOT NM_SYMBOL MATCHES ${SYMBOL})
|
|
|
|
ENDIF(NOT NM_SYMBOL MATCHES ${SYMBOL})
|
|
|
|
ENDIF(CMAKE_NM)
|
|
|
|
ENDIF(CMAKE_NM)
|
|
|
|
ELSEIF(UNIX)
|
|
|
|
ELSEIF(UNIX)
|
|
|
@ -57,10 +57,10 @@ MACRO(CHECK_LINKED_LIBRARY MYLIBRARY OTHERLIBRARY LIBRARY_FOUND)
|
|
|
|
# Use otool to check if a library is linked to another library
|
|
|
|
# Use otool to check if a library is linked to another library
|
|
|
|
GET_FILENAME_COMPONENT(LIBNAME ${${OTHERLIBRARY}} NAME_WE)
|
|
|
|
GET_FILENAME_COMPONENT(LIBNAME ${${OTHERLIBRARY}} NAME_WE)
|
|
|
|
EXEC_PROGRAM(${CMAKE_OTOOL} ARGS "-L ${${MYLIBRARY}} | grep ${LIBNAME}" OUTPUT_VARIABLE OTOOL_LIBRARY)
|
|
|
|
EXEC_PROGRAM(${CMAKE_OTOOL} ARGS "-L ${${MYLIBRARY}} | grep ${LIBNAME}" OUTPUT_VARIABLE OTOOL_LIBRARY)
|
|
|
|
MESSAGE(STATUS "Checking if ${LIBNAME} is linked to ${${MYLIBRARY}}")
|
|
|
|
# MESSAGE(STATUS "Checking if ${LIBNAME} is linked to ${${MYLIBRARY}}")
|
|
|
|
IF(OTOOL_LIBRARY MATCHES "${LIBNAME}")
|
|
|
|
IF(OTOOL_LIBRARY MATCHES "${LIBNAME}")
|
|
|
|
SET(${LIBRARY_FOUND} TRUE)
|
|
|
|
SET(${LIBRARY_FOUND} TRUE)
|
|
|
|
MESSAGE(STATUS "Library ${LIBNAME} already linked to ${${MYLIBRARY}}")
|
|
|
|
# MESSAGE(STATUS "Library ${LIBNAME} already linked to ${${MYLIBRARY}}")
|
|
|
|
ENDIF(OTOOL_LIBRARY MATCHES "${LIBNAME}")
|
|
|
|
ENDIF(OTOOL_LIBRARY MATCHES "${LIBNAME}")
|
|
|
|
ENDIF(CMAKE_OTOOL)
|
|
|
|
ENDIF(CMAKE_OTOOL)
|
|
|
|
ELSEIF(UNIX)
|
|
|
|
ELSEIF(UNIX)
|
|
|
@ -122,8 +122,6 @@ MACRO(LINK_DEPENDS LIBRARIES MYLIBRARY OTHERLIBRARY SYMBOL)
|
|
|
|
IF(MUST_LINK)
|
|
|
|
IF(MUST_LINK)
|
|
|
|
MESSAGE(STATUS "Linking with ${${OTHERLIBRARY}}")
|
|
|
|
MESSAGE(STATUS "Linking with ${${OTHERLIBRARY}}")
|
|
|
|
SET(${LIBRARIES} ${${LIBRARIES}} ${${OTHERLIBRARY}})
|
|
|
|
SET(${LIBRARIES} ${${LIBRARIES}} ${${OTHERLIBRARY}})
|
|
|
|
|
|
|
|
SET(${OTHERLIBRARY}_LINKED TRUE)
|
|
|
|
ENDIF(MUST_LINK)
|
|
|
|
ENDIF(MUST_LINK)
|
|
|
|
# IF(LIBRARY_FOUND)
|
|
|
|
NDMACRO(LINK_DEPENDS)
|
|
|
|
# SET(${OTHERLIBRARY}_LINKED TRUE)
|
|
|
|
|
|
|
|
# ENDIF(LIBRARY_FOUND)
|
|
|
|
|
|
|
|
ENDMACRO(LINK_DEPENDS)
|
|
|
|
|
|
|
|