Skip to content

Commit

Permalink
unittest: Only add main.c if it exists
Browse files Browse the repository at this point in the history
Downstream it's easier to write tests that use target_sources after
including the unittest package instead of specifying a list of sources
before. But if we do that, currently, main.c is added and the build
breaks because it doesn't exist.

Signed-off-by: Yuval Peress <[email protected]>
  • Loading branch information
yperess authored and carlescufi committed Oct 31, 2022
1 parent bea16ca commit 9cebf73
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/modules/unittest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if((NOT DEFINED ZEPHYR_BASE) AND (DEFINED ENV_ZEPHYR_BASE))
set(ZEPHYR_BASE ${ENV_ZEPHYR_BASE} CACHE PATH "Zephyr base")
endif()

if(NOT SOURCES)
if(NOT SOURCES AND EXISTS main.c)
set(SOURCES main.c)
endif()

Expand Down

0 comments on commit 9cebf73

Please sign in to comment.