mirror of
https://github.com/msgpack/msgpack-c.git
synced 2026-01-11 08:34:21 +01:00
Merge pull request #412 from redboltz/add_disable_legacy_macros_for_build
Added MSGPACK_DISABLE_LEGACY_NIL to build system and documents.
This commit is contained in:
@@ -21,6 +21,8 @@ OPTION (MSGPACK_CXX11 "Using c++11 compiler" OFF)
|
||||
OPTION (MSGPACK_32BIT "32bit compile" OFF)
|
||||
OPTION (MSGPACK_BOOST "Using boost libraries" OFF)
|
||||
|
||||
SET (CMAKE_CXX_FLAGS "-DMSGPACK_DISABLE_LEGACY_NIL ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
IF (APPLE)
|
||||
SET(CMAKE_MACOSX_RPATH ON)
|
||||
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||
|
||||
@@ -47,11 +47,13 @@ int main(void) {
|
||||
Compile it as follows:
|
||||
|
||||
```
|
||||
$ g++ hello.cc -o hello
|
||||
$ g++ -Ipath_to_msgpack/include -DMSGPACK_DISABLE_LEGACY_NIL hello.cc -o hello
|
||||
$ ./hello
|
||||
["Hello", "MessagePack"]
|
||||
```
|
||||
|
||||
See [MSGPACK_DISABLE_LEGACY_NIL](https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_configure#msgpack_disable_legacy_nil-since-140).
|
||||
|
||||
## Streaming feature
|
||||
|
||||
```cpp
|
||||
@@ -83,7 +85,7 @@ int main(void) {
|
||||
}
|
||||
|
||||
// results:
|
||||
// $ g++ stream.cc -o stream
|
||||
// $ g++ -Ipath_to_msgpack/include -DMSGPACK_DISABLE_LEGACY_NIL stream.cc -o stream
|
||||
// $ ./stream
|
||||
// "Log message ... 1"
|
||||
// "Log message ... 2"
|
||||
@@ -91,6 +93,8 @@ int main(void) {
|
||||
}
|
||||
```
|
||||
|
||||
See [MSGPACK_DISABLE_LEGACY_NIL](https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_configure#msgpack_disable_legacy_nil-since-140).
|
||||
|
||||
### Streaming into an array or map
|
||||
|
||||
```cpp
|
||||
|
||||
@@ -112,7 +112,9 @@ Usage
|
||||
When you use msgpack on C++03 and C++11, you can just add
|
||||
msgpack-c/include to your include path:
|
||||
|
||||
g++ -I msgpack-c/include your_source_file.cpp
|
||||
g++ -I msgpack-c/include -DMSGPACK_DISABLE_LEGACY_NIL your_source_file.cpp
|
||||
|
||||
See [MSGPACK_DISABLE_LEGACY_NIL](https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_configure#msgpack_disable_legacy_nil-since-140).
|
||||
|
||||
If you want to use C version of msgpack, you need to build it. You can
|
||||
also install the C and C++ versions of msgpack.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -pthread
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -pthread -DMSGPACK_DISABLE_LEGACY_NIL
|
||||
AM_C_CPPFLAGS = -I$(top_srcdir)/include -pthread
|
||||
AM_LDFLAGS = $(top_builddir)/src/libmsgpackc.la -lgtest_main -lgtest -lpthread
|
||||
|
||||
|
||||
Reference in New Issue
Block a user