I use waf as my build system and I want to compile a small C program using Postgres. I have included postgres.h
in my program so I need to find the path to it in my wscript
file. I know that I can get the path I need by running:
pg_config --includedir-server
which gives me:
/usr/include/postgresql/9.3/server
So I thought I could use something like this:
cfg.check_cfg(
path='pg_config',
package='',
uselib_store='PG',
args='--includedir-server',
)
And then build my program by:
bld.program(
source=['testpg.c'],
target='testpg',
includes=['.', '../src'],
use=['PQ', 'PG'],
)
But this fails with postgres.h: No such file or directory
. I ran ./waf -v
and confirmed that the proper -I
flag is not being passed to gcc
. My guess is this happens because pg_config
does not add a -I
prefix to the path it returns. Is there a way I can make waf
to add the prefix, or make pg_config
to add it?