[CMake] FindPkgConfig module on Windows

ehrhart.dev at free.fr ehrhart.dev at free.fr
Mon Feb 9 10:33:53 EST 2009


Hello,
I understand that the Findxxx() module (like FindBoost) is better than use of
pkg-config file (particularly with cross compiling context), but pkg-config can
be convenient.
I've installed the pkg-config port on windows (from gnome.org) and it seems to
work at a first glance.
but I've got a problem with the prefix path variable in the *.pc file. On
windows, by default, pkg-config tries to guess the prefix (not in Linux). So on
my machine, it always defines prefix variable as "c:\usr\local". One of the goal
of pkg-config is parameterization, so if prefix is ignored, it does not do the
good job, .imho. In fact, we can use the --dont-define-prefix command line
parameter of pkg-config. With this, pkg-config acts as attended.

I think the FindPkgConfig module could have an option/variable for
--dont-define-prefix use with windows variant.

I statically write
<code>
if(WIN32)
   set(PKG_CONFIG_EXECUTABLE ${PKG_CONFIG_EXECUTABLE} --dont-define-prefix
endif(WIN32)
</code>

Manfred


More information about the CMake mailing list