Skip to content

Commit 16a4087

Browse files
RobinKastbergcarlescufi
authored andcommitted
cmake: iar: Don't assume C compiler is gcc.
Let's not assume everyone takes gcc parameters. Currently IAR do use gcc for DTS preprocessing. This should be fixed nicer, but with this fix we can start testing other things. Signed-off-by: Robin Kastberg <[email protected]>
1 parent 1c14b16 commit 16a4087

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

subsys/partition_manager/CMakeLists.txt

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,22 @@ endif()
1616
set_shared(IMAGE ${IMAGE_NAME} PROPERTY ZEPHYR_BINARY_DIR ${ZEPHYR_BINARY_DIR})
1717

1818
function(preprocess_pm_yml in_file out_file)
19-
execute_process(
20-
COMMAND ${CMAKE_C_COMPILER}
21-
-x assembler-with-cpp
22-
-nostdinc
23-
-I${ZEPHYR_BINARY_DIR}/include/generated
24-
${NOSYSDEF_CFLAG}
25-
-P
26-
-E ${in_file}
27-
-o ${out_file}
19+
20+
if(DEFINED CMAKE_DTS_PREPROCESSOR)
21+
set(dts_preprocessor ${CMAKE_DTS_PREPROCESSOR})
22+
else()
23+
set(dts_preprocessor ${CMAKE_C_COMPILER})
24+
endif()
25+
26+
27+
zephyr_dt_preprocess(CPP ${dts_preprocessor}
28+
INCLUDE_DIRECTORIES ${ZEPHYR_BINARY_DIR}/include/generated
29+
EXTRA_CPPFLAGS -P ${NOSYSDEF_CFLAG}
30+
SOURCE_FILES ${in_file}
31+
OUT_FILE ${out_file}
2832
WORKING_DIRECTORY ${ZEPHYR_BINARY_DIR}
29-
RESULT_VARIABLE ret
3033
)
34+
3135
if(NOT "${ret}" STREQUAL "0")
3236
message(FATAL_ERROR "command failed with return code: ${ret}")
3337
endif()

0 commit comments

Comments
 (0)