box2d provides CMake targets: find_package(box2d CONFIG REQUIRED) target_link_libraries(main PRIVATE box2d::box2d)