From 7b513eb86eaa9029131cd972fe16790cefa2b1d7 Mon Sep 17 00:00:00 2001 From: Cyril Fougeray Date: Wed, 8 May 2024 17:12:01 +0200 Subject: [PATCH] build: new variable make board selection easier (#22) * build: new variable make board selection easier when setting ORB=pearl or ORB=diamond, the board is selected automatically. it allows to use one profile per Orb on CLion: the profile selects the board when loading the CMakeLists.txt. We still have to create a new profile for Debug/Release * build: unset to remove BOARD from CMakeCache before overwriting it Co-authored-by: Moritz Diller <93255185+moritz-diller@users.noreply.github.com> --------- Co-authored-by: Moritz Diller <93255185+moritz-diller@users.noreply.github.com> --- main_board/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main_board/CMakeLists.txt b/main_board/CMakeLists.txt index 5ac7eafb..7efee053 100644 --- a/main_board/CMakeLists.txt +++ b/main_board/CMakeLists.txt @@ -33,6 +33,15 @@ set_property( set_property(GLOBAL PROPERTY CSTD gnu11) +# optional Orb variable allows to select the board +if ("$ENV{ORB}" STREQUAL "pearl") + unset(BOARD CACHE) + set(ENV{BOARD} pearl_main) +elseif ("$ENV{ORB}" STREQUAL "diamond") + unset(BOARD CACHE) + set(ENV{BOARD} diamond_main) +endif () + # Load board before Zephyr loads it to get some custom/private board configuration. # Private config is not available publicly as the name suggests and contains # paths to private keys.