From 43be369e5d55d716bb7ebcdf2a94f85af9d88601 Mon Sep 17 00:00:00 2001 From: skb666 Date: Fri, 13 Oct 2023 14:47:56 +0800 Subject: [PATCH] fixed the issue where there was a warning due to not specifying the program version when compiling with cmake --- examples/demo1/main/src/main.c | 6 +++++- tools/cmake/compile.cmake | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/demo1/main/src/main.c b/examples/demo1/main/src/main.c index 83ad273..182b1ca 100644 --- a/examples/demo1/main/src/main.c +++ b/examples/demo1/main/src/main.c @@ -21,7 +21,11 @@ int main() { - printf("hello\n"); +#if DEBUG + printf("!!! DEBUG !!!\n"); +#elif RELEASE + printf("!!! RELEASE !!!\n"); +#endif test(); test1(); #if CONFIG_COMPONENT2_ENABLED diff --git a/tools/cmake/compile.cmake b/tools/cmake/compile.cmake index 13b68f3..fc3d1ae 100644 --- a/tools/cmake/compile.cmake +++ b/tools/cmake/compile.cmake @@ -380,10 +380,12 @@ macro(project name) endif() # add DEBUG or RELEASE flag globally - if(CMAKE_BUILD_TYPE STREQUAL "Debug") + if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "Debug") add_definitions(-DDEBUG=1 -DRELEASE=0) + # message("!!! DEBUG !!!") else() add_definitions(-DRELEASE=1 -DDEBUG=0) + # message("!!! RELEASE !!!") endif() # Add dependence: update configfile, append time and git info for global config header file