Skip to content

Commit

Permalink
Merge pull request #8 from skb666/master
Browse files Browse the repository at this point in the history
fixed the issue when build with cmake
  • Loading branch information
Neutree authored Oct 13, 2023
2 parents 429a7ec + 43be369 commit 694ca6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion examples/demo1/main/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion tools/cmake/compile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 694ca6b

Please sign in to comment.