Skip to content

Commit d7be4e6

Browse files
ArekBalysNordicanangl
authored andcommitted
[nrf toup] Normalize Zephyr compile flags before exporting to GN
Normalize Zephyr compile flags before exporting them to Matter GN args by rewriting `$<TARGET_PROPERTY:LTO>` to `$<TARGET_PROPERTY:zephyr_interface,LTO>`. This avoids CMake generate-time failures in `file(GENERATE)` after recent Zephyr LTO/KERNEL_NO_LTO changes. Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
1 parent d3d393b commit d7be4e6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

config/nrfconnect/chip-module/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,15 @@ if (CONFIG_CHIP_LOG_FILE_NAME)
9292
endif()
9393

9494
zephyr_get_compile_flags(ZEPHYR_CFLAGS_C C)
95+
96+
# Zephyr may emit unqualified TARGET_PROPERTY genex (e.g. $<TARGET_PROPERTY:LTO>)
97+
# that cannot be evaluated by file(GENERATE) in matter_generate_args_tmp_file().
98+
set(ZEPHYR_CFLAGS_C "${ZEPHYR_CFLAGS_C}")
99+
string(REPLACE "$<TARGET_PROPERTY:LTO>" "$<TARGET_PROPERTY:zephyr_interface,LTO>" ZEPHYR_CFLAGS_C "${ZEPHYR_CFLAGS_C}")
95100
matter_add_cflags("${ZEPHYR_CFLAGS_C}")
96101
zephyr_get_compile_flags(ZEPHYR_CFLAGS_CC CXX)
102+
set(ZEPHYR_CFLAGS_CC "${ZEPHYR_CFLAGS_CC}")
103+
string(REPLACE "$<TARGET_PROPERTY:LTO>" "$<TARGET_PROPERTY:zephyr_interface,LTO>" ZEPHYR_CFLAGS_CC "${ZEPHYR_CFLAGS_CC}")
97104
matter_add_cxxflags("${ZEPHYR_CFLAGS_CC}")
98105
zephyr_get_gnu_cpp_standard(ZEPHYR_GNU_CPP_STD)
99106
matter_add_cxxflags(${ZEPHYR_GNU_CPP_STD})

0 commit comments

Comments
 (0)