Files
bacnet_stack/zephyr/tests/unit/bacnet/bits/CMakeLists.txt
T
Greg Shue 78f7340266 Issues/issue 593 update to zephyr v3 6 0 (#601)
* [WIP] update manifest to zephyr v3.6.0

* [WIP] Deprecated ZTEST_NEW_API adjustments

Zephyr v3.6.0 removed Kconfig ZTEST_NEW_API.
The old ZTEST API is still used by non-Zephyr builds,
so the config setting is moved from `prj.conf` to
the test's CMakeLists.txt as `add_compile_definitions()`.

Verified by:

1. make clean all test

2. ./zephyr/scripts/twister -p unit_testing \
        -T bacnet-stack/zephyr/tests/

---------

Co-authored-by: Gregory Shue <gregory.shue@legrand.com>
2024-03-15 08:29:05 -07:00

29 lines
858 B
CMake

# Copyright (c) 2022 Legrand North America, LLC.
#
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
if(NOT ZEPHYR_CURRENT_MODULE_DIR)
string(REGEX REPLACE "/zephyr/tests/[a-zA-Z_/-]*$" ""
ZEPHYR_CURRENT_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
endif()
set(SOURCES
${ZEPHYR_CURRENT_MODULE_DIR}/test/unit/bacnet/bits/src/main.c
)
project(bacnet_bits)
find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE})
# NOTE for Zephyr >= v3.2.0:
# - Zephyr unittest builds for target 'testbinary' instead of 'app'.
# - Zephyr unittest does not generate ZEPHYR_<modulename>_MODULE_DIR.
# So we have to use relative paths to get to the source.
target_include_directories(testbinary PRIVATE
${ZEPHYR_CURRENT_MODULE_DIR}/src
)
add_compile_definitions(CONFIG_ZTEST_NEW_API) # For exposing deprecated Kconfig