Put this in your CMakeLists.txt
file (change any options from OFF to ON if you want):
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.45.0 COMPONENTS *boost libraries here*)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(progname file1.cxx file2.cxx)
target_link_libraries(progname ${Boost_LIBRARIES})
endif()
Obviously you need to put the libraries you want where I put *boost libraries here*
. For example, if you're using the filesystem
and regex
library you'd write:
find_package(Boost 1.45.0 COMPONENTS filesystem regex)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…