1# SPDX-License-Identifier: Apache-2.0
2
3cmake_minimum_required(VERSION 3.20.0)
4
5if(DEFINED APPLICATION_CONFIG_DIR)
6  # Has been specified as relative on CMake invocation, convert to absolute
7  # and keep reference to see it's identical when Zephyr boilerplate returns.
8  get_filename_component(EXPECTED_APPLICATION_CONFIG_DIR ${APPLICATION_CONFIG_DIR} ABSOLUTE)
9else()
10  # We expect a board config setup
11  set(EXPECTED_APPLICATION_CONFIG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD})
12endif()
13
14find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
15
16project(app_config_dir_test)
17
18if(CONFIG_FAIL_TEST)
19  message(FATAL_ERROR "Test failed, "
20    "actual CONFIG_FAIL_TEST=${CONFIG_FAIL_TEST}, "
21    "expected CONFIG_FAIL_TEST=n"
22  )
23endif()
24
25if(NOT "${APPLICATION_CONFIG_DIR}" STREQUAL "${EXPECTED_APPLICATION_CONFIG_DIR}")
26  message(FATAL_ERROR "Test failed, "
27    "actual APPLICATION_CONFIG_DIR=${APPLICATION_CONFIG_DIR}, "
28    "expected APPLICATION_CONFIG_DIR=${EXPECTED_APPLICATION_CONFIG_DIR}"
29  )
30endif()
31
32target_sources(app PRIVATE src/main.c)
33