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

Solve some problems about cmake build type (debug/release) #548

Closed
dota17 opened this issue Feb 29, 2020 · 0 comments
Closed

Solve some problems about cmake build type (debug/release) #548

dota17 opened this issue Feb 29, 2020 · 0 comments

Comments

@dota17
Copy link
Member

dota17 commented Feb 29, 2020

1. Solve the problem of testcase failure during cmake release-building.
When I run:

cmake -DCMAKE_BUILD_TYPR=Release ..
make
make test

two testcases (test_deep_copy.c / test_json_pointer.c) failed. This is due to NDEBUG macro. When we set -DCMAKE_BUILD_TYPR=Release, this macro will be defined globally by dafault. NDEBUG will make assert() macro invalid. And, at the same time, these two testcases use assert() irregularly. We should avoid function-calling, variable assignment or some operator(++...) in assert( ).

In fact, json-c already consider this issue. emmmm, I think -UNDEBUG is not a valid parameter/option. It does not work.

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -UNDEBUG")

The solution is shown in #547 . Maybe we should also modify all testcase, include: the including of <assert.h> and correct useage of assert().

2. Set default CMAKE_BUILD_TYPE and add the default compilation optimization options.
The default CMAKE_BUILD_TYPE can be set as Debug, Release, RelWithDebInfo,and so on. Debug is convennient for developers. Details is shown in #547. In fact, Debug, Release, RelWithDebInfo are all good choices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant