2019-04-06 21:08:09 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2022-03-14 19:56:40 +08:00
|
|
|
foreach(extra_flags EXTRA_CPPFLAGS EXTRA_LDFLAGS EXTRA_CFLAGS EXTRA_CXXFLAGS EXTRA_AFLAGS)
|
2023-10-23 17:24:39 +08:00
|
|
|
# Note: zephyr_get MERGE should not be used until issue #43959 is resolved.
|
|
|
|
zephyr_get(${extra_flags})
|
2022-03-14 19:56:40 +08:00
|
|
|
list(LENGTH ${extra_flags} flags_length)
|
|
|
|
if(flags_length LESS_EQUAL 1)
|
|
|
|
# A length of zero means no argument.
|
|
|
|
# A length of one means a single argument or a space separated list was provided.
|
|
|
|
# In both cases, it is safe to do a separate_arguments on the argument.
|
|
|
|
separate_arguments(${extra_flags}_AS_LIST UNIX_COMMAND ${${extra_flags}})
|
|
|
|
else()
|
|
|
|
# Already a proper list, no conversion needed.
|
|
|
|
set(${extra_flags}_AS_LIST "${${extra_flags}}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2017-11-10 19:22:23 +08:00
|
|
|
|
|
|
|
if(EXTRA_CPPFLAGS)
|
2019-12-11 12:55:52 +08:00
|
|
|
zephyr_compile_options(${EXTRA_CPPFLAGS_AS_LIST})
|
2017-11-10 19:22:23 +08:00
|
|
|
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()
|