osqp provides CMake targets: find_package(osqp CONFIG REQUIRED) target_link_libraries(main PRIVATE $,osqp::osqp,osqp::osqpstatic>)