building jsoncpp (Linux) - an instruction for us mere mortals? building jsoncpp (Linux) - an instruction for us mere mortals? json json

building jsoncpp (Linux) - an instruction for us mere mortals?


Here's what I did:

apt-get install sconswget "http://downloads.sourceforge.net/project/jsoncpp/jsoncpp/0.5.0/jsoncpp-src-0.5.0.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fjsoncpp%2F&ts=1294425421&use_mirror=freefr"tar -xvzf jsoncpp-src-0.5.0.tar.gzcd jsoncpp-src-0.5.0scons platform=linux-gcc

jsoncpp doesn't seem to install itself, so you'll have to manually copy the library and header files wherever you want them when you're building applications that use the library.


It is now pretty easy to do using cmake:

Make sure CMake is installed and than in the main repo run the following commands:

mkdir -p build/debugcd build/debugcmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_STATIC=ON-DJSONCPP_LIB_BUILD_SHARED=OFF -G "Unix Makefiles" ../..makemake install


The CMAKE solution is also deprecated now. The current build solution is provided here

cd jsoncpp-master/BUILD_TYPE=release#plain, debug, debugoptimized, release, minsizeLIB_TYPE=shared#LIB_TYPE=staticmeson --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} . build-${LIB_TYPE}ninja -v -C build-${LIB_TYPE} test

And for newbies, a simple test example is given here.