# ExternalProject\_Add for Makefile project error during build

**URL:** https://discourse.cmake.org/t/externalproject-add-for-makefile-project-error-during-build/2275
**Category:** Usage
**Created:** [December 1, 2020, 7:04pm UTC](https://discourse.cmake.org/t/externalproject-add-for-makefile-project-error-during-build/2275 "2020-12-01T19:04:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![eqbalz](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@eqbalz](https://discourse.cmake.org/u/eqbalz)
#### Post date: [December 1, 2020, 7:04pm UTC](https://discourse.cmake.org/t/externalproject-add-for-makefile-project-error-during-build/2275/1 "2020-12-01T19:04:08Z")

</div>

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:

```auto
<...>/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:

```auto
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

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [December 2, 2020, 8:10pm UTC](https://discourse.cmake.org/t/externalproject-add-for-makefile-project-error-during-build/2275/2 "2020-12-02T20:10:12Z")

</div>

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)?
