1 2 3 4
The package libpq provides CMake integration: find_package(PostgreSQL REQUIRED) target_link_libraries(main PRIVATE PostgreSQL::PostgreSQL)