ExternalProject_Add for Makefile project error during build

I am trying to add Postgresql as a dependency for my project for which I am using ExternalProject module to download the source from github and build, but the build step fails when running from cmake (cmake --build .). Configure step seems to succeed and if I go to the Build directory under EP_BASE and do a make it runs successfully. I get the following error during build:

<...>/Source/postgresql_external/src/common/relpath.c:21:10: fatal error: catalog/pg_tablespace_d.h: No such file or directory
21 | #include "catalog/pg_tablespace_d.h"
  |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[5]: *** [<builtin>: relpath.o] Error 1
make[4]: *** [Makefile:42: all-common-recurse] Error 2
make[3]: *** [GNUmakefile:11: all-src-recurse] Error 2

My external project add looks like the following:

ExternalProject_Add(postgresql_external
  GIT_REPOSITORY    https://github.com/postgres/postgres.git
  GIT_TAG           REL_12_4
  CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
  LOG_CONFIGURE 1
  LOG_BUILD 1
  LOG_INSTALL 1
)

This is running on Ubuntu 20.04 LTS, with cmake 3.16.3, gcc 9.3.0

I suspect that a parallel build is being done. What if you just do BUILD_COMMAND make as well (to disable any automatic parallel flag things)?