From d2a52b8aafe8c49ed4e893f2c73ef3556e23de20 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Sat, 11 Apr 2020 10:53:33 -0400 Subject: [PATCH] samples: philosophers: evaluate variables coming from command line The variables passed by sanitycheck and west were being ignored because cmake knows nothing about them. Fixes #24178 Signed-off-by: Anas Nashif --- samples/philosophers/CMakeLists.txt | 12 ++++++++++++ .../cmsis_rtos_v1/philosophers/CMakeLists.txt | 10 ++++++++++ .../cmsis_rtos_v2/philosophers/CMakeLists.txt | 10 ++++++++++ 3 files changed, 32 insertions(+) diff --git a/samples/philosophers/CMakeLists.txt b/samples/philosophers/CMakeLists.txt index 89f3899406be61..5c70f26c9b617d 100644 --- a/samples/philosophers/CMakeLists.txt +++ b/samples/philosophers/CMakeLists.txt @@ -4,4 +4,16 @@ cmake_minimum_required(VERSION 3.13.1) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) project(philosophers) +if(DEFINED DEBUG_PRINTF) + zephyr_compile_definitions(DEBUG_PRINTF) +endif() +if(DEFINED SAME_PRIO) + zephyr_compile_definitions(SAME_PRIO) +endif() +if(DEFINED STATIC_OBJS) + zephyr_compile_definitions(STATIC_OBJS) +endif() +if(DEFINED FORKS) + zephyr_compile_definitions(FORKS=${FORKS}) +endif() target_sources(app PRIVATE src/main.c) diff --git a/samples/portability/cmsis_rtos_v1/philosophers/CMakeLists.txt b/samples/portability/cmsis_rtos_v1/philosophers/CMakeLists.txt index f4583f1664958f..e8bc028297c140 100644 --- a/samples/portability/cmsis_rtos_v1/philosophers/CMakeLists.txt +++ b/samples/portability/cmsis_rtos_v1/philosophers/CMakeLists.txt @@ -4,5 +4,15 @@ cmake_minimum_required(VERSION 3.13.1) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) project(philosophers_cmsis_rtos_v1) +if(DEFINED DEBUG_PRINTF) + zephyr_compile_definitions(DEBUG_PRINTF) +endif() +if(DEFINED SAME_PRIO) + zephyr_compile_definitions(SAME_PRIO) +endif() +if(DEFINED FORKS) + zephyr_compile_definitions(FORKS=${FORKS}) +endif() + target_include_directories(app PRIVATE ${ZEPHYR_BASE}/include/cmsis_rtos_v1) target_sources(app PRIVATE src/main.c) diff --git a/samples/portability/cmsis_rtos_v2/philosophers/CMakeLists.txt b/samples/portability/cmsis_rtos_v2/philosophers/CMakeLists.txt index 6e73d7992f062c..e4008efc090b57 100644 --- a/samples/portability/cmsis_rtos_v2/philosophers/CMakeLists.txt +++ b/samples/portability/cmsis_rtos_v2/philosophers/CMakeLists.txt @@ -4,5 +4,15 @@ cmake_minimum_required(VERSION 3.13.1) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) project(philosophers) +if(DEFINED DEBUG_PRINTF) + zephyr_compile_definitions(DEBUG_PRINTF) +endif() +if(DEFINED SAME_PRIO) + zephyr_compile_definitions(SAME_PRIO) +endif() +if(DEFINED FORKS) + zephyr_compile_definitions(FORKS=${FORKS}) +endif() + target_include_directories(app PRIVATE ${ZEPHYR_BASE}/include/cmsis_rtos_v2) target_sources(app PRIVATE src/main.c)