Skip to content

Commit a6aa717

Browse files
Add zephyr/CMakeLists.txt
Created a module-level CMakeLists.txt for extending the include paths to find "mcuboot-mbedtls-cfg.h" within the boot/zephyr component. The build of `west build -p always -b nrf52840dk_nrf52840 mcuboot/boot/zephyr` fails with: CMake Error at /home/zephyr/mcuboot_dev/mcuboot/zephyr/CMakeLists.txt:36 (add_subdirectory): add_subdirectory not given a binary directory but the given source directory "/home/zephyr/mcuboot_dev/mcuboot/boot/bootutil/zephyr" is not a subdirectory of "/home/zephyr/mcuboot_dev/mcuboot/zephyr". When specifying an out-of-tree source a binary directory must be explicitly specified. The build of `west build -p always -b nrf52840dk_nrf52840 mcuboot/samples/zephyr_external_config` fails with: CMake Error at /home/zephyr/mcuboot_dev/mcuboot/zephyr/CMakeLists.txt:36 (add_subdirectory): add_subdirectory not given a binary directory but the given source directory "/home/zephyr/mcuboot_dev/mcuboot/boot/bootutil/zephyr" is not a subdirectory of "/home/zephyr/mcuboot_dev/mcuboot/zephyr". When specifying an out-of-tree source a binary directory must be explicitly specified. Signed-off-by: Gregory SHUE <[email protected]>
1 parent 6af2c06 commit a6aa717

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

zephyr/CMakeLists.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (c) 2022 Legrand North America, LLC.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
6+
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
7+
8+
9+
# Detect the platform reliably
10+
if(ZEPHYR_BASE)
11+
else()
12+
message(FATAL_ERROR "ZEPHYR_BASE needs to be defined for Zephyr builds")
13+
endif()
14+
15+
# Verify the module name is set correctly
16+
set(expected_module_name "mcuboot")
17+
if(NOT "${module_name}" STREQUAL ${expected_module_name})
18+
message(FATAL_ERROR "A module configuration error has occurred.
19+
This module is named '${module_name}' when '${expected_module_name}' \
20+
is expected.
21+
Verify `module.yml` contains the line 'name: ${expected_module_name}'.")
22+
endif()
23+
unset(expected_module_name)
24+
25+
#Do not allow in source builds
26+
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
27+
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
28+
29+
30+
#
31+
# Module options managed through Kconfig and use names CONFIG_*
32+
#
33+
34+
zephyr_include_directories(../boot/zephyr/include)
35+
36+
add_subdirectory(../boot/bootutil/zephyr)

zephyr/module.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
samples:
22
- boot/zephyr
33
build:
4-
cmake: ./boot/bootutil/zephyr
4+
cmake: ./zephyr
55
kconfig: ./zephyr/Kconfig

0 commit comments

Comments
 (0)