Skip to content

Instantly share code, notes, and snippets.

@ctnguyenvn
Last active March 11, 2021 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctnguyenvn/08b5a405851231053b258c494c520441 to your computer and use it in GitHub Desktop.
Save ctnguyenvn/08b5a405851231053b258c494c520441 to your computer and use it in GitHub Desktop.
add boost lib to CMakeList.txt

add config below to CMakeList.txt

  • Change ON|OFF to enable/disable boost lib
  • Change version 1.75 to your boost version
  • Change progname to your programe name
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.75.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()

# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment