gpt4 book ai didi

c++ - 在哪里可以找到可以在 cmake 中使用的 boost 组件列表?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:24:42 26 4
gpt4 key购买 nike

我有一个 cmake 文件,可以像这样添加 boost:

if(ADD_BOOST)
#add boost library
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)
file(TO_CMAKE_PATH $ENV{BOOST_ROOT} BOOST_ROOT)
if (MSVC)
set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib64-msvc-12.0)
else (MSVC)
set(BOOST_LIBRARY_DIR $ENV{BOOST_ROOT})
endif (MSVC)
find_package(Boost COMPONENTS filesystem system program-options thread REQUIRED)
endif (ADD_BOOST)

我有这一行:

 find_package(Boost COMPONENTS filesystem system program-options thread REQUIRED)

我想使用来自 boost 的程序选项 libabray。我应该在上面的列表中添加什么名字?

我在哪里可以找到我可以在上面提到的 cmake 行中使用的 boost 库列表?

最佳答案

创建一个虚拟的CMakeLists.txt:

cmake_minimum_required(VERSION 3.0)
project(dummy)

set(Boost_DEBUG ON)
find_package(Boost COMPONENTS ALL)

然后检查 cmake 的输出。:

[...]
-- BoostConfig: discovered components: atomic;chrono;container;context;coroutine;date_time;exception;fiber;filesystem;graph;graph_parallel;headers;iostreams;locale;log;log_setup;math_c99;math_c99f;math_c99l;math_tr1;math_tr1f;math_tr1l;mpi;mpi_python;nowide;numpy;prg_exec_monitor;program_options;python;random;regex;serialization;stacktrace_addr2line;stacktrace_backtrace;stacktrace_basic;stacktrace_noop;system;test_exec_monitor;thread;timer;type_erasure;unit_test_framework;wave;wserialization
[...]
-- BoostConfig: Boost_ALL_TARGETS: Boost::headers;Boost::atomic;Boost::chrono;Boost::container;Boost::context;Boost::coroutine;Boost::date_time;Boost::exception;Boost::fiber;Boost::filesystem;Boost::graph;Boost::graph_parallel;Boost::iostreams;Boost::locale;Boost::log;Boost::log_setup;Boost::math_c99;Boost::math_c99f;Boost::math_c99l;Boost::math_tr1;Boost::math_tr1f;Boost::math_tr1l;Boost::mpi;Boost::mpi_python;Boost::nowide;Boost::numpy;Boost::prg_exec_monitor;Boost::program_options;Boost::python;Boost::random;Boost::regex;Boost::serialization;Boost::stacktrace_addr2line;Boost::stacktrace_backtrace;Boost::stacktrace_basic;Boost::stacktrace_noop;Boost::system;Boost::test_exec_monitor;Boost::thread;Boost::timer;Boost::type_erasure;Boost::unit_test_framework;Boost::wave;Boost::wserialization
[...]

请注意,只有当它们安装在您的系统上时,这才能列出组件。我在 Debian 11 上安装 libboost 1.74 开发文件后得到了上述输出(例如 apt install libboost-all-dev=1.74.0.3)。

以下是上述输出的美化版本以供将来引用:

-- BoostConfig: discovered components:
atomic
chrono
container
context
coroutine
date_time
exception
fiber
filesystem
graph
graph_parallel
headers
iostreams
locale
log
log_setup
math_c99
math_c99f
math_c99l
math_tr1
math_tr1f
math_tr1l
mpi
mpi_python
nowide
numpy
prg_exec_monitor
program_options
python
random
regex
serialization
stacktrace_addr2line
stacktrace_backtrace
stacktrace_basic
stacktrace_noop
system
test_exec_monitor
thread
timer
type_erasure
unit_test_framework
wave
wserialization
-- BoostConfig: Boost_ALL_TARGETS:
Boost::headers
Boost::atomic
Boost::chrono
Boost::container
Boost::context
Boost::coroutine
Boost::date_time
Boost::exception
Boost::fiber
Boost::filesystem
Boost::graph
Boost::graph_parallel
Boost::iostreams
Boost::locale
Boost::log
Boost::log_setup
Boost::math_c99
Boost::math_c99f
Boost::math_c99l
Boost::math_tr1
Boost::math_tr1f
Boost::math_tr1l
Boost::mpi
Boost::mpi_python
Boost::nowide
Boost::numpy
Boost::prg_exec_monitor
Boost::program_options
Boost::python
Boost::random
Boost::regex
Boost::serialization
Boost::stacktrace_addr2line
Boost::stacktrace_backtrace
Boost::stacktrace_basic
Boost::stacktrace_noop
Boost::system
Boost::test_exec_monitor
Boost::thread
Boost::timer
Boost::type_erasure
Boost::unit_test_framework
Boost::wave
Boost::wserialization

关于c++ - 在哪里可以找到可以在 cmake 中使用的 boost 组件列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29989512/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com