1# File containing common functions, macros and variables used across all examples. 2# This file should be included in each CMakeLists.txt if compiled with west tool under Zephyr. 3 4# Add common Kconfig file to project. 5list(APPEND CONF_FILE "${CMAKE_CURRENT_LIST_DIR}/common.conf") 6 7# Add project Kconfig file if it exists. 8set(PRJ_CONF_FILE "${CMAKE_CURRENT_SOURCE_DIR}/prj.conf") 9if(EXISTS ${PRJ_CONF_FILE}) 10 list(APPEND CONF_FILE ${PRJ_CONF_FILE}) 11endif() 12 13# Macro adding overlay file and Kconfig file for specified board in given directory. 14# If board-specific files have been found they are added to DTC_OVERLAY_FILE and CONF_FILE 15# symbols that are used in west build system. 16macro(GET_DEVICE_CONFIG_FILES BOARD BOARDS_DIR) 17 if(NOT IS_ABSOLUTE BOARDS_DIR) 18 set(_BOARDS_DIR ${CMAKE_CURRENT_LIST_DIR}/${BOARDS_DIR}) 19 get_filename_component(BOARDS_DIR_ABSOLUTE "${_BOARDS_DIR}" ABSOLUTE) 20 else() 21 set(BOARDS_DIR_ABSOLUTE {BOARDS_DIR}) 22 endif() 23 24 string(REPLACE "/" "_" BOARD_UNDERSCORES ${BOARD}) 25 set(OVERLAY_FILE "${BOARDS_DIR_ABSOLUTE}/${BOARD_UNDERSCORES}.overlay") 26 if(EXISTS ${OVERLAY_FILE}) 27 list(APPEND DTC_OVERLAY_FILE "${OVERLAY_FILE}") 28 endif() 29 30 set(CONFIG_FILE "${BOARDS_DIR_ABSOLUTE}/${BOARD_UNDERSCORES}.conf") 31 if(EXISTS ${CONFIG_FILE}) 32 list(APPEND CONF_FILE "${CONFIG_FILE}") 33 endif() 34endmacro() 35