You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 regels
720 B

  1. function(library_path_to_linker_flags LD_FLAGS LIB_PATHS)
  2. foreach(L ${LIB_PATHS})
  3. get_filename_component(DIR ${L} PATH)
  4. get_filename_component(LIBFILE ${L} NAME_WE)
  5. STRING(REGEX REPLACE "^lib" "" FILE ${LIBFILE})
  6. if (${L} MATCHES "[.]framework$")
  7. set(FILE_OPT "-framework ${FILE}")
  8. set(DIR_OPT "-F${DIR}")
  9. else()
  10. set(FILE_OPT "-l${FILE}")
  11. set(DIR_OPT "-L${DIR}")
  12. endif()
  13. if ("${DIR}" STREQUAL "" OR "${DIR}" STREQUAL "${LASTDIR}")
  14. set (DIR_OPT "")
  15. endif()
  16. set(LASTDIR ${DIR})
  17. set(${LD_FLAGS} ${${LD_FLAGS}} ${DIR_OPT} ${FILE_OPT} PARENT_SCOPE)
  18. string (REPLACE ";" " " ${LD_FLAGS} "${${LD_FLAGS}}")
  19. endforeach()
  20. endfunction()