cmake配使用boost

1
2
3
4
5
6
7
8
9
10
11
# boost
link_directories("/usr/locate/boost/")
# find
find_package(Boost COMPONENTS json "system" filesystem program_options locale json REQUIRED)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
MESSAGE( STATUS "Boost_INCLUDE_DIRS = ${Boost_INCLUDE_DIRS}.")
MESSAGE( STATUS "Boost_LIBRARIES = ${Boost_LIBRARIES}.")
MESSAGE( STATUS "Boost_LIB_VERSION = ${Boost_LIB_VERSION}.")
target_link_libraries (${PROJECT_NAME} PRIVATE ${Boost_LIBRARIES})
endif()