abbdd88683
It is supported to add give extra flags to the linker from the commandline like this: cmake -DEXTRA_LDFLAGS=-Lmy_dir path But unfortunately this was broken during the CMake migration. Interestingly, the reason that it was broken is that KBuild was also partially broken. KBuild would pass on EXTRA_LDFLAGS when object files were linked together into built-in.o files, but it would not use EXTRA_LDFLAGS for the final link into an elf file. This patch fixes EXTRA_LDFLAGS. Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
29 lines
939 B
CMake
29 lines
939 B
CMake
separate_arguments(EXTRA_CPPFLAGS_AS_LIST UNIX_COMMAND ${EXTRA_CPPFLAGS})
|
|
separate_arguments(EXTRA_LDFLAGS_AS_LIST UNIX_COMMAND ${EXTRA_LDFLAGS})
|
|
separate_arguments(EXTRA_CFLAGS_AS_LIST UNIX_COMMAND ${EXTRA_CFLAGS})
|
|
separate_arguments(EXTRA_CXXFLAGS_AS_LIST UNIX_COMMAND ${EXTRA_CXXFLAGS})
|
|
separate_arguments(EXTRA_AFLAGS_AS_LIST UNIX_COMMAND ${EXTRA_AFLAGS})
|
|
|
|
if(EXTRA_CPPFLAGS)
|
|
zephyr_compile_definitions(${EXTRA_CPPFLAGS_AS_LIST})
|
|
endif()
|
|
if(EXTRA_LDFLAGS)
|
|
zephyr_link_libraries(${EXTRA_LDFLAGS_AS_LIST})
|
|
endif()
|
|
if(EXTRA_CFLAGS)
|
|
foreach(F ${EXTRA_CFLAGS_AS_LIST})
|
|
zephyr_compile_options($<$<COMPILE_LANGUAGE:C>:${F}>)
|
|
endforeach()
|
|
endif()
|
|
if(EXTRA_CXXFLAGS)
|
|
foreach(F ${EXTRA_CXXFLAGS_AS_LIST})
|
|
zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:${F}>)
|
|
endforeach()
|
|
endif()
|
|
if(EXTRA_AFLAGS)
|
|
foreach(F ${EXTRA_AFLAGS_AS_LIST})
|
|
zephyr_compile_options($<$<COMPILE_LANGUAGE:ASM>:${F}>)
|
|
endforeach()
|
|
endif()
|
|
|