cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(test)
zephyr_compile_definitions(PROJECT_NAME=${PROJECT_NAME})

# NORDIC SDK APP START
target_sources(app PRIVATE src/main.c)
# NORDIC SDK APP END

# Include source directory
target_include_directories(app PRIVATE src)
target_include_directories(app PRIVATE include/${BOARD}/)
zephyr_include_directories_ifdef(CONFIG_MEMFAULT configuration/memfault)

add_custom_target(flash_hex
        nrfjprog --program ${CMAKE_SOURCE_DIR}/build/zephyr/merged.hex --sectorerase &&
        nrfjprog -r
        DEPENDS merged_hex
)

add_custom_target(recover
        nrfjprog --recover
)
