diff --git a/contrib/dblink/meson.build b/contrib/dblink/meson.build
index 3ab78668288..e2be066cd70 100644
--- a/contrib/dblink/meson.build
+++ b/contrib/dblink/meson.build
@@ -13,7 +13,7 @@ endif
 dblink = shared_module('dblink',
   dblink_sources,
   kwargs: contrib_mod_args + {
-    'dependencies': contrib_mod_args['dependencies'] + [libpq],
+    'dependencies': [libpq] + contrib_mod_args['dependencies'],
   },
 )
 contrib_targets += dblink
diff --git a/contrib/postgres_fdw/meson.build b/contrib/postgres_fdw/meson.build
index 8b29be24dee..4138fbe61ae 100644
--- a/contrib/postgres_fdw/meson.build
+++ b/contrib/postgres_fdw/meson.build
@@ -17,7 +17,7 @@ endif
 postgres_fdw = shared_module('postgres_fdw',
   postgres_fdw_sources,
   kwargs: contrib_mod_args + {
-    'dependencies': contrib_mod_args['dependencies'] + [libpq],
+    'dependencies': [libpq] + contrib_mod_args['dependencies'],
   },
 )
 contrib_targets += postgres_fdw
diff --git a/src/backend/replication/libpqwalreceiver/meson.build b/src/backend/replication/libpqwalreceiver/meson.build
index 2150f31cfa3..5318a76e29d 100644
--- a/src/backend/replication/libpqwalreceiver/meson.build
+++ b/src/backend/replication/libpqwalreceiver/meson.build
@@ -14,7 +14,7 @@ libpqwalreceiver = shared_module('pqwalreceiver',
   libpqwalreceiver_sources,
   kwargs: pg_mod_args + {
     'name_prefix': 'lib',
-    'dependencies': pg_mod_args['dependencies'] + [libpq],
+    'dependencies': [libpq] + pg_mod_args['dependencies'],
   }
 )
 
diff --git a/src/bin/pg_amcheck/meson.build b/src/bin/pg_amcheck/meson.build
index 316ea0d40b8..c8f792ff971 100644
--- a/src/bin/pg_amcheck/meson.build
+++ b/src/bin/pg_amcheck/meson.build
@@ -12,7 +12,7 @@ endif
 
 pg_amcheck = executable('pg_amcheck',
   pg_amcheck_sources,
-  dependencies: [frontend_code, libpq],
+  dependencies: [libpq, frontend_code],
   kwargs: default_bin_args,
 )
 bin_targets += pg_amcheck
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index f795ff28271..4fe711177af 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -58,7 +58,7 @@ psql = executable('psql',
   psql_sources,
   c_pch: pch_postgres_fe_h,
   include_directories: include_directories('.'),
-  dependencies: [frontend_code, libpq, readline],
+  dependencies: [libpq, frontend_code, readline],
   kwargs: default_bin_args,
 )
 bin_targets += psql
diff --git a/src/fe_utils/meson.build b/src/fe_utils/meson.build
index a18cbc939e4..7487869f1cf 100644
--- a/src/fe_utils/meson.build
+++ b/src/fe_utils/meson.build
@@ -31,7 +31,7 @@ fe_utils_sources += psqlscan
 fe_utils = static_library('libpgfeutils',
   fe_utils_sources + generated_headers,
   c_pch: pch_postgres_fe_h,
-  include_directories: [postgres_inc, libpq_inc],
+  include_directories: [libpq_inc, postgres_inc],
   c_args: host_system == 'windows' ? ['-DFD_SETSIZE=1024'] : [],
   dependencies: frontend_common_code,
   kwargs: default_lib_args,
diff --git a/src/test/modules/libpq_pipeline/meson.build b/src/test/modules/libpq_pipeline/meson.build
index d9f26f84f69..a6dc3a1b717 100644
--- a/src/test/modules/libpq_pipeline/meson.build
+++ b/src/test/modules/libpq_pipeline/meson.build
@@ -12,7 +12,7 @@ endif
 
 libpq_pipeline = executable('libpq_pipeline',
   libpq_pipeline_sources,
-  dependencies: [frontend_code, libpq],
+  dependencies: [libpq, frontend_code],
   kwargs: default_bin_args + {
     'install': false,
   },
