The package boost is compatible with built-in CMake targets: find_package(Boost REQUIRED [COMPONENTS ...]) target_link_libraries(main PRIVATE ${Boost_LIBRARIES}) target_include_directories(main PRIVATE ${Boost_INCLUDE_DIRS})