Commit aeea7b6d authored by Jonathan Perkin's avatar Jonathan Perkin

Don't try to remove from an empty list.

parent 9ae1b1d1
...@@ -253,24 +253,26 @@ ENDIF() ...@@ -253,24 +253,26 @@ ENDIF()
# Extract dependencies using CMake's internal ${target}_LIB_DEPENDS variable # Extract dependencies using CMake's internal ${target}_LIB_DEPENDS variable
# returned string in ${var} is can be passed to linker's command line # returned string in ${var} is can be passed to linker's command line
MACRO(EXTRACT_LINK_LIBRARIES target var) MACRO(EXTRACT_LINK_LIBRARIES target var)
LIST(REMOVE_ITEM ${target}_LIB_DEPENDS "") IF(${target}_LIB_DEPENDS)
LIST(REMOVE_DUPLICATES ${target}_LIB_DEPENDS) LIST(REMOVE_ITEM ${target}_LIB_DEPENDS "")
FOREACH(lib ${${target}_LIB_DEPENDS}) LIST(REMOVE_DUPLICATES ${target}_LIB_DEPENDS)
# Filter out "general", it is not a library, just CMake hint FOREACH(lib ${${target}_LIB_DEPENDS})
# Also, remove duplicates # Filter out "general", it is not a library, just CMake hint
IF(NOT lib STREQUAL "general" AND NOT ${var} MATCHES "-l${lib} ") # Also, remove duplicates
IF (lib MATCHES "^\\-l") IF(NOT lib STREQUAL "general" AND NOT ${var} MATCHES "-l${lib} ")
SET(${var} "${${var}} ${lib} ") IF (lib MATCHES "^\\-l")
ELSEIF(lib MATCHES "^/") SET(${var} "${${var}} ${lib} ")
# Full path, convert to just filename, strip "lib" prefix and extension ELSEIF(lib MATCHES "^/")
GET_FILENAME_COMPONENT(lib "${lib}" NAME_WE) # Full path, convert to just filename, strip "lib" prefix and extension
STRING(REGEX REPLACE "^lib" "" lib "${lib}") GET_FILENAME_COMPONENT(lib "${lib}" NAME_WE)
SET(${var} "${${var}}-l${lib} " ) STRING(REGEX REPLACE "^lib" "" lib "${lib}")
ELSE() SET(${var} "${${var}}-l${lib} " )
SET(${var} "${${var}}-l${lib} " ) ELSE()
SET(${var} "${${var}}-l${lib} " )
ENDIF()
ENDIF() ENDIF()
ENDIF() ENDFOREACH()
ENDFOREACH() ENDIF()
IF(MSVC) IF(MSVC)
STRING(REPLACE "-l" "" ${var} "${${var}}") STRING(REPLACE "-l" "" ${var} "${${var}}")
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