zephyr/tests/ztest/mock/CMakeLists.txt
Torsten Rasmussen e1c1d1daca cmake: make find_package(ZephyrUnittest...) REQUIRED
This commit is a followup to PR #25808 which updates the tests to
ensure the REQUIRED keyword is also used for the ZephyrUnitest package.

This provides a better error message when building with CMake and
forgetting ZEPHYR_BASE or not registering Zephyr in the CMake package
registry.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-06-12 11:10:23 +02:00

16 lines
391 B
CMake

# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.13.1)
if(BOARD STREQUAL unit_testing)
list(APPEND SOURCES src/main.c)
find_package(ZephyrUnittest REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(mock)
else()
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(mock)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
endif()