Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed the issue when build with cmake #8

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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