diff --git a/cmake/postgres.cmake b/cmake/postgres.cmake
index 0dad71069..32fdae2f8 100644
--- a/cmake/postgres.cmake
+++ b/cmake/postgres.cmake
@@ -7,3 +7,27 @@ find_package(PostgreSQL REQUIRED)
 mark_as_advanced(CLEAR POSTGRESQL_INCLUDE_DIR)
 mark_as_advanced(CLEAR POSTGRESQL_LIBRARIES)
 include_directories(${POSTGRESQL_INCLUDE_DIR})
+
+include(SelectLibraryConfigurations)
+
+find_library(PostgreSQLCommon_LIBRARY_DEBUG
+NAMES libpgcommond pgcommond pgcommon libpgcommon 
+NAMES_PER_DIR
+)
+find_library(PostgreSQLCommon_LIBRARY_RELEASE
+NAMES pgcommon libpgcommon
+NAMES_PER_DIR
+)
+select_library_configurations(PostgreSQLCommon)
+
+find_library(PostgreSQLPort_LIBRARY_DEBUG
+NAMES pgportd libpgportd  pgport libpgport 
+NAMES_PER_DIR
+)
+find_library(PostgreSQLPort_LIBRARY_RELEASE
+NAMES pgport libpgport 
+NAMES_PER_DIR
+)
+select_library_configurations(PostgreSQLPort)
+
+list(APPEND POSTGRESQL_LIBRARIES ${PostgreSQLPort_LIBRARIES} ${PostgreSQLCommon_LIBRARIES})
\ No newline at end of file
