py/mkrules.cmake: Support passing CFLAGS_EXTRA in environment variable.
This works similarly to the existing support in "bare metal" make ports, with the caveat that CMake will only set this value on a clean build and will reuse the previous value otherwise. This is slightly different to the CMake built-in support for CFLAGS, as this variable is used when evaluating source files for qstr generation, etc. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
parent
71df9d0636
commit
516709be88
1 changed files with 9 additions and 0 deletions
|
|
@ -53,6 +53,15 @@ foreach(_arg ${MICROPY_CPP_DEF})
|
|||
endforeach()
|
||||
list(APPEND MICROPY_CPP_FLAGS ${MICROPY_CPP_FLAGS_EXTRA})
|
||||
|
||||
# Include anything passed in via CFLAGS_EXTRA
|
||||
# in both MICROPY_CPP_FLAGS and CMAKE_C_FLAGS
|
||||
if(DEFINED ENV{CFLAGS_EXTRA})
|
||||
set(CFLAGS_EXTRA $ENV{CFLAGS_EXTRA})
|
||||
string(APPEND CMAKE_C_FLAGS " ${CFLAGS_EXTRA}") # ... not a list
|
||||
separate_arguments(CFLAGS_EXTRA)
|
||||
list(APPEND MICROPY_CPP_FLAGS ${CFLAGS_EXTRA}) # ... a list
|
||||
endif()
|
||||
|
||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||
|
||||
target_sources(${MICROPY_TARGET} PRIVATE
|
||||
|
|
|
|||
Loading…
Reference in a new issue