[cmake-developers] FindPkgConfig and CMAKE_PREFIX_PATH

Daniele E. Domenichelli daniele.domenichelli at gmail.com
Tue Oct 22 03:27:03 EDT 2013


Hello all,

FindPkgConfig does not support the CMAKE_PREFIX_PATH variable.
This is because pkg-config uses the PKG_CONFIG_PATH and does not know
anything
about CMAKE_PREFIX_PATH.

As a consequence, pkg-config packages built and installed in a non standard
directory using ExternalProject, cannot be found, while cmake ones can
be easily
located setting the CMAKE_PREFIX_PATH variable.

Do you think it could make sense to add to FindPkgConfig something like
this?

  set(_pkgconfig_path $ENV{PKG_CONFIG_PATH})
  foreach(_dir ${CMAKE_PREFIX_PATH})
    set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${_dir}/lib/pkgconfig")
  endforeach()

  [...] (search for package)

  set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path})


Cheers,
 Daniele



More information about the cmake-developers mailing list