Compiler/TI: Add compiler flags to linker

By adding the compiler flags via `<FLAGS>` to the linker call,
the linker can decide which default library to use.

CMake replaces `<FLAGS>` by the content of `CMAKE_<LANG>_FLAGS`.
So any relevant flag needs to be defined in this variable, preferably
in a toolchain file.

The compiler flags have to be specified before the `--run_linker`
flag and the linker flags afterwards.

Replaces Merge-request !4890
This commit is contained in:
Josef Angstenberger
2020-07-11 18:19:34 +02:00
parent 763b44e519
commit 5dec322f33

View File

@@ -29,7 +29,7 @@ macro(__compiler_ti lang)
set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> qa <TARGET> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_FINISH "")
set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_${lang}_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET_NAME>.map <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>")
set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_${lang}_COMPILER> <FLAGS> --run_linker --output_file=<TARGET> --map_file=<TARGET_NAME>.map <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>")
endmacro()
set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")