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