add link library paths to build

pull/5476/head
Matthias L. Jugel 2018-01-15 15:51:43 +01:00
parent c968bc2f86
commit 7acad55f5b
2 changed files with 5 additions and 5 deletions

View File

@ -38,9 +38,9 @@ SET(LD_SYS_LIBS "{%- block sys_libs -%} -Wl,--start-group {{ld_sys_libs|join(" "
SET(CMAKE_C_FLAGS "{{cc_flags}} -include mbed_config.h")
SET(CMAKE_CXX_FLAGS "{{cxx_flags}} -include mbed_config.h")
SET(CMAKE_ASM_FLAGS "{{asm_flags}} -include mbed_config.h")
SET(CMAKE_CXX_LINK_FLAGS "{{ld_flags}}")
SET(CMAKE_CXX_LINK_FLAGS "{{ld_flags}} {% for p in library_paths %} {{user_library_flag}}${CMAKE_CURRENT_SOURCE_DIR}/{{p}} {% endfor %}")
{% if pp -%}
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} ${LD_SYS_LIBS} {{link_script_option}} ${CMAKE_BINARY_DIR}/{{name}}.link_script.ld")
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} ${LD_SYS_LIBS} {{link_script_option}} ${CMAKE_BINARY_DIR}/{{name}}_pp.link_script.ld")
{%- endif %}
ADD_DEFINITIONS(
@ -70,9 +70,9 @@ TARGET_LINK_LIBRARIES({{name}} {{ld_sys_libs|join(" ")}})
{% if pp -%}
add_custom_command(TARGET {{name}} PRE_LINK
COMMAND "{{pp}}" {{pp_flags}} {{linker_script}} -o ${CMAKE_CURRENT_BINARY_DIR}/{{name}}.link_script.ld
COMMAND "{{pp}}" {{pp_flags}} {{linker_script}} -o ${CMAKE_CURRENT_BINARY_DIR}/{{name}}_pp.link_script.ld
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/{{name}}.link_script.ld"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/{{name}}_pp.link_script.ld"
)
{%- endif %}

View File

@ -88,7 +88,7 @@ class CMake(Exporter):
'libraries': libraries,
'ld_sys_libs': sys_libs,
'include_paths': sorted(list(set(self.resources.inc_dirs))),
'library_paths': sorted(self.resources.lib_dirs),
'library_paths': sorted([re.sub(r'^[.]/', '', l) for l in self.resources.lib_dirs]),
'linker_script': self.resources.linker_script,
'hex_files': self.resources.hex_files,
'ar': basename(self.toolchain.ar),