unittest: Only add main.c if it exists

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 <peress@google.com>
This commit is contained in:
Yuval Peress 2022-10-06 10:31:18 -06:00 committed by Carles Cufí
commit 9cebf732ee

View file

@ -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()