问题描述
我正在尝试将Postgresql
添加为我的项目的依赖项,为此我正在使用ExternalProject模块从github下载源代码并进行构建,但是从cmake(cmake --build .
运行时,构建步骤失败)。配置步骤似乎成功了,如果我转到EP_BASE
下的Build目录并执行make
,它就可以成功运行。在构建过程中出现以下错误:
<...>/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
我的外部项目添加如下所示:
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
)
这是在具有cmake 3.16.3,gcc 9.3.0的Ubuntu 20.04 LTS上运行的
解决方法
尝试
ExternalProject_Get_Property(postgresql_external install_dir)
include_directories(${install_dir}/include)
我想,您尚未将include
目录传播到目标,但这是evtl。系统已知的信息(因此成功调用了手动调用的make
)