From 4396ecd22cac5485ce006b330ca3ef3446d0022f Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 25 Jun 2024 11:31:19 +0700 Subject: [PATCH] change COMPILE_DEFINE to CFLAGS_CLI for cmake/make --- .idea/cmake.xml | 2 +- examples/build_system/make/make.mk | 4 ++++ hw/bsp/family_support.cmake | 5 ++--- hw/bsp/rp2040/family.cmake | 5 ++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.idea/cmake.xml b/.idea/cmake.xml index 3c51031c1..1055e31d3 100644 --- a/.idea/cmake.xml +++ b/.idea/cmake.xml @@ -3,7 +3,7 @@ - + diff --git a/examples/build_system/make/make.mk b/examples/build_system/make/make.mk index a78f4130d..1500a51e0 100644 --- a/examples/build_system/make/make.mk +++ b/examples/build_system/make/make.mk @@ -109,6 +109,10 @@ INC += \ BOARD_UPPER = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$(subst -,_,$(BOARD)))))))))))))))))))))))))))) CFLAGS += -DBOARD_$(BOARD_UPPER) +ifdef CFLAGS_CLI + CFLAGS += $(CFLAGS_CLI) +endif + # use max3421 as host controller ifeq (${MAX3421_HOST},1) SRC_C += src/portable/analog/max3421/hcd_max3421.c diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake index d631c8563..9f2e34691 100644 --- a/hw/bsp/family_support.cmake +++ b/hw/bsp/family_support.cmake @@ -201,9 +201,8 @@ function(family_configure_common TARGET RTOS) ) # compile define from command line - if(DEFINED COMPILE_DEFINE) - #separate_arguments(COMPILE_DEFINE_LIST UNIX_COMMAND "${COMPILE_DEFINE}") - target_compile_definitions(${TARGET} PUBLIC ${COMPILE_DEFINE}) + if(DEFINED CFLAGS_CLI) + target_compile_options(${TARGET} PUBLIC ${CFLAGS_CLI}) endif() target_compile_options(${TARGET} PUBLIC ${WARNING_FLAGS_${CMAKE_C_COMPILER_ID}}) diff --git a/hw/bsp/rp2040/family.cmake b/hw/bsp/rp2040/family.cmake index 5d82cbf62..c81390b28 100644 --- a/hw/bsp/rp2040/family.cmake +++ b/hw/bsp/rp2040/family.cmake @@ -176,9 +176,8 @@ function(family_configure_target TARGET RTOS) set(RTOS_SUFFIX ${RTOS_SUFFIX} PARENT_SCOPE) # compile define from command line - if(DEFINED COMPILE_DEFINE) - #separate_arguments(COMPILE_DEFINE_LIST UNIX_COMMAND "${COMPILE_DEFINE}") - target_compile_definitions(${TARGET} PUBLIC ${COMPILE_DEFINE}) + if(DEFINED CFLAGS_CLI) + target_compile_options(${TARGET} PUBLIC ${CFLAGS_CLI}) endif() pico_add_extra_outputs(${TARGET})