pagmo2 provides CMake targets: find_package(pagmo CONFIG REQUIRED) target_link_libraries(main PRIVATE Pagmo::pagmo)