1# Copyright (c) 2021-2023 Nordic Semiconductor 2# 3# SPDX-License-Identifier: Apache-2.0 4 5cmake_minimum_required(VERSION 3.20) 6 7if(NOT DEFINED APP_DIR) 8 message(FATAL_ERROR "No main application specified") 9endif() 10 11# This will update the APP_DIR cache variable to PATH type and apply a comment. 12# If APP_DIR is a relative path, then CMake will adjust to absolute path based 13# on current working dir. 14set(APP_DIR ${APP_DIR} CACHE PATH "Main Application Source Directory") 15set(Sysbuild_DIR ${CMAKE_CURRENT_LIST_DIR}/../sysbuild-package/cmake) 16 17project(sysbuild_toplevel LANGUAGES) 18 19if(NOT DEFINED APPLICATION_BINARY_DIR) 20 set(APPLICATION_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Application Binary Directory") 21endif() 22 23if(EXISTS ${APP_DIR}/sysbuild/CMakeLists.txt) 24 add_subdirectory(${APP_DIR}/sysbuild _sysbuild) 25else() 26 add_subdirectory(template _sysbuild) 27endif() 28 29build_info(sysbuild VALUE true) 30build_info(application source-dir VALUE ${CMAKE_CURRENT_SOURCE_DIR}) 31yaml_context(EXISTS NAME build_info result) 32if(result) 33 yaml_save(NAME build_info) 34endif() 35