当前位置: 首页 > news >正文

引用Boost库 CMakeList的写法

引用Boost库 CMakeList的写法

flyfish

环境arm

cmake_minimum_required(VERSION 3.5)project(example LANGUAGES CXX)set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)set(BOOST_PREFIX /media/Boost/build/out/arm64-v8a/)
set(BOOST_INCLUDE_DIR "${BOOST_PREFIX}/include/boost-1_82/")
set(BOOST_LIB_DIR "${BOOST_PREFIX}/lib/")set(BOOST_LIBS"${BOOST_LIB_DIR}/libboost_filesystem-clang-mt-a64-1_82.a""${BOOST_LIB_DIR}/libboost_thread-clang-mt-a64-1_82.a""${BOOST_LIB_DIR}/libboost_timer-clang-mt-a64-1_82.a""${BOOST_LIB_DIR}/libboost_log-clang-mt-a64-1_82.a""${BOOST_LIB_DIR}/libboost_log_setup-clang-mt-a64-1_82.a""${BOOST_LIB_DIR}/libboost_date_time-clang-mt-a64-1_82.a")include_directories(${BOOST_INCLUDE_DIR}
)add_executable(examplemain.cpp)
target_link_libraries(example  "${BOOST_LIBS}"  -static-libstdc++ -lm  -ldl -frtti -fexceptions)

测试

#include <iostream>
#include <fstream>
#include <iomanip>
#include <boost/property_tree/ini_parser.hpp>#include <boost/thread.hpp>
#include <boost/asio.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/noncopyable.hpp>#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/smart_ptr/make_shared_object.hpp>
#include <boost/log/core.hpp>
#include <boost/log/sinks/sync_frontend.hpp>
#include <boost/log/sinks/text_ostream_backend.hpp>
#include <boost/filesystem.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
#include <boost/log/sources/severity_logger.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/support/date_time.hpp>
#include <boost/property_tree/ini_parser.hpp>namespace logging = boost::log;
namespace src = boost::log::sources;
namespace expr = boost::log::expressions;
namespace keywords = boost::log::keywords;
namespace sinks = boost::log::sinks;
using namespace boost::property_tree;
using namespace boost::filesystem;
//using namespace boost::asio;
// 如果都用error则 boost::log::trivial::error 和 boost::asio::error 有歧义。所以asio会使用命名空间
void init_log()
{logging::add_file_log(keywords::file_name = "sample_%N.log",keywords::rotation_size = 10 * 1024 * 1024,keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0),keywords::auto_flush = true,//keywords::format = "[%TimeStamp%]: %Message%"keywords::format =(expr::stream<< expr::format_date_time< boost::posix_time::ptime >("TimeStamp", "%Y-%m-%d %H:%M:%S")<< ": <" << logging::trivial::severity<< "> " << expr::smessage));
}
int main(int argc, char **argv)
{init_log();logging::add_common_attributes();using namespace logging::trivial;src::severity_logger< severity_level > lg;BOOST_LOG_SEV(lg, trace) << "A trace severity message";BOOST_LOG_SEV(lg, debug) << "A debug severity message";BOOST_LOG_SEV(lg, info) << "An informational severity message";BOOST_LOG_SEV(lg, warning) << "A warning severity message";BOOST_LOG_SEV(lg, boost::log::trivial::error) << "An error severity message";BOOST_LOG_SEV(lg, fatal) << "A fatal severity message";
}
http://www.lryc.cn/news/118964.html

相关文章:

  • Kibana 可视化数据分析以及es常用的数据分析函数
  • golang云原生怎么学?
  • Jenkins+Nginx+vue
  • 【vue 监听页面滑动到底部】
  • (一)创建型设计模式:2、单例模式(C++实现实例 线程安全)
  • 《练习100》86~90
  • C++——命名空间、输入、输出
  • 解锁滴滴ES的性能潜力:JDK 17和ZGC的升级之路
  • Permutation and Primes 2023牛客暑期多校训练营8 J
  • centos如何配置IP地址?
  • git clone 报错Filename too long
  • 【雕爷学编程】Arduino动手做(184)---快餐盒盖,极低成本搭建机器人实验平台3
  • redis String类型命令
  • Blazor 简单组件(0):简单介绍
  • 在vue3+vite项目中使用jsx语法
  • HCIA 路由器工作原理 及其 静态路由配置
  • 【Git】—— git的配置
  • [git] git基础知识
  • 【从零学习python 】15.深入了解字符串及字符集编码
  • 【LeetCode】打家劫舍||
  • 【Nginx】Nginx的重定向——location
  • 每日一题——滑动窗口的最大值
  • 【使用go开发区块链】之获取链上数据(03)
  • js 动态设置transformOrigin
  • docker使用tab无法自动补全命令
  • 既然jmeter也能做接口自动化,为什么还需要pytest自己搭框架?
  • Objective-C获取变量类型的方法
  • 相机可见区域,使用鼠标拖拽模型
  • Vue 2 与 Vue 3 的全面比较
  • Unity学习笔记--如何优雅简便地利用对象池生成游戏对象(进阶版)LRU + 对象池