Skip to content

Commit 9e7a951

Browse files
hakonfammbolivar-nordic
authored andcommitted
[nrf toup] cmake: only unset CMAKE_C_COMPILER for first image
The C compiler does not change between the different images. Add a check to ensure that the C compiler variable is only unset for the first boilerplate execution. Signed-off-by: Håkon Øye Amundsen <[email protected]> (cherry picked from commit 33c0613) (cherry picked from commit 6c85501) (cherry picked from commit 05270ea) Signed-off-by: Martí Bolívar <[email protected]>
1 parent ab080f1 commit 9e7a951

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cmake/target_toolchain.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ endif()
3838

3939
# The 'generic' compiler and the 'target' compiler might be different,
4040
# so we unset the 'generic' one and thereby force the 'target' to
41-
# re-set it.
42-
unset(CMAKE_C_COMPILER)
43-
unset(CMAKE_C_COMPILER CACHE)
41+
# re-set it. This is only needed for the first boilerplate execution as
42+
# the remaining boilerplate executions will use the same C compiler.
43+
if (FIRST_BOILERPLATE_EXECUTION)
44+
unset(CMAKE_C_COMPILER)
45+
unset(CMAKE_C_COMPILER CACHE)
46+
endif()
4447

4548
# A toolchain consist of a compiler and a linker.
4649
# In Zephyr, toolchains require a port under cmake/toolchain/.

0 commit comments

Comments
 (0)