1.下载
git clone https://github.com/google/glog
2.配置
sudo apt-get install autoconf automake libtool
3.编译&安装
进入源码根目录
./autogen.sh
./configure
make -j 24
sudo make install
4.复制库到/usr/lib
cp /usr/local/lib/libglog* /usr/lib
5.简单示例
#include <glog/logging.h>
int main(int argc,char* argv[])
{
google::InitGoogleLogging((const char *)argv[0]);
google::SetLogDestination(google::GLOG_INFO, "./myInfo");
LOG(WARNING) << "thisis the 1st warning!";
return 0;
}
6.CMakelists.txt增加行
target_link_libraries(control libglog.so)
target_link_libraries(control libglog.so.0)