19869dccdb
* Leverage (older) embedded unit tests into external unit tests build upon copy of Zephyr's ztest library and CMake. * Expand top-level CMake build to run external unit tests. * Expand Zephyr module extension to run external unit tests via west or sanitycheck. Co-authored-by: Gregory Shue <gregory.shue@legrand.us>
35 lines
837 B
CMake
35 lines
837 B
CMake
# SPDX-License-Identifier: MIT
|
|
|
|
cmake_minimum_required(VERSION 3.13.1)
|
|
|
|
# Extract module path and names
|
|
string(REGEX REPLACE
|
|
"/zephyr/tests[a-zA-Z_/-]*$" ""
|
|
BACNET_BASE
|
|
${CMAKE_CURRENT_SOURCE_DIR})
|
|
get_filename_component(BACNET_FILE_BASENAME
|
|
${BACNET_BASE}
|
|
NAME)
|
|
string(REGEX REPLACE
|
|
"^[a-zA-Z_/-]*/zephyr/tests/" ""
|
|
BACNET_FILE_SUBPATH
|
|
${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
|
|
# Add this module to the Zephyr build line
|
|
list(APPEND ZEPHYR_EXTRA_MODULES
|
|
${BACNET_BASE}
|
|
)
|
|
|
|
|
|
# Update include path for this module
|
|
list(APPEND BACNET_INCLUDE ${BACNET_BASE}/src)
|
|
|
|
|
|
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
|
project(${BACNET_FILE_BASENAME})
|
|
|
|
target_include_directories(app PRIVATE ${BACNET_INCLUDE})
|
|
target_sources(app PRIVATE
|
|
${BACNET_BASE}/test/${BACNET_FILE_SUBPATH}/src/main.c)
|