ubuntu18.04编译安装jsoncpp

jsoncpp源码下载点这里

注:cmake版本要高于3.8.0,可参考cmake安装教程

wget https://cmake.org/files/v3.9/cmake-3.9.2.tar.gz
解压文件
tar -zxvf cmake-3.9.2.tar.gz
cd cmake-3.9.2
sudo ./bootstrap --prefix=/usr
make
sudo make install
vi ~/.bashrc
export PATH=$PATH:/usr/local/bin(cmake安装目录)
cmake --version

1.解压缩并进入目录
tar -jxvf jsoncpp.tar.bz2
cd jsoncpp

2.创建编译目录并进入,防止弄脏源码
mkdir -p ./build/debug
cd build/debug

3.编译安装
cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_INCLUDEDIR=include/jsoncpp -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" ../..
sudo make && make install

你可能感兴趣的:(环境搭建)