简体   繁体   中英

How to write *.pc files for pkg-config on Windows?

I've recently downloaded the gtk+ all-in-one bundle downloaded from the GTK+ website , which works fine and allows me to build gtk+ applications on Windows using the MinGW compiler.

However, when now looking at the *.pc files for pkg-config in lib/pkgconfig, I noticed something weird. Here's how the beginning of glib-2.0 looks like:

prefix=c:/devel/target/059c48de6b739307c37648aba3005b29
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

My gtk+ folder resides on a different drive than C:\\ and I don't have a C:\\devel folder at all. So what does this prefix stand for? What prefix would I use if I decided to write a *.pc file for easily linking my own application?

Surprisingly enough, using pkg-config works as expected and returns the correct path the libraries and headers inside the gtk+ folder.

The version of pkg-config that comes with the all in one package basically ignores the prefix. It knows to look in ../lib/pkgconfig for the pkg-config files. You don't need to do anything special for your pkgconfig files other than either put them in that pkgconfig directory, or set some environment variables so pkg-config knows where to look for your *.pc files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM