From 19965f8173c735ba50f484c4d5e13632765e1308 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Tue, 24 Mar 2020 11:55:15 +0900 Subject: [PATCH] cmake: qemu: Support delayed expansion of QEMU_KERNEL_OPTION This commit allows the `QEMU_KERNEL_OPTION` variable, which can be overridden by the `board.cmake`, to contain references to the variables that are not available at the time of `board.cmake` inclusion, by expanding its escpaed variable references in `cmake/emu/qemu.cmake` which is included nearby the end of the root `CMakeLists.txt`. With this change, the `board.cmake` can escape variable references as follows and allow them to be expanded later: set(QEMU_KERNEL_OPTION "-device;loader,file=\$") Signed-off-by: Stephanos Ioannidis --- boards/arm/qemu_cortex_r5/board.cmake | 2 +- cmake/emu/qemu.cmake | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/boards/arm/qemu_cortex_r5/board.cmake b/boards/arm/qemu_cortex_r5/board.cmake index 00d0afa9a85..a30e4f7144c 100644 --- a/boards/arm/qemu_cortex_r5/board.cmake +++ b/boards/arm/qemu_cortex_r5/board.cmake @@ -14,7 +14,7 @@ set(QEMU_FLAGS_${ARCH} ) set(QEMU_KERNEL_OPTION - "-device;loader,file=$,cpu-num=4" + "-device;loader,file=\$,cpu-num=4" "-device;loader,addr=0xff5e023c,data=0x80008fde,data-len=4" "-device;loader,addr=0xff9a0000,data=0x80000218,data-len=4" ) diff --git a/cmake/emu/qemu.cmake b/cmake/emu/qemu.cmake index 2378927a25b..ae63ccbb96e 100644 --- a/cmake/emu/qemu.cmake +++ b/cmake/emu/qemu.cmake @@ -298,6 +298,8 @@ if(DEFINED QEMU_KERNEL_FILE) set(QEMU_KERNEL_OPTION "-kernel;${QEMU_KERNEL_FILE}") elseif(NOT DEFINED QEMU_KERNEL_OPTION) set(QEMU_KERNEL_OPTION "-kernel;$") +elseif(DEFINED QEMU_KERNEL_OPTION) + string(CONFIGURE "${QEMU_KERNEL_OPTION}" QEMU_KERNEL_OPTION) endif() foreach(target ${qemu_targets})