Change PKG_CONFIG_PATH of pkg-config in MinGW

ccompilationmingwpkg-config

I want to change the directory where pkg-config looks for .pr files. I'm using pkg-config under MinGW on Windows. I found that this can be done by changing the PKG_CONFIG_PATH environment variable using export PKG_CONFIG_PATH=[path]. The .pr files I want pkg-config to find are not installed in the MinGW directory, but somewhere in the "normal" windows file system (C:\Program Files (x86)\Gtk+\lib\pkgconfig).

Now to my problem: If I run export PKG_CONFIG_PATH="/c/Program Files (x86)/Gtk+/lib/pkg-config/ and then run pkg-config --cflags gtk+-win32-2.0 I get the following output.

$ pkg-config --cflags gtk+-win32-2.0 --debug
Option --debug seen
Error printing enabled by default due to use of --version, --libs, --cflags, --libs-only-l, --libs-only-L, --libs-only-other, --cflags-only-I, --cflag
s-only-other or --list. Value of --silence-errors: 0
Error printing enabled
Adding virtual 'pkg-config' package to list of known packages
Cannot open directory 'c' in package search path: No such file or directory
Cannot open directory '/Program Files (x86)/Gtk+/lib/pkgconfig/' in package search path: No such file or directory
Scanning directory '/usr/lib/pkgconfig'
Ignoring file '.' in search directory; not a .pc file
Ignoring file '..' in search directory; not a .pc file

etc.

So how must I specify the path of the .pr files so pkg-config can find it? This is not an issue if I install the .pr files in the MinGW directory, they are found without changing the environment variable.

Best Answer

No, you should use $(GTK_COMPILE) in your main.o Makefile target instead of $(GTK_LINK). $(GTK_COMPILE) calls pkg-config --cflags which will return the CFLAGS you need to compile (the location of the header files). The LIBS you need for linking, not compiling