更新时间:2021-07-03 03:50:08
在您的CMakeLists.txt
文件中:
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED ...)
在我有...
的位置,您可以选择放置要使用的库的名称,然后在下面放置target_link_libraries(targetname ${Boost_LIBRARIES})
.如果您有较新的CMake发行版,则应完全按照广告宣传的方式运行.我正是在自己的项目中以这种方式进行操作.
Where I have ...
, you optionally put the names of the libraries you want to use, and then target_link_libraries(targetname ${Boost_LIBRARIES})
later below. If you have a fairly recent distribution of CMake, it should work exactly as advertised. I do it exactly this way in my own projects.